=gettext("Beginning firmware upgrade")?>
= 3)) {
$sig_warning = gettext("There has been an error verifying the signature on this image.");
$exitstatus = 1;
}
if ($exitstatus) {
panel_heading_text($sig_warning);
panel_heading_class('danger');
update_output_window(gettext("Update cannot continue. You can disable this check on the Updater Settings tab."));
require("foot.inc");
exit;
} else if ($sigchk == 2) {
panel_heading_text(gettext('Upgrade in progress...'));
panel_heading_class('info');
update_output_window("\n" . gettext("Upgrade Image does not contain a signature but the system has been configured to allow unsigned images. One moment please...") . "\n");
}
if (!verify_gzip_file("{$g['upload_path']}/latest.tgz")) {
panel_heading_text(gettext("The image file is corrupt."));
panel_heading_class('danger');
update_output_window(gettext("Update cannot continue"));
if (file_exists("{$g['upload_path']}/latest.tgz")) {
conf_mount_rw();
unlink("{$g['upload_path']}/latest.tgz");
conf_mount_ro();
}
require("foot.inc");
exit;
}
if($downloaded_latest_tgz_sha256 <> $upgrade_latest_tgz_sha256) {
panel_heading_text(gettext("Downloading complete but sha256 does not match."));
panel_heading_class('danger');
update_output_window(gettext("Auto upgrade aborted.") . " \n\n" . gettext("Downloaded SHA256") . ": " . $downloaded_latest_tgz_sha256 . "\n\n" . gettext("Needed SHA256") . ": " . $upgrade_latest_tgz_sha256);
} else {
update_output_window($g['product_name'] . " " . gettext("is now upgrading.") . "\\n\\n" . gettext("The firewall will reboot once the operation is completed."));
mwexec_bg($external_upgrade_helper_text);
}
/*
Helper functions
*/
function read_body_firmware($ch, $string) {
global $g, $fout, $file_size, $downloaded, $counter, $version, $latest_version;
$length = strlen($string);
$downloaded += intval($length);
$downloadProgress = round(100 * (1 - $downloaded / $file_size), 0);
$downloadProgress = 100 - $downloadProgress;
$a = $file_size;
$b = $downloaded;
$c = $downloadProgress;
$text = " " . gettext("Auto Update Download Status") . "\\n";
$text .= "----------------------------------------------------\\n";
$text .= " " . gettext("Current Version") . " : {$g['product_version']}\\n";
$text .= " " . gettext("Latest Version") . " : {$latest_version}\\n";
$text .= " " . gettext("File size") . " : {$a}\\n";
$text .= " " . gettext("Downloaded") . " : {$b}\\n";
$text .= " " . gettext("Percent") . " : {$c}%\\n";
$text .= "----------------------------------------------------\\n";
$counter++;
if ($counter > 150) {
update_output_window($text);
update_progress_bar($downloadProgress);
$counter = 0;
}
fwrite($fout, $string);
return $length;
}
// Update the text in the panel-heading
function panel_heading_text($text) {
?>