summaryrefslogtreecommitdiffstats
path: root/usr/local/www
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2013-02-13 18:30:28 +0000
committerErmal <eri@pfsense.org>2013-02-13 18:30:28 +0000
commite6d5af4b003982b47a387be1a4a668ff5ce09b9e (patch)
tree357ca357d0657f55cb29edb39b849cb1b40bdfe3 /usr/local/www
parent22ef0a3d227424fbd6ead5044c933b06cd4f6674 (diff)
downloadpfsense-e6d5af4b003982b47a387be1a4a668ff5ce09b9e.zip
pfsense-e6d5af4b003982b47a387be1a4a668ff5ce09b9e.tar.gz
Call rc.firmware for propper platform during manual upgrade
Diffstat (limited to 'usr/local/www')
-rwxr-xr-xusr/local/www/system_firmware.php54
1 files changed, 28 insertions, 26 deletions
diff --git a/usr/local/www/system_firmware.php b/usr/local/www/system_firmware.php
index f17d1cc..ff80bd3 100755
--- a/usr/local/www/system_firmware.php
+++ b/usr/local/www/system_firmware.php
@@ -70,12 +70,13 @@ function file_is_for_platform($filename, $ul_name) {
else
return false;
}
- exec("/usr/bin/tar xzf $filename -C /tmp/ etc/platform");
+ $_gb = exec("/usr/bin/tar xzf $filename -C /tmp/ etc/platform");
+ unset($_gb);
if(!file_exists("/tmp/etc/platform"))
return false;
- $upgrade_is_for_platform = trim(file_get_contents("/tmp/etc/platform"));
- if($g['platform'] == $upgrade_is_for_platform) {
- unlink("/tmp/etc/platform");
+ $upgrade_is_for_platform = trim(file_get_contents("/tmp/etc/platform", " \n\t\r"));
+ if ($g['platform'] == $upgrade_is_for_platform) {
+ @unlink("/tmp/etc/platform");
return true;
}
return false;
@@ -120,12 +121,8 @@ if(is_subsystem_dirty('firmwarelock')) {
if($_POST['backupbeforeupgrade'])
touch("/tmp/perform_full_backup.txt");
-if($_POST['kerneltype'] && in_array($_POST['kerneltype'], array_keys($kerneltypes))) {
- if($_POST['kerneltype'] == "single")
- touch("/boot/kernel/pfsense_kernel.txt");
- else
- file_put_contents("/boot/kernel/pfsense_kernel.txt", $_POST['kerneltype']);
-}
+if ($_POST['kerneltype'] && in_array($_POST['kerneltype'], array_keys($kerneltypes)))
+ file_put_contents("/boot/kernel/pfsense_kernel.txt", $_POST['kerneltype']);
/* Handle manual upgrade */
if ($_POST && !is_subsystem_dirty('firmwarelock')) {
@@ -185,22 +182,27 @@ if ($_POST && !is_subsystem_dirty('firmwarelock')) {
run_plugins("/usr/local/pkg/firmware_upgrade");
- /* Check for input errors, firmware locks, warnings, then check for firmware if sig_override is set */
- if (!$input_errors && !is_subsystem_dirty('firmwarelock') && (!$sig_warning || $_POST['sig_override'])) {
- if (file_exists("{$g['upload_path']}/firmware.tgz")) {
- /* fire up the update script in the background */
- mark_subsystem_dirty('firmwarelock');
- $savemsg = gettext("The firmware is now being updated. The firewall will reboot automatically.");
- if(stristr($_FILES['ulfile']['name'],"nanobsd") or $_POST['isnano'] == "yes")
- mwexec_bg("/etc/rc.firmware pfSenseNanoBSDupgrade {$g['upload_path']}/firmware.tgz");
- else if(stristr($_FILES['ulfile']['name'],"bdiff"))
- mwexec_bg("/etc/rc.firmware delta_update {$g['upload_path']}/firmware.tgz");
- else
- mwexec_bg("/etc/rc.firmware pfSenseupgrade {$g['upload_path']}/firmware.tgz");
- } else {
- $savemsg = sprintf(gettext("Firmware image missing or other error, please try again %s."),$errortext);
- }
- }
+ /* Check for input errors, firmware locks, warnings, then check for firmware if sig_override is set */
+ if (!$input_errors && !is_subsystem_dirty('firmwarelock') && (!$sig_warning || $_POST['sig_override'])) {
+ if (file_exists("{$g['upload_path']}/firmware.tgz")) {
+ /* fire up the update script in the background */
+ mark_subsystem_dirty('firmwarelock');
+ $savemsg = gettext("The firmware is now being updated. The firewall will reboot automatically.");
+ if (stristr($_FILES['ulfile']['name'],"nanobsd") or $_POST['isnano'] == "yes")
+ mwexec_bg("/etc/rc.firmware pfSenseNanoBSDupgrade {$g['upload_path']}/firmware.tgz");
+ else if(stristr($_FILES['ulfile']['name'],"bdiff"))
+ mwexec_bg("/etc/rc.firmware delta_update {$g['upload_path']}/firmware.tgz");
+ else {
+ if($g['platform'] == "nanobsd")
+ $whichone = "pfSenseNanoBSDupgrade";
+ else
+ $whichone = "pfSenseupgrade";
+ mwexec_bg("/etc/rc.firmware {$whichone} {$g['upload_path']}/firmware.tgz");
+ unset($whichone);
+ }
+ } else
+ $savemsg = sprintf(gettext("Firmware image missing or other error, please try again %s."),$errortext);
+ }
}
}
}
OpenPOWER on IntegriCloud