diff options
Diffstat (limited to 'etc/rc.initial.firmware_update')
-rwxr-xr-x | etc/rc.initial.firmware_update | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/etc/rc.initial.firmware_update b/etc/rc.initial.firmware_update index ec8aad5..cdbaa9b 100755 --- 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"; @@ -116,7 +113,7 @@ switch ($command) { if(stristr($fp,"bdiff")) $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 +160,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,17 +170,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 +?> |