diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2009-06-27 18:41:54 -0400 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2009-06-27 18:41:54 -0400 |
commit | b58554994bd66a2c9dc20657f72a0fac2c8dbaee (patch) | |
tree | 80f7b986acd265780e4a516984f47fc6b0371fae /etc | |
parent | b538999b7f53dea4934c7d64ee4eff4020dcd5f8 (diff) | |
download | pfsense-b58554994bd66a2c9dc20657f72a0fac2c8dbaee.zip pfsense-b58554994bd66a2c9dc20657f72a0fac2c8dbaee.tar.gz |
Add support for the NanoBSD platform
Diffstat (limited to 'etc')
-rw-r--r-- | etc/rc.initial_firmware_update | 48 |
1 files changed, 33 insertions, 15 deletions
diff --git a/etc/rc.initial_firmware_update b/etc/rc.initial_firmware_update index bb1beb4..3853c2b 100644 --- a/etc/rc.initial_firmware_update +++ b/etc/rc.initial_firmware_update @@ -2,12 +2,11 @@ <?php -echo "."; +$g['booting'] = true; require("globals.inc"); echo "Starting the {$g['product_name']} console firmware update system"; -$g['booting'] = true; require("functions.inc"); echo "."; require("config.inc"); @@ -82,15 +81,21 @@ switch ($command) { echo "Downloaded file MD5: $file_md5\n"; if($source_md5 <> $file_md5) { echo "\n\nMD5 checksum does not match. Cancelling upgrade.\n\n"; - fclose($fp); exec("rm -f /root/*.md5"); + fclose($fp); die -1; } echo "\nMD5 checksum matches.\n"; exec("rm -f /root/*.md5"); } - if(file_exists("/root/firmware.tgz")) - do_upgrade("/root/firmware.tgz"); + if(stristr($url,"bdiff")) + $type = "bdiff"; + if(stristr($url,"bdiff")) + $type = "nanobsd"; + if(file_exists("/root/firmware.tgz")) { + do_upgrade("/root/firmware.tgz", $type); + exit; + } } else { echo "\nCould not download update.\n\n"; fclose($fp); @@ -103,9 +108,13 @@ switch ($command) { fclose($fp); die; } + if(stristr($fp,"bdiff")) + $type = "bdiff"; + if(stristr($fp,"bdiff")) + $type = "nanobsd"; if(file_exists($path)) { touch($d_fwupenabled_path); - do_upgrade($path); + do_upgrade($path, $type); } else { echo "\nCould not find file.\n\n"; fclose($fp); @@ -149,18 +158,27 @@ function check_for_kernel_file() { } } -function do_upgrade($path) { - global $fp, $g; - touch($g['varrun_path'] . "/firmware.lock"); +function do_upgrade($path, $type) { + global $g; + touch($g['varrun_path'] . "/firmware.lock"); check_for_kernel_file(); - echo "\nOne moment please... Invoking firmware upgrade...\n"; - exec("/etc/rc.firmware pfSenseupgrade $path"); - unlink_if_exists($path); - unlink_if_exists($g['varrun_path'] . "/firmware.lock"); - die; + echo "\nOne moment please...\nInvoking firmware upgrade..."; + if($type == "bdiff") + mwexec_bg("/etc/rc.firmware delta_update $path"); + elseif($type == "nanobsd") + mwexec_bg("/etc/rc.firmware pfSenseNanoBSDupgrade $path"); + else + mwexec_bg("/etc/rc.firmware pfSenseupgrade $path"); + sleep(10); + while(file_exists("{$g['varrun_path']}/firmware.lock")) { + sleep(1); + echo "."; + } + echo "Done. Rebooting...\n\n"; + unlink($g['varrun_path'] . "/firmware.lock"); } exec("rm -f /root/*.md5"); fclose($fp); -?> +?>
\ No newline at end of file |