Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Apr 2024 16:57:38 GMT
From:      Fernando =?utf-8?Q?Apestegu=C3=ADa?= <fernape@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: d3b6d70e0dfa - main - freebsd-update(8): Use kern.module_path
Message-ID:  <202404191657.43JGvcSf017410@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by fernape:

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

commit d3b6d70e0dfaa4e9496bddcbc212d7d3ea392800
Author:     Fernando ApesteguĂ­a <fernape@FreeBSD.org>
AuthorDate: 2024-04-15 12:18:06 +0000
Commit:     Fernando ApesteguĂ­a <fernape@FreeBSD.org>
CommitDate: 2024-04-19 16:57:11 +0000

    freebsd-update(8): Use kern.module_path
    
    Instead of tailored configuration files to look for module_path entries.
    
    Reported by:            kevans@
    Reviewed by:            kevans, imp, zlei
    Approved by:            kevans,zlei
    Differential Revision:  https://reviews.freebsd.org/D44797
---
 usr.sbin/freebsd-update/freebsd-update.sh | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh
index d1cd46963a6c..9f5eaebfd64a 100644
--- a/usr.sbin/freebsd-update/freebsd-update.sh
+++ b/usr.sbin/freebsd-update/freebsd-update.sh
@@ -673,17 +673,13 @@ upgrade_check_kmod_ports() {
 	fi
 
 	# Most modules are in /boot/modules but we should actually look
-	# in every path configured in module_path
-	search_files="/boot/defaults/loader.conf /boot/loader.conf"
-	pattern=$(grep -shE '^module_path=' ${search_files} |
-		tail -1 |
-		cut -f2 -d\" |
-		tr ";" "|")
+	# in every module_path passed to the kernel:
+	pattern=$(sysctl -n kern.module_path | tr ";" "|")
 
 	if [ -z "${pattern}" ]; then
-		# Not having module_path in loader.conf is probably an error.
-		# Check at least the most common path
-		pattern="/boot/modules"
+		echo "Empty kern.module_path sysctl. This should not happen."
+		echo "Aborting check of kernel modules installed from ports."
+		return
 	fi
 
 	# Check the pkg database for modules installed in those directories



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202404191657.43JGvcSf017410>