From a66393ce8291c36437d84d3e075789a5423e6e68 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Tue, 13 Oct 2009 15:17:04 -0400 Subject: Remove upgrade IMG file after failure --- etc/rc.firmware | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/etc/rc.firmware b/etc/rc.firmware index 59c3182..5d46a7f 100755 --- a/etc/rc.firmware +++ b/etc/rc.firmware @@ -143,6 +143,7 @@ pfSenseNanoBSDupgrade) if [ `echo $IMG | grep "full"` ]; then echo "You cannot use a full file for upgrade. Please use a file labeled upgrade." file_notice "NanoBSDUpgradeFailure" "You have attemped to use a full NanoBSD installation file as an upgrade. Please use a NanoBSD file labeled 'upgrade' instead." + rm -f $IMG /etc/rc.conf_mount_ro exit 1 fi @@ -200,6 +201,7 @@ pfSenseNanoBSDupgrade) SIZE=`expr $SIZE + 1` if [ "$SIZE" -lt "$NEW_IMG_SIZE" ]; then file_notice "UpgradeFailure" "Upgrade failed due to the upgrade image being larger than the partition that is configured on disk. Halting. Size on disk: $SIZE < Size of new image: $NEW_IMG_SIZE" + rm -f $IMG rm -f /var/run/firmwarelock.dirty rm -f /var/run/firmware.lock /etc/rc.conf_mount_ro @@ -260,8 +262,9 @@ pfSenseNanoBSDupgrade) /sbin/fsck_ufs -y /dev/$COMPLETE_PATH >> /conf/upgrade_log.txt 2>&1 if [ $? != 0 ]; then file_notice "UpgradeFailure" "{\$g['product_name']} upgrade has failed. Your system has been left in a usable state." + rm -f $IMG rm -f /var/run/firmwarelock.dirty - rm -f /var/run/firmware.lock + rm -f /var/run/firmware.lock /etc/rc.conf_mount_ro exit 1 fi @@ -296,6 +299,7 @@ pfSenseNanoBSDupgrade) if [ $? != 0 ]; then echo "Something went wrong when trying to update the fstab entry. Aborting upgrade." file_notice "UpgradeFailure" "Something went wrong when trying to update the fstab entry. Aborting upgrade." + rm -f $IMG rm -f /var/run/firmwarelock.dirty rm -f /var/run/firmware.lock umount /tmp/$GLABEL_SLICE -- cgit v1.1