git: 4ace066a9085 - stable/13 - nanobsd: Fix cust_comconsole search patterns

From: Jose Luis Duran <jlduran_at_FreeBSD.org>
Date: Mon, 16 Dec 2024 15:15:25 UTC
The branch stable/13 has been updated by jlduran:

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

commit 4ace066a9085e8b0e9febf7850b3c51cd9533f7a
Author:     Jose Luis Duran <jlduran@FreeBSD.org>
AuthorDate: 2024-11-15 04:28:01 +0000
Commit:     Jose Luis Duran <jlduran@FreeBSD.org>
CommitDate: 2024-12-16 15:13:51 +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
    
    (cherry picked from commit 0f7b0db5dd07e7c48285db4cac19e15fc9a42622)
---
 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 69e89958b02b..8ef9cc0a6066 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