diff options
author | imp <imp@FreeBSD.org> | 2016-01-06 17:13:40 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2016-01-06 17:13:40 +0000 |
commit | 76cb3b35021b722f3e8330ec6ac0df444fdcc651 (patch) | |
tree | f791ad9573513eb26af99aa2eea9a39e58069e7a /etc | |
parent | fce5b67dc0d23e9c9a49c4d50ef0c66467f584e4 (diff) | |
download | FreeBSD-src-76cb3b35021b722f3e8330ec6ac0df444fdcc651.zip FreeBSD-src-76cb3b35021b722f3e8330ec6ac0df444fdcc651.tar.gz |
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.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/rc | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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 |