When bdiff is detected in the filename, invoke the binary update

routines.
This commit is contained in:
Scott Ullrich 2008-02-17 00:03:27 +00:00
parent ca7a3a5c75
commit e1aea2cda0
2 changed files with 15 additions and 5 deletions

View File

@ -88,8 +88,10 @@ switch ($command) {
echo "\nMD5 checksum matches.\n";
exec("rm -f /root/*.md5");
}
if(stristr($url,"bdiff"))
$type = "bdiff";
if(file_exists("/root/firmware.tgz"))
do_upgrade("/root/firmware.tgz");
do_upgrade("/root/firmware.tgz", $type);
} else {
echo "\nCould not download update.\n\n";
fclose($fp);
@ -102,9 +104,11 @@ switch ($command) {
fclose($fp);
die;
}
if(stristr($fp,"bdiff"))
$type = "bdiff";
if(file_exists($path)) {
touch($d_fwupenabled_path);
do_upgrade($path);
do_upgrade($path, $type);
} else {
echo "\nCould not find file.\n\n";
fclose($fp);
@ -148,11 +152,14 @@ function check_for_kernel_file() {
}
}
function do_upgrade($path) {
function do_upgrade($path, $type) {
global $fp;
check_for_kernel_file();
echo "\nOne moment please... Invoking firmware upgrade...\n";
exec("/etc/rc.firmware pfSenseupgrade $path");
if($type == "bdiff")
exec("/etc/rc.firmware delta_update $path");
else
exec("/etc/rc.firmware pfSenseupgrade $path");
unlink_if_exists($path);
die;
}

View File

@ -119,7 +119,10 @@ if ($_POST && !file_exists($d_firmwarelock_path)) {
/* fire up the update script in the background */
touch($d_firmwarelock_path);
$savemsg = "The firmware is now being updated. The firewall will reboot automatically.";
mwexec_bg("/etc/rc.firmware pfSenseupgrade {$g['upload_path']}/firmware.tgz");
if(stristr($_FILES['ulfile']['tmp_name'],"bdiff"))
mwexec_bg("/etc/rc.firmware delta_update {$g['upload_path']}/firmware.tgz");
else
mwexec_bg("/etc/rc.firmware pfSenseupgrade {$g['upload_path']}/firmware.tgz");
} else {
$savemsg = "Firmware image missing or other error, please try again.";
}