summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2009-06-28 19:23:59 -0400
committerScott Ullrich <sullrich@pfsense.org>2009-06-28 19:23:59 -0400
commit45c710da422d9d89c3f86d1ab149b753c1def818 (patch)
treec3857121e75fe4f7e2367fbd68f84252a9e18fc5 /etc
parentf041d58b7eb9c3886831e4903069012621bb5fc3 (diff)
downloadpfsense-45c710da422d9d89c3f86d1ab149b753c1def818.zip
pfsense-45c710da422d9d89c3f86d1ab149b753c1def818.tar.gz
If anything goes wrong when updating fstab then abort the upgrade and file a notice.
Diffstat (limited to 'etc')
-rwxr-xr-xetc/rc.firmware31
1 files changed, 19 insertions, 12 deletions
diff --git a/etc/rc.firmware b/etc/rc.firmware
index 936325c..2706e51 100755
--- a/etc/rc.firmware
+++ b/etc/rc.firmware
@@ -210,8 +210,8 @@ pfSenseNanoBSDupgrade)
# Ensure that our new system is sound and bail if it is not and file a notice
echo "" >> /cf/upgrade_log.txt
- echo "/sbin/fsck_ffs -y /dev/$COMPLETE_PATH" >> /cf/upgrade_log.txt
- /sbin/fsck_ffs -y /dev/$COMPLETE_PATH >> /cf/upgrade_log.txt 2>&1
+ echo "/sbin/fsck_ffs -n /dev/$COMPLETE_PATH" >> /cf/upgrade_log.txt
+ /sbin/fsck_ffs -n /dev/$COMPLETE_PATH >> /cf/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 /var/run/firmware.lock
@@ -223,16 +223,6 @@ pfSenseNanoBSDupgrade)
echo "/sbin/tunefs -L ${GLABEL_SLICE} /dev/$COMPLETE_PATH" >> /cf/upgrade_log.txt
/sbin/tunefs -L ${GLABEL_SLICE} /dev/$COMPLETE_PATH >> /cf/upgrade_log.txt 2>&1
- # Set active mount slice in fdisk
- echo "" >> /cf/upgrade_log.txt
- echo "gpart set -a active -i ${SLICE} ${BOOT_DRIVE}" >> /cf/upgrade_log.txt
- gpart set -a active -i ${SLICE} ${BOOT_DRIVE}
-
- # Set active boot source
- echo "" >> /cf/upgrade_log.txt
- echo "/usr/sbin/boot0cfg -s ${SLICE} -v /dev/${BOOT_DRIVE}" >> /cf/upgrade_log.txt
- /usr/sbin/boot0cfg -s ${SLICE} -v /dev/${BOOT_DRIVE} >> /cf/upgrade_log.txt 2>&1
-
# restore config
cp -p /tmp/configbak/* /conf 2>/dev/null
@@ -251,12 +241,29 @@ pfSenseNanoBSDupgrade)
# Update fstab
sed -i "" "s/pfsense${OLD_UFS_ID}/pfsense${UFS_ID}/g" /tmp/$GLABEL_SLICE/etc/fstab
+ 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 /var/run/firmware.lock
+ umount /tmp/$GLABEL_SLICE
+ exit 1
+ fi
echo "" >> /cf/upgrade_log.txt
cat /tmp/$GLABEL_SLICE/etc/fstab >> /cf/upgrade_log.txt
# Unmount newly prepared slice
umount /tmp/$GLABEL_SLICE
+ # Set active mount slice in fdisk
+ echo "" >> /cf/upgrade_log.txt
+ echo "gpart set -a active -i ${SLICE} ${BOOT_DRIVE}" >> /cf/upgrade_log.txt
+ gpart set -a active -i ${SLICE} ${BOOT_DRIVE}
+
+ # Set active boot source
+ echo "" >> /cf/upgrade_log.txt
+ echo "/usr/sbin/boot0cfg -s ${SLICE} -v /dev/${BOOT_DRIVE}" >> /cf/upgrade_log.txt
+ /usr/sbin/boot0cfg -s ${SLICE} -v /dev/${BOOT_DRIVE} >> /cf/upgrade_log.txt 2>&1
+
# Remove extra stuff
rm -rf /etc/rc.conf
rm -rf /etc/motd
OpenPOWER on IntegriCloud