Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Aug 2014 09:19:23 +0000 (UTC)
From:      Hiroki Sato <hrs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r270698 - in head: etc share/man/man5
Message-ID:  <201408270919.s7R9JNeF054138@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hrs
Date: Wed Aug 27 09:19:22 2014
New Revision: 270698
URL: http://svnweb.freebsd.org/changeset/base/270698

Log:
  - Use $local_startup to load rc.conf.d/* scripts.
  - Document support of rc.conf.d/<dir>/* introduced in r270392.
  
  Discussed with:	bapt

Modified:
  head/etc/rc.subr
  head/share/man/man5/rc.conf.5

Modified: head/etc/rc.subr
==============================================================================
--- head/etc/rc.subr	Wed Aug 27 08:05:57 2014	(r270697)
+++ head/etc/rc.subr	Wed Aug 27 09:19:22 2014	(r270698)
@@ -1270,7 +1270,7 @@ run_rc_script()
 #
 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,22 +1289,21 @@ load_rc_config()
 		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

Modified: head/share/man/man5/rc.conf.5
==============================================================================
--- head/share/man/man5/rc.conf.5	Wed Aug 27 08:05:57 2014	(r270697)
+++ head/share/man/man5/rc.conf.5	Wed Aug 27 09:19:22 2014	(r270698)
@@ -63,20 +63,37 @@ The file
 is used to override settings in
 .Pa /etc/rc.conf
 for historical reasons.
+.Pp
 In addition to
 .Pa /etc/rc.conf.local
 you can also place smaller configuration files for each
 .Xr rc 8
 script in the
 .Pa /etc/rc.conf.d
-directory or in the
-.Pa ${LOCALBASE}/etc/rc.conf.d
-directory, which will be included by the
+directory or
+.Ao Ar dir Ac Ns Pa /rc.conf.d
+directories specified in
+.Va local_startup ,
+which will be included by the
 .Va load_rc_config
 function.
 For jail configurations you could use the file
 .Pa /etc/rc.conf.d/jail
 to store jail specific configuration options.
+If
+.Va local_startup
+contains
+.Pa /usr/local/etc/rc.d
+and
+.Pa /opt/conf ,
+.Pa /usr/local/rc.conf.d/jail
+and
+.Pa /opt/conf/rc.conf.d/jail
+will be loaded.
+If
+.Ao Ar dir Ac Ns Pa /rc.conf.d/ Ns Ao Ar name Ac
+is a directory,
+all of files in the directory will be loaded.
 Also see the
 .Va rc_conf_files
 variable below.



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