rc: Allow the removal of firstboot_sentinel on read-only file systems

NanoBSD or, more generally, systems with root_rw_mount="NO" are not able
to remove the firstboot_sentinel file, typically /firstboot, because the
logic in /etc/rc is currently inverted.

When checkyesno root_rw_mount tests on a read-only file system, the
return is 1, hence avoiding the option to mount the system read-write.

Restore the ability to remove the firstboot_sentinel file on read-only
mounted file systems.

This change was introduced in 40adda8665, and partially fixed in
1ce07411fa.

Differential Revision: https://reviews.freebsd.org/D34166
This commit is contained in:
Jose Luis Duran 2022-02-10 12:42:36 -07:00 committed by Warner Losh
parent c96f70e7ac
commit cb51e2bc3d

View File

@ -137,7 +137,7 @@ done
# 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
checkyesno root_rw_mount && mount -uw /
checkyesno root_rw_mount || mount -uw /
chflags -R 0 ${firstboot_sentinel}
rm -rf ${firstboot_sentinel}
if [ -e ${firstboot_sentinel}-reboot ]; then