diff options
author | jim-p <jimp@pfsense.org> | 2010-05-18 12:53:28 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2010-05-18 12:54:07 -0400 |
commit | 4e6593de5a18b785565a4bcd454f2d3e31d2518c (patch) | |
tree | 5860100dd41b74695e60160ebf9d7d8891673aea /usr/local | |
parent | c1191d5bd854ae9334e5373ca5d0d193067c3b7d (diff) | |
download | pfsense-4e6593de5a18b785565a4bcd454f2d3e31d2518c.zip pfsense-4e6593de5a18b785565a4bcd454f2d3e31d2518c.tar.gz |
Unbreak automatic updates.
Diffstat (limited to 'usr/local')
-rwxr-xr-x | usr/local/www/system_firmware_auto.php | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/usr/local/www/system_firmware_auto.php b/usr/local/www/system_firmware_auto.php index 57e1bf6..d5b7cd5 100755 --- a/usr/local/www/system_firmware_auto.php +++ b/usr/local/www/system_firmware_auto.php @@ -43,6 +43,7 @@ ##|-PRIV require("guiconfig.inc"); +require_once("pfsense-utils.inc"); $curcfg = $config['system']['firmware']; @@ -130,17 +131,16 @@ if(!$latest_version) { require("fend.inc"); exit; } else { - $current_installed_pfsense_version = str_replace("\n", "", @file_get_contents("/etc/version.buildtime")); - $current_installed_pfsense = strtotime($current_installed_pfsense_version); - $latest_version = str_replace("\n", "", @file_get_contents("/tmp/{$g['product_name']}_version")); + $current_installed_buildtime = trim(file_get_contents("/etc/version.buildtime")); + $current_installed_version = trim(file_get_contents("/etc/version")); + $latest_version = trim(@file_get_contents("/tmp/{$g['product_name']}_version")); $latest_version_pfsense = strtotime($latest_version); if(!$latest_version) { update_output_window(gettext("Unable to check for updates.")); require("fend.inc"); exit; } else { - $needs_system_upgrade = false; - if($current_installed_pfsense_version < $latest_version_pfsense) { + if (pfs_version_compare($current_installed_buildtime, $current_installed_version, $latest_version) == -1) { update_status(gettext("Downloading updates") . "..."); conf_mount_rw(); $status = download_file_with_progress_bar("{$updater_url}/latest.tgz", "{$g['upload_path']}/latest.tgz", "read_body_firmware"); @@ -163,8 +163,7 @@ if($g['platform'] == "nanobsd") else $external_upgrade_helper_text .= "pfSenseupgrade "; -if($needs_system_upgrade == true) - $external_upgrade_helper_text .= "{$g['upload_path']}/latest.tgz"; +$external_upgrade_helper_text .= "{$g['upload_path']}/latest.tgz"; $downloaded_latest_tgz_sha256 = str_replace("\n", "", `/sbin/sha256 -q {$g['upload_path']}/latest.tgz`); $upgrade_latest_tgz_sha256 = str_replace("\n", "", `/bin/cat {$g['upload_path']}/latest.tgz.sha256 | awk '{ print $4 }'`); @@ -221,7 +220,7 @@ if($downloaded_latest_tgz_sha256 <> $upgrade_latest_tgz_sha256) { */ function read_body_firmware($ch, $string) { - global $fout, $file_size, $downloaded, $counter, $version, $latest_version, $current_installed_pfsense_version; + global $fout, $file_size, $downloaded, $counter, $version, $latest_version, $current_installed_version; $length = strlen($string); $downloaded += intval($length); $downloadProgress = round(100 * (1 - $downloaded / $file_size), 0); @@ -231,7 +230,7 @@ function read_body_firmware($ch, $string) { $c = $downloadProgress; $text = " " . gettext("Auto Update Download Status") . "\\n"; $text .= "----------------------------------------------------\\n"; - $text .= " " . gettext("Current Version") . " : {$current_installed_pfsense_version}\\n"; + $text .= " " . gettext("Current Version") . " : {$current_installed_version}\\n"; $text .= " " . gettext("Latest Version") . " : {$latest_version}\\n"; $text .= " " . gettext("File size") . " : {$a}\\n"; $text .= " " . gettext("Downloaded") . " : {$b}\\n"; |