summaryrefslogtreecommitdiffstats
path: root/usr/local/www/system_firmware_auto.php
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-03-19 15:34:56 +0000
committerErmal <eri@pfsense.org>2010-03-19 15:34:56 +0000
commit773c99bc37c742cc94a1894914c5ba4a7b5abdd7 (patch)
tree162bb355b699de6caef49167c93eb26d6ae7bb80 /usr/local/www/system_firmware_auto.php
parentf3b000b2d10cf2010563b28b8107706178e64081 (diff)
downloadpfsense-773c99bc37c742cc94a1894914c5ba4a7b5abdd7.zip
pfsense-773c99bc37c742cc94a1894914c5ba4a7b5abdd7.tar.gz
Fix auto update checking and showing always there is an update available.
Diffstat (limited to 'usr/local/www/system_firmware_auto.php')
-rwxr-xr-xusr/local/www/system_firmware_auto.php49
1 files changed, 32 insertions, 17 deletions
diff --git a/usr/local/www/system_firmware_auto.php b/usr/local/www/system_firmware_auto.php
index dca454b..a777d18 100755
--- a/usr/local/www/system_firmware_auto.php
+++ b/usr/local/www/system_firmware_auto.php
@@ -123,21 +123,36 @@ include("head.inc");
<?php
update_status("Downloading current version information...");
-$latest_version = download_file_with_progress_bar("{$updater_url}/version", "/tmp/{$g['product_name']}_version");
-
-$current_installed_pfsense_version = str_replace("\n", "", file_get_contents("/etc/version"));
-$latest_version = str_replace("\n", "", file_get_contents("/tmp/{$g['product_name']}_version"));
-
-if($current_installed_pfsense_version <> $latest_version)
- $needs_system_upgrade = true;
-
-if($needs_system_upgrade == true) {
- update_status("Downloading updates ...");
- 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.");
+download_file_with_progress_bar("{$updater_url}/version", "/tmp/{$g['product_name']}_version");
+$latest_version = str_replace("\n", "", @file_get_contents("/tmp/{$g['product_name']}_version"));
+if(!$latest_version) {
+ update_output_window("Unable to check for updates.");
+ 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"));
+ $latest_version_pfsense = strtotime($latest_version);
+ if(!$latest_version) {
+ update_output_window("Unable to check for updates.");
+ require("fend.inc");
+ exit;
+ } else {
+ $needs_system_upgrade = false;
+ if($current_installed_pfsense_version < $latest_version_pfsense) {
+ update_status("Downloading updates ...");
+ 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.");
+ } else {
+ update_output_window("You are on the latest version.");
+ require("fend.inc");
+ exit;
+ }
+ }
}
/* launch external upgrade helper */
@@ -214,8 +229,8 @@ function read_body_firmware($ch, $string) {
$c = $downloadProgress;
$text = " Auto Update Download Status\\n";
$text .= "----------------------------------------------------\\n";
- $text .= " Latest Version : {$latest_version}\\n";
$text .= " Current Version : {$current_installed_pfsense_version}\\n";
+ $text .= " Latest Version : {$latest_version}\\n";
$text .= " File size : {$a}\\n";
$text .= " Downloaded : {$b}\\n";
$text .= " Percent : {$c}%\\n";
@@ -230,4 +245,4 @@ function read_body_firmware($ch, $string) {
return $length;
}
-?> \ No newline at end of file
+?>
OpenPOWER on IntegriCloud