From owner-svn-src-all@freebsd.org Tue Nov 3 12:29:11 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D30F45778B; Tue, 3 Nov 2020 12:29:11 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CQTc70538z3Ynb; Tue, 3 Nov 2020 12:29:11 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB9EA1A934; Tue, 3 Nov 2020 12:29:10 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A3CTAib056626; Tue, 3 Nov 2020 12:29:10 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A3CTAoR056624; Tue, 3 Nov 2020 12:29:10 GMT (envelope-from se@FreeBSD.org) Message-Id: <202011031229.0A3CTAoR056624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: se set sender to se@FreeBSD.org using -f From: =?UTF-8?Q?Stefan_E=c3=9fer?= Date: Tue, 3 Nov 2020 12:29:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367294 - head/libexec/rc X-SVN-Group: head X-SVN-Commit-Author: se X-SVN-Commit-Paths: head/libexec/rc X-SVN-Commit-Revision: 367294 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 12:29:11 -0000 Author: se Date: Tue Nov 3 12:29:10 2020 New Revision: 367294 URL: https://svnweb.freebsd.org/changeset/base/367294 Log: Replace literal uses of /usr/local with a variable The variable defaults to "/usr/local", unless sysctl returns some other value for "user.localbase". The value of user.localbase defaults to _PATH_LOCALBASE as defined in paths.h and thus this commit has no immediate effect. The purpose of this change is to make /etc/defaults/rc.conf automatically use the value of _PATH_LOCALBASE when not set to the default value. Reviewed by: imp, scottl MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D27014 Modified: head/libexec/rc/rc head/libexec/rc/rc.conf Modified: head/libexec/rc/rc ============================================================================== --- head/libexec/rc/rc Tue Nov 3 12:15:08 2020 (r367293) +++ head/libexec/rc/rc Tue Nov 3 12:29:10 2020 (r367294) @@ -59,6 +59,8 @@ else _boot="quietstart" fi +_localbase=`/sbin/sysctl -n user.localbase 2> /dev/null` + dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null` if [ ${dlv:=0} -ne 0 -o -f /etc/diskless ]; then sh /etc/rc.initdiskless Modified: head/libexec/rc/rc.conf ============================================================================== --- head/libexec/rc/rc.conf Tue Nov 3 12:15:08 2020 (r367293) +++ head/libexec/rc/rc.conf Tue Nov 3 12:29:10 2020 (r367294) @@ -21,6 +21,9 @@ ### Important initial Boot-time options #################### ############################################################## +# Set default value of _localbase if not previously set +: ${_localbase:="/usr/local"} + # rc_debug can't be set here without interferring with rc.subr's setting it # when the kenv variable rc.debug is set. #rc_debug="NO" # Set to YES to enable debugging output from rc.d @@ -58,7 +61,7 @@ varmfs_flags="-S" # Extra mount options for the mfs /v mfs_type="auto" # "md", "tmpfs", "auto" to prefer tmpfs with md as fallback populate_var="AUTO" # Set to YES to always (re)populate /var, NO to never cleanvar_enable="YES" # Clean the /var directory -local_startup="/usr/local/etc/rc.d" # startup script dirs. +local_startup="${_localbase}/etc/rc.d" # startup script dirs. script_name_sep=" " # Change if your startup scripts' names contain spaces rc_conf_files="/etc/rc.conf /etc/rc.conf.local" @@ -188,7 +191,7 @@ ipfw_netflow_enable="NO" # Enable netflow logging via ip_portrange_first="NO" # Set first dynamically allocated port ip_portrange_last="NO" # Set last dynamically allocated port ike_enable="NO" # Enable IKE daemon (usually racoon or isakmpd) -ike_program="/usr/local/sbin/isakmpd" # Path to IKE daemon +ike_program="${_localbase}/sbin/isakmpd" # Path to IKE daemon ike_flags="" # Additional flags for IKE daemon ipsec_enable="NO" # Set to YES to run setkey on ipsec_file ipsec_file="/etc/ipsec.conf" # Name of config file for setkey @@ -647,19 +650,19 @@ linux_mounts_enable="YES" # If linux_enable is set to clear_tmp_enable="NO" # Clear /tmp at startup. clear_tmp_X="YES" # Clear and recreate X11-related directories in /tmp ldconfig_insecure="NO" # Set to YES to disable ldconfig security checks -ldconfig_paths="/usr/lib/compat /usr/local/lib /usr/local/lib/compat/pkg" +ldconfig_paths="/usr/lib/compat ${_localbase}/lib ${_localbase}/lib/compat/pkg" # shared library search paths ldconfig32_paths="/usr/lib32 /usr/lib32/compat" # 32-bit compatibility shared library search paths -ldconfigsoft_paths="/usr/libsoft /usr/libsoft/compat /usr/local/libsoft" +ldconfigsoft_paths="/usr/libsoft /usr/libsoft/compat ${_localbase}/libsoft" # soft float compatibility shared library search paths # Note: temporarily with extra stuff for transition -ldconfig_local_dirs="/usr/local/libdata/ldconfig" +ldconfig_local_dirs="${_localbase}/libdata/ldconfig" # Local directories with ldconfig configuration files. -ldconfig_local32_dirs="/usr/local/libdata/ldconfig32" +ldconfig_local32_dirs="${_localbase}/libdata/ldconfig32" # Local directories with 32-bit compatibility ldconfig # configuration files. -ldconfig_localsoft_dirs="/usr/local/libdata/ldconfigsoft" +ldconfig_localsoft_dirs="${_localbase}/libdata/ldconfigsoft" # Local directories with soft float compatibility ldconfig # configuration files. kern_securelevel_enable="NO" # kernel security level (see security(7))