#!/usr/local/bin/php
System: Firmware: Auto Upgrade
300) { // Our cached data is stale, get a new copy. $versions = check_firmware_version($tocheck); } else { // Our cached data is relatively currently, remove the cachetime label. unset($versions['cachetime']); } } $static_output .= "done.\n"; update_output_window($static_output); foreach($categories as $index => $key) { $bdiff_errors = array(); if(is_array($versions[$key][0])) { // Make sure we really need to update this section. $didupdate = true; update_status("Found required " . $key . " updates. Downloading..."); $static_output .= "Downloading " . $key . " updates... "; update_output_window($static_output); foreach($versions[$key] as $ver) { // Begin system updates. foreach($update_types as $type) if(in_array($type, array_keys($ver))) $url_type = $type; $tofetch = "pfSense-" . ucfirst($url_type) . "-" . ucfirst($key) . "-Update-" . $ver['version'] . ".tgz"; $static_output_bak = $static_output; $static_output .= "\n\t" . $ver['version'] . "-" . $ver['name'] . " "; update_output_window($static_output); download_file_with_progress_bar("http://www.pfsense.com/updates/" . $tofetch, "/tmp/" . $tofetch); if($url_type == "binary") { exec("/etc/rc.firmware delta_update " . "/tmp/" . $tofetch, $bdiff_errors); if(is_string($bdiff_errors[0])) { unlink_if_exists("/tmp/" . $tofetch); $static_output .= "failed!\n"; update_output_window($static_output); break; } } else { $tofetch = "pfSense-" . ucfirst($url_type) . "-Update-" . $ver['version'] . ".tgz"; exec("/etc/rc.firmware pfSenseupgrade " . "/tmp/" . $tofetch); unlink_if_exists("/tmp/" . $tofetch); } $static_output = $static_output_bak . "done.\n"; } } } if($didupdate == true) { update_status("Update finished. Rebooting..."); exec("/etc/rc.reboot"); } else { update_status("No updates required."); } echo "\n"; ?>