Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Aug 2014 13:48:00 +0900 (JST)
From:      Hiroki Sato <hrs@FreeBSD.org>
To:        bapt@FreeBSD.org
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r270676 - head/etc
Message-ID:  <20140827.134800.2047075166971853210.hrs@allbsd.org>
In-Reply-To: <201408262233.s7QMXYfd056791@svn.freebsd.org>
References:  <201408262233.s7QMXYfd056791@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
----Security_Multipart0(Wed_Aug_27_13_48_00_2014_152)--
Content-Type: Multipart/Mixed;
 boundary="--Next_Part(Wed_Aug_27_13_48_00_2014_381)--"
Content-Transfer-Encoding: 7bit

----Next_Part(Wed_Aug_27_13_48_00_2014_381)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Baptiste Daroussin <bapt@FreeBSD.org> wrote
  in <201408262233.s7QMXYfd056791@svn.freebsd.org>:

ba> Author: bapt
ba> Date: Tue Aug 26 22:33:34 2014
ba> New Revision: 270676
ba> URL: http://svnweb.freebsd.org/changeset/base/270676
ba>
ba> Log:
ba>   Allow to configure services from ${LOCALBASE}/etc/rc.conf.d
ba>
ba>   Reviewed by:	bdrewery
ba>   MFC after:	1 week
ba>   Relnotes:	yes
ba>
ba> Modified:
ba>   head/etc/rc.subr
ba>
ba> Modified: head/etc/rc.subr
ba> ==============================================================================
ba> --- head/etc/rc.subr	Tue Aug 26 22:20:02 2014	(r270675)
ba> +++ head/etc/rc.subr	Tue Aug 26 22:33:34 2014	(r270676)
ba> @@ -1301,6 +1301,10 @@ load_rc_config()
ba>  			fi
ba>  		done
ba>  	fi
ba> +	if [ -f ${LOCALBASE:-/usr/local}/etc/rc.conf.d/"$_name" ]; then
ba> +		debug "Sourcing ${LOCALBASE:-/usr/local}/etc/rc.conf.d/${_name}"
ba> +		. ${LOCALBASE:-/usr/local}/etc/rc.conf.d/"$_name"
ba> +	fi

 This should hornor ${local_startup} instead of ${LOCALBASE} since it
 is not used in rc(8), and should be compatible with DES's commit in
 r270392.

 How about the attached patch?

-- Hiroki

----Next_Part(Wed_Aug_27_13_48_00_2014_381)--
Content-Type: Text/X-Patch; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="rc.subr.20140827-1.diff"

Index: etc/rc.subr
===================================================================
--- etc/rc.subr	(revision 270695)
+++ etc/rc.subr	(working copy)
@@ -1270,7 +1270,7 @@
 #
 load_rc_config()
 {
-	local _name _rcvar_val _var _defval _v _msg _new
+	local _name _rcvar_val _var _defval _v _msg _new _d
 	_name=$1
 	if [ -z "$_name" ]; then
 		err 3 'USAGE: load_rc_config name'
@@ -1289,23 +1289,22 @@
 		fi
 		_rc_conf_loaded=true
 	fi
-	if [ -f /etc/rc.conf.d/"$_name" ]; then
-		debug "Sourcing /etc/rc.conf.d/$_name"
-		. /etc/rc.conf.d/"$_name"
-	elif [ -d /etc/rc.conf.d/"$_name" ] ; then
-		local _rc
-		for _rc in /etc/rc.conf.d/"$_name"/* ; do
-			if [ -f "$_rc" ] ; then
-				debug "Sourcing $_rc"
-				. "$_rc"
-			fi
-		done
-	fi
-	if [ -f ${LOCALBASE:-/usr/local}/etc/rc.conf.d/"$_name" ]; then
-		debug "Sourcing ${LOCALBASE:-/usr/local}/etc/rc.conf.d/${_name}"
-		. ${LOCALBASE:-/usr/local}/etc/rc.conf.d/"$_name"
-	fi

+	for _d in /etc ${local_startup%*/rc.d}; do
+		if [ -f ${_d}/rc.conf.d/"$_name" ]; then
+			debug "Sourcing ${_d}/rc.conf.d/$_name"
+			. ${_d}/rc.conf.d/"$_name"
+		elif [ -d ${_d}/rc.conf.d/"$_name" ] ; then
+			local _rc
+			for _rc in ${_d}/rc.conf.d/"$_name"/* ; do
+				if [ -f "$_rc" ] ; then
+					debug "Sourcing $_rc"
+					. "$_rc"
+				fi
+			done
+		fi
+	done
+
 	# Set defaults if defined.
 	for _var in $rcvar; do
 		eval _defval=\$${_var}_defval

----Next_Part(Wed_Aug_27_13_48_00_2014_381)----

----Security_Multipart0(Wed_Aug_27_13_48_00_2014_152)--
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEABECAAYFAlP9YwAACgkQTyzT2CeTzy0XwgCfawZi0t4DJ4ic1516gTQFwBh1
iAIAn19TvhrHvwmtVuB7/+1YA7lOzsrc
=9Mtv
-----END PGP SIGNATURE-----

----Security_Multipart0(Wed_Aug_27_13_48_00_2014_152)----



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