summaryrefslogtreecommitdiffstats
path: root/usr/local/www/system_firmware_auto.php
diff options
context:
space:
mode:
authorRenato Botelho <renato.botelho@bluepex.com>2009-07-31 15:41:19 -0300
committerRenato Botelho <renato.botelho@bluepex.com>2009-07-31 15:41:19 -0300
commit0ba45a7917dea4c0996e8d2f4fe9bb3798b8acc4 (patch)
treec7a26ddd6d23e8fa16fdf98f7b620d6ec75f332f /usr/local/www/system_firmware_auto.php
parent8e51cc6a53d96f247c7195be030f529a4d1cea7d (diff)
downloadpfsense-0ba45a7917dea4c0996e8d2f4fe9bb3798b8acc4.zip
pfsense-0ba45a7917dea4c0996e8d2f4fe9bb3798b8acc4.tar.gz
Save update file on $g[upload_path] instead of /tmp
Diffstat (limited to 'usr/local/www/system_firmware_auto.php')
-rwxr-xr-xusr/local/www/system_firmware_auto.php26
1 files changed, 17 insertions, 9 deletions
diff --git a/usr/local/www/system_firmware_auto.php b/usr/local/www/system_firmware_auto.php
index 8a5cb42..cd36974 100755
--- a/usr/local/www/system_firmware_auto.php
+++ b/usr/local/www/system_firmware_auto.php
@@ -130,8 +130,10 @@ if($current_installed_pfsense_version <> $latest_version)
if($needs_system_upgrade == true) {
update_status("Downloading updates ...");
- $status = download_file_with_progress_bar("{$updater_url}/latest.tgz", "/tmp/latest.tgz", "read_body_firmware");
- $status = download_file_with_progress_bar("{$updater_url}/latest.tgz.sha256", "/tmp/latest.tgz.sha256");
+ conf_mount_rw();
+ $status = download_file_with_progress_bar("{$updater_url}/latest.tgz", "{$g['upload_path']}/latest.tgz", "read_body_firmware");
+ $status = download_file_with_progress_bar("{$updater_url}/latest.tgz.sha256", "{$g['upload_path']}/latest.tgz.sha256");
+ conf_mount_ro();
update_output_window("{$g['product_name']} download complete.");
}
@@ -144,15 +146,15 @@ else
$external_upgrade_helper_text .= "pfSenseupgrade ";
if($needs_system_upgrade == true)
- $external_upgrade_helper_text .= "/tmp/latest.tgz";
+ $external_upgrade_helper_text .= "{$g['upload_path']}/latest.tgz";
-$downloaded_latest_tgz_sha256 = str_replace("\n", "", `sha256 /tmp/latest.tgz | awk '{ print $4 }'`);
-$upgrade_latest_tgz_sha256 = str_replace("\n", "", `cat /tmp/latest.tgz.sha256 | awk '{ print $4 }'`);
+$downloaded_latest_tgz_sha256 = str_replace("\n", "", `sha256 {$g['upload_path']}/latest.tgz | awk '{ print $4 }'`);
+$upgrade_latest_tgz_sha256 = str_replace("\n", "", `cat {$g['upload_path']}/latest.tgz.sha256 | awk '{ print $4 }'`);
$sigchk = 0;
if(!isset($curcfg['alturl']['enable']))
- $sigchk = verify_digital_signature("/tmp/latest.tgz");
+ $sigchk = verify_digital_signature("{$g['upload_path']}/latest.tgz");
if ($sigchk == 1)
$sig_warning = "The digital signature on this image is invalid.";
@@ -161,11 +163,14 @@ else if ($sigchk == 2)
else if (($sigchk == 3) || ($sigchk == 4))
$sig_warning = "There has been an error verifying the signature on this image.";
-if (!verify_gzip_file("/tmp/latest.tgz")) {
+if (!verify_gzip_file("{$g['upload_path']}/latest.tgz")) {
update_status("The image file is corrupt.");
update_output_window("Update cannot continue");
- if (file_exists("{$g['upload_path']}/latest.tgz"))
+ if (file_exists("{$g['upload_path']}/latest.tgz")) {
+ conf_mount_rw();
unlink("{$g['upload_path']}/latest.tgz");
+ conf_mount_ro();
+ }
require("fend.inc");
exit;
}
@@ -173,8 +178,11 @@ if (!verify_gzip_file("/tmp/latest.tgz")) {
if ($sigchk) {
update_status($sig_warning);
update_output_window("Update cannot continue");
- if (file_exists("{$g['upload_path']}/latest.tgz"))
+ if (file_exists("{$g['upload_path']}/latest.tgz")) {
+ conf_mount_rw();
unlink("{$g['upload_path']}/latest.tgz");
+ conf_mount_ro();
+ }
require("fend.inc");
exit;
}
OpenPOWER on IntegriCloud