git: 0f7b0db5dd07 - main - nanobsd: Fix cust_comconsole search patterns

From: Jose Luis Duran <jlduran_at_FreeBSD.org>
Date: Sat, 16 Nov 2024 07:23:49 UTC
The branch main has been updated by jlduran:

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

commit 0f7b0db5dd07e7c48285db4cac19e15fc9a42622
Author:     Jose Luis Duran <jlduran@FreeBSD.org>
AuthorDate: 2024-11-15 04:28:01 +0000
Commit:     Jose Luis Duran <jlduran@FreeBSD.org>
CommitDate: 2024-11-16 07:08:24 +0000

    nanobsd: Fix cust_comconsole search patterns
    
    The current patterns are outdated, and may produce "offifexists", after
    e310437971b8 ("For video consoles, only launch a getty if the device
    exists.").
    
    Fix the expressions to:
    
    1. Disable getty(8) on the virtual syscons(4) or vt(4) terminals
       (/dev/ttyv*).
    2. Enable the use of the first serial port as the system console.
    
    Reviewed by:    imp
    Approved by:    emaste (mentor)
    MFC after:      1 month
    Differential Revision:  https://reviews.freebsd.org/D47586
---
 tools/tools/nanobsd/defaults.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh
index 1e38a07337c7..5cb137a1db94 100755
--- a/tools/tools/nanobsd/defaults.sh
+++ b/tools/tools/nanobsd/defaults.sh
@@ -742,10 +742,10 @@ UsbDevice ( ) {
 
 cust_comconsole ( ) (
 	# Enable getty on console
-	sed -i "" -e /tty[du]0/s/off/on/ ${NANO_WORLDDIR}/etc/ttys
+	sed -i "" -e '/^tty[du]0/s/off/onifconsole/' ${NANO_WORLDDIR}/etc/ttys
 
-	# Disable getty on syscons devices
-	sed -i "" -e '/^ttyv[0-8]/s/	on/	off/' ${NANO_WORLDDIR}/etc/ttys
+	# Disable getty on syscons or vt devices
+	sed -i "" -E '/^ttyv[0-8]/s/\ton(ifexists)?/\toff/' ${NANO_WORLDDIR}/etc/ttys
 
 	# Tell loader to use serial console early.
 	echo "${NANO_BOOT2CFG}" > ${NANO_WORLDDIR}/boot.config