git: 5467020a540d - main - rc.conf: Use user.localbase to determine _localbase
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 10 Aug 2025 15:37:13 UTC
The branch main has been updated by ivy:
URL: https://cgit.FreeBSD.org/src/commit/?id=5467020a540d92a39dcabc149a264f3c0d0c084c
commit 5467020a540d92a39dcabc149a264f3c0d0c084c
Author: Lexi Winter <ivy@FreeBSD.org>
AuthorDate: 2025-08-10 12:24:03 +0000
Commit: Lexi Winter <ivy@FreeBSD.org>
CommitDate: 2025-08-10 15:36:39 +0000
rc.conf: Use user.localbase to determine _localbase
When running an rc.d script outside of boot, ${_localbase} isn't set,
and rc.conf hardcodes the default value to /usr/local. Instead, try
to get the localbase from the user.localbase sysctl, and only fall
back to /usr/local if we can't for some reason.
This fixes e.g. /etc/rc.d/ldconfig when localbase has a non-default
value.
Reviewed by: imp, des
Differential Revision: https://reviews.freebsd.org/D51852
---
libexec/rc/rc.conf | 1 +
1 file changed, 1 insertion(+)
diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf
index d502361eca37..bfa46bd343a6 100644
--- a/libexec/rc/rc.conf
+++ b/libexec/rc/rc.conf
@@ -21,6 +21,7 @@
##############################################################
# Set default value of _localbase if not previously set
+: ${_localbase:="$(/sbin/sysctl -n user.localbase 2> /dev/null)"}
: ${_localbase:="/usr/local"}
# rc_debug can't be set here without interferring with rc.subr's setting it