The branch main has been updated by ivy:

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

commit 5467020a540d92a39dcabc149a264f3c0d0c084c
Author:     Lexi Winter <i...@freebsd.org>
AuthorDate: 2025-08-10 12:24:03 +0000
Commit:     Lexi Winter <i...@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

Reply via email to