mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Add a seatbelt check to ensure the on disk partition is the same size (or larger) and bail if it has any issues.
This commit is contained in:
parent
34c7f02eb1
commit
b90885ff96
@ -193,6 +193,18 @@ pfSenseNanoBSDupgrade)
|
||||
echo "COMPLETE_PATH $COMPLETE_PATH" >> /conf/upgrade_log.txt
|
||||
echo "GLABEL_SLICE $GLABEL_SLICE" >> /conf/upgrade_log.txt
|
||||
|
||||
# First ensure the new file can fit inside the
|
||||
# slice that we are going to be operating on.
|
||||
NEW_IMG_SIZE=`echo $((\`gzip -l ${IMG} | grep -v compressed | awk '{ print $2}'\` / 1024 / 1024))`
|
||||
SIZE=`/sbin/fdisk ${COMPLETE_PATH} | /usr/bin/grep Meg | /usr/bin/awk '{ print $5 }' | /usr/bin/cut -d"(" -f2`
|
||||
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."
|
||||
echo "Upgrade failed. Please check the system log file for more information" | wall
|
||||
rm /var/run/firmwarelock.dirty
|
||||
/etc/rc.conf_mount_ro
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Output environment information to log file
|
||||
output_env_to_log
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user