git: 1eb29a37f26b - stable/14 - rc.conf: Use user.localbase to determine _localbase
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 23 Aug 2025 00:11:21 UTC
The branch stable/14 has been updated by ivy:
URL: https://cgit.FreeBSD.org/src/commit/?id=1eb29a37f26b1a3671f38037dd61975e1b1105cf
commit 1eb29a37f26b1a3671f38037dd61975e1b1105cf
Author: Lexi Winter <ivy@FreeBSD.org>
AuthorDate: 2025-08-10 12:24:03 +0000
Commit: Lexi Winter <ivy@FreeBSD.org>
CommitDate: 2025-08-22 21:47:24 +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
(cherry picked from commit 5467020a540d92a39dcabc149a264f3c0d0c084c)
---
libexec/rc/rc.conf | 1 +
1 file changed, 1 insertion(+)
diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf
index b3c54c3cb0f0..a8a8ae01b488 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