Index: usr.sbin/freebsd-update/freebsd-update.sh =================================================================== --- usr.sbin/freebsd-update/freebsd-update.sh +++ usr.sbin/freebsd-update/freebsd-update.sh @@ -2628,6 +2628,37 @@ echo "To install the downloaded upgrades, run \"$0 install\"." } +# Perform system sanity checks to ensure +# the file system can be modified as expected +install_verify_system () { + _IS_RW="*[[:space:]]rw[[:space:]]*" + _IS_NFS="*[[:space:]]nfs[[:space:]]*" + # Verify the file system is not NFS otherwise chflags will not work, + # then verify that there are read-write permissions + # on required directories + for required_dir in / /usr /boot; do + mounted_dir=`df -T ${BASEDIR}/${required_dir} | + sed -E 's,[[:blank:]]+, ,g' | + cut -d' ' -f7` + case `mount -p ${mounted_dir}` in + $_IS_NFS) + echo -n "${BASEDIR}/${required_dir} " + echo -n "is on NFS (${mounted_dir}) " + echo "so chflags will not be supported." + echo "Update the source filesystem and then export it." + ;; + $_IS_RW) + ;; + *) + echo -n "${BASEDIR}/${required_dir} " + echo -n "is not on a file system (${mounted_dir}) mounted " + echo "with read-write permissions." + return 1 + ;; + esac + done +} + # Make sure that all the file hashes mentioned in $@ have corresponding # gzipped files stored in /files/. install_verify () { @@ -2978,6 +3009,8 @@ # Actually install updates install_run () { echo -n "Installing updates..." + # Make sure the system is configured correctly + install_verify_system || return 1 # Make sure we have all the files we should have install_verify ${BDHASH}-install/INDEX-OLD \ @@ -3069,6 +3102,9 @@ rm ${BDHASH}-install fi + # Make sure the system is configured correctly + install_verify_system || return 1 + # Make sure we have all the files we should have install_verify ${BDHASH}-rollback/INDEX-NEW \ ${BDHASH}-rollback/INDEX-OLD || return 1