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

From: Warner Losh <imp_at_FreeBSD.org>
Date: Thu, 10 Feb 2022 19:44:02 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=cb51e2bc3db7e266c26d8165243605f0be771e56

commit cb51e2bc3db7e266c26d8165243605f0be771e56
Author:     Jose Luis Duran <jlduran@gmail.com>
AuthorDate: 2022-02-10 19:42:36 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-02-10 19:43:19 +0000

    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 40adda8665bb, and partially fixed in
    1ce07411fae8.
    
    Differential Revision: https://reviews.freebsd.org/D34166
---
 libexec/rc/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libexec/rc/rc b/libexec/rc/rc
index f117125d2d82..f021251bbd81 100644
--- a/libexec/rc/rc
+++ b/libexec/rc/rc
@@ -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