git: 17aec740b0b2 - main - devmatch: do nothing if booted in safe mode

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Sat, 14 Dec 2024 04:31:59 UTC
The branch main has been updated by kevans:

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

commit 17aec740b0b2112eb1803ca6d5ec8c8161f8dcae
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2024-12-14 04:31:22 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2024-12-14 04:31:38 +0000

    devmatch: do nothing if booted in safe mode
    
    Safe mode may be enabled because of some problem discovered with a kmod,
    thus wanting to avoid devmatch.  Honor it and let the user deal with
    the fallout of not autoloading modules.  We've at least made it to
    userland and the user demonstrably has a local console as they selected
    safe mode in the first place, so this shouldn't be fatal if we don't,
    e.g., load a necessary NIC driver.
---
 libexec/rc/rc.d/devmatch | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libexec/rc/rc.d/devmatch b/libexec/rc/rc.d/devmatch
index 0999159bb332..7a8726de5677 100755
--- a/libexec/rc/rc.d/devmatch
+++ b/libexec/rc/rc.d/devmatch
@@ -41,7 +41,10 @@ one_nomatch="$2"
 
 devmatch_start()
 {
-	local x m list
+	local x m list boot_safe
+
+	boot_safe=$(kenv -q boot_safe || echo "NO")
+	checkyesno boot_safe && return
 
 	if [ -n "$one_nomatch" ]; then
 		list=$(devmatch -p "${one_nomatch}" | sort -u)