diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2009-07-05 15:51:23 -0400 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2009-07-05 15:51:23 -0400 |
commit | 4d10b01b0851122c7ad87cd073d8c13cf14fb63c (patch) | |
tree | de4e5e166ffbbac02702acdab768bc1a5abe2571 /etc | |
parent | c62532d09971929e3903aae5bf09af87fbff36b7 (diff) | |
download | pfsense-4d10b01b0851122c7ad87cd073d8c13cf14fb63c.zip pfsense-4d10b01b0851122c7ad87cd073d8c13cf14fb63c.tar.gz |
Sync with HEAD
Diffstat (limited to 'etc')
-rw-r--r-- | etc/rc.initial.firmware_update | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/etc/rc.initial.firmware_update b/etc/rc.initial.firmware_update index 5755633..2ddc69e 100644 --- a/etc/rc.initial.firmware_update +++ b/etc/rc.initial.firmware_update @@ -2,18 +2,15 @@ <?php -$g['booting'] = true; require("globals.inc"); +$g['booting'] = true; echo "Starting the {$g['product_name']} console firmware update system"; require("functions.inc"); echo "."; -require("config.inc"); -echo "."; -$g['booting'] = false; -$d_fwupenabled_path = $g['varrun_path'] . "/fwup.enabled"; +$g['booting'] = false; $fp = fopen('php://stdin', 'r'); @@ -46,7 +43,7 @@ switch ($command) { $status = does_url_exist($url); if($status) { conf_mount_rw(); - touch($d_fwupenabled_path); + mark_subsystem_dirty('firmware'); if(file_exists("/root/firmware.tgz")) unlink("/root/firmware.tgz"); echo "\nFetching file size...\n"; @@ -92,12 +89,13 @@ switch ($command) { echo "Binary DIFF upgrade file detected...\n"; $type = "bdiff"; } - if(strstr($url,"bdiff")) {} + if(strstr($url,"nanobsd")) {} echo "NanoBSD upgrade file detected...\n"; $type = "nanobsd"; } if(file_exists("/root/firmware.tgz")) { - do_upgrade("/root/firmware.tgz", $type); + exec("mv /root/firmware.tgz /root/firmware.bz2"); + do_upgrade("/root/firmware.bz2", $type); exit; } else { echo "\nCould not download update.\n\n"; @@ -113,10 +111,10 @@ switch ($command) { } if(stristr($fp,"bdiff")) $type = "bdiff"; - if(stristr($fp,"bdiff")) + if(stristr($fp,"nanobsd")) $type = "nanobsd"; if(file_exists($path)) { - touch($d_fwupenabled_path); + mark_subsystem_dirty('firmware'); do_upgrade($path, $type); } else { echo "\nCould not find file.\n\n"; @@ -163,7 +161,7 @@ function check_for_kernel_file() { function do_upgrade($path, $type) { global $g; - touch($g['varrun_path'] . "/firmware.lock"); + mark_subsystem_dirty('firmwarelock'); check_for_kernel_file(); echo "\nOne moment please...\nInvoking firmware upgrade..."; if($type == "bdiff") @@ -173,16 +171,16 @@ function do_upgrade($path, $type) { else mwexec_bg("/etc/rc.firmware pfSenseupgrade $path"); sleep(10); - while(file_exists("{$g['varrun_path']}/firmware.lock")) { + while(is_subsystem_dirty('firmwarelock')) { sleep(1); echo "."; } + sleep(10); echo "Done. Rebooting...\n\n"; - if(file_exists($g['varrun_path'] . "/firmware.lock")) - unlink($g['varrun_path'] . "/firmware.lock"); + clear_subsystem_dirty('firmwarelock'); } exec("rm -f /root/*.md5"); fclose($fp); -?>
\ No newline at end of file +?> |