Mount RW so we can write to logs. Duh. Mount RO if we exit out of an upgrade.

This commit is contained in:
Scott Ullrich 2009-06-29 16:45:24 -04:00
parent 507960cb93
commit bc43f0eead

View File

@ -122,9 +122,13 @@ auto)
;;
pfSenseNanoBSDupgrade)
# mount /cf
/etc/rc.conf_mount_rw
# Sanity check - bail early if there's no firmware file!
if [ ! -r $IMG ]; then
echo "2nd parameter has not been passed or file does not exist. Exiting." >> /cf/upgrade_log.txt 2>&1
/etc/rc.conf_mount_ro
exit 1
fi
@ -132,6 +136,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."
/etc/rc.conf_mount_ro
exit 1
fi
@ -140,9 +145,6 @@ pfSenseNanoBSDupgrade)
echo "Firmware upgrade in progress..." >> /cf/upgrade_log.txt 2>&1
echo "Firmware upgrade in progress..." | wall
# mount /cf
/etc/rc.conf_mount_rw
# backup config
/bin/mkdir -p /tmp/configbak
cp -p /conf/* /tmp/configbak 2>/dev/null
@ -215,6 +217,7 @@ pfSenseNanoBSDupgrade)
if [ $? != 0 ]; then
file_notice "UpgradeFailure" "{\$g['product_name']} upgrade has failed. Your system has been left in a usable state."
rm /var/run/firmware.lock
/etc/rc.conf_mount_ro
exit 1
fi
@ -247,6 +250,7 @@ pfSenseNanoBSDupgrade)
file_notice "UpgradeFailure" "Something went wrong when trying to update the fstab entry. Aborting upgrade."
rm /var/run/firmware.lock
umount /tmp/$GLABEL_SLICE
/etc/rc.conf_mount_ro
exit 1
fi
echo "" >> /cf/upgrade_log.txt