Skip to content

Commit

Permalink
Remove bdiff support
Browse files Browse the repository at this point in the history
  • Loading branch information
rbgarga committed Jul 30, 2015
1 parent 488b975 commit 687631c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 71 deletions.
59 changes: 0 additions & 59 deletions etc/rc.firmware
Original file line number Diff line number Diff line change
Expand Up @@ -78,46 +78,6 @@ remove_chflags() {
done
}

binary_update() {
TGZ=$1
ERR_F="/tmp/bdiff.log"
rm ${ERR_F} 2>/dev/null
/bin/mkdir /tmp/patched /tmp/patches 2>>${ERR_F}
# Save the old shutdown binary. If we switch from i386 to amd64 (or back) the reboot binary won't run at the end since it doesn't match up.
/bin/cp -p /sbin/shutdown /sbin/shutdown.old
backup_chflags
remove_chflags
cd /tmp/patches
for i in `/usr/bin/tar tvzf $TGZ | egrep -v "(^d|_md5)" | nawk '{print $9;}'`;
do
FILE=`basename ${i}`
echo "Working on ${i}"
# Untar patch file and md5 files
/usr/bin/tar xzf ${TGZ} ${i} ${i}.old_file_md5 ${i}.new_patch_md5 ${i}.new_file_md5 2>>${ERR_F}

# Apply patch - oldfile newfile patchfile
/usr/local/bin/bspatch /${i} /tmp/patched/${FILE} /tmp/patches/${i} 2>>${ERR_F}

OLD_FILE_MD5=`cat /tmp/patches/${i}.old_file_md5 2>/dev/null`
NEW_PATCH_MD5=`cat /tmp/patches/${i}.new_patch_md5 2>/dev/null`
NEW_FILE_MD5=`cat /tmp/patches/${i}.new_file_md5 2>/dev/null`
PATCHED_MD5=`/sbin/md5 -q /tmp/patched/${FILE} 2>/dev/null`

if [ "$PATCHED_MD5" = "$NEW_PATCH_MD5" ]; then
/usr/bin/install -S /tmp/patched/${FILE} /${i}
else
#echo "${i} file does not match intended final md5."
echo "${i} file does not match intended final md5." >> ${ERR_F}
fi

/bin/rm /tmp/patched/${FILE} >> ${ERR_F}
/bin/rm /tmp/patches/${i} >> ${ERR_F}
/bin/rm /tmp/patches/${i}.* >> ${ERR_F}
done
/bin/rm -rf /tmp/patched /tmp/patches >> ${ERR_F}
restore_chflags
}

case $ACTION in
enable)
touch /conf/upgrade_log.txt
Expand Down Expand Up @@ -515,25 +475,6 @@ pfSenseupgrade)
. /etc/rc.reboot
fi

;;
delta_update)
touch /var/run/firmwarelock.dirty
backup_chflags
remove_chflags
binary_update $IMG
restore_chflags
rm -rf /etc/rc.conf
find / -name CVS -type d -exec rm {} \;
rm -rf /usr/savecore/*
/etc/rc.conf_mount_ro
/sbin/umount -f /cf 2>/dev/null
/sbin/mount -r /cf 2>/dev/null
/sbin/umount -f / 2>/dev/null
/sbin/mount -r / 2>/dev/null
if [ -e /etc/init_bootloader.sh ]; then
sh /etc/init_bootloader.sh
fi

;;
esac

12 changes: 2 additions & 10 deletions etc/rc.initial.firmware_update
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,7 @@ switch ($command) {
echo "\nsha256 checksum matches.\n";
unlink_if_exists("/root/firmware.tgz.sha256");
}
if (strstr($url, "bdiff")) {
echo "Binary DIFF upgrade file detected...\n";
$type = "bdiff";
} elseif (strstr($url, "nanobsd")) {
if (strstr($url, "nanobsd")) {
echo "NanoBSD upgrade file detected...\n";
$type = "nanobsd";
} else {
Expand All @@ -129,9 +126,6 @@ switch ($command) {
fclose($fp);
die;
}
if (stristr($path, "bdiff")) {
$type = "bdiff";
}
if (stristr($path, "nanobsd")) {
$type = "nanobsd";
}
Expand Down Expand Up @@ -175,9 +169,7 @@ function do_upgrade($path, $type) {
}
mark_subsystem_dirty('firmwarelock');
echo "\nOne moment please...\nInvoking firmware upgrade...";
if ($type == "bdiff") {
mwexec_bg("/etc/rc.firmware delta_update $path");
} elseif ($type == "nanobsd") {
if ($type == "nanobsd") {
mwexec_bg("/etc/rc.firmware pfSenseNanoBSDupgrade $path");
} else {
mwexec_bg("/etc/rc.firmware pfSenseupgrade $path");
Expand Down
2 changes: 0 additions & 2 deletions usr/local/www/system_firmware.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ function file_upload_error_message($error_code) {
$savemsg = gettext("The firmware is now being updated. The firewall will reboot automatically.");
if (stristr($_FILES['ulfile']['name'], "nanobsd") or $_POST['isnano'] == "yes") {
mwexec_bg("/etc/rc.firmware pfSenseNanoBSDupgrade {$g['upload_path']}/firmware.tgz");
} else if (stristr($_FILES['ulfile']['name'], "bdiff")) {
mwexec_bg("/etc/rc.firmware delta_update {$g['upload_path']}/firmware.tgz");
} else {
if ($g['platform'] == "nanobsd") {
$whichone = "pfSenseNanoBSDupgrade";
Expand Down

0 comments on commit 687631c

Please sign in to comment.