diff options
-rwxr-xr-x | usr/local/www/system_firmware_auto.php | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/usr/local/www/system_firmware_auto.php b/usr/local/www/system_firmware_auto.php index d35860a..4868631 100755 --- a/usr/local/www/system_firmware_auto.php +++ b/usr/local/www/system_firmware_auto.php @@ -123,8 +123,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"); - $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"); + $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."); } @@ -137,15 +139,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."; @@ -154,10 +156,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"); - unlink("{$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; } @@ -165,7 +171,11 @@ if (!verify_gzip_file("/tmp/latest.tgz")) { if ($sigchk) { update_status($sig_warning); update_output_window("Update cannot continue"); - unlink("{$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; } @@ -247,4 +257,4 @@ function read_body($ch, $string) { return $length; } -?>
\ No newline at end of file +?> |