svn commit: r293240 - head/etc
Warner Losh
imp at FreeBSD.org
Wed Jan 6 17:13:41 UTC 2016
Author: imp
Date: Wed Jan 6 17:13:40 2016
New Revision: 293240
URL: https://svnweb.freebsd.org/changeset/base/293240
Log:
Try a little harder to remove firstboot and firstboot-reboot files in
case they accidentally get created as directories or with flags that
prevent their removal. While I wouldn't normally go the extra mile
here and let the normal unix rules prevail, the effects of failure are
large enough that extra care is warranted.
Modified:
head/etc/rc
Modified: head/etc/rc
==============================================================================
--- head/etc/rc Wed Jan 6 16:35:30 2016 (r293239)
+++ head/etc/rc Wed Jan 6 17:13:40 2016 (r293240)
@@ -130,11 +130,17 @@ for _rc_elem in ${files}; do
done
# Remove the firstboot sentinel, and reboot if it was requested.
+# Be a bit paranoid about removing it to handle the common failure
+# modes since the consequence of failure can be big.
+# Note: this assumes firstboot_sentinel is on / when we have
+# a read-only /, or that it is on media that's writable.
if [ -e ${firstboot_sentinel} ]; then
[ ${root_rw_mount} = "yes" ] || mount -uw /
- /bin/rm -f ${firstboot_sentinel}
+ chflags -R 0 ${firstboot_sentinel}
+ rm -rf ${firstboot_sentinel}
if [ -e ${firstboot_sentinel}-reboot ]; then
- /bin/rm -f ${firstboot_sentinel}-reboot
+ chflags -R 0 ${firstboot_sentinel}-reboot
+ rm -rf ${firstboot_sentinel}-reboot
[ ${root_rw_mount} = "yes" ] || mount -ur /
kill -INT 1
fi
More information about the svn-src-all
mailing list