Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Sep 2014 11:18:27 +0000 (UTC)
From:      Dag-Erling Smørgrav <des@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r271260 - in stable/10: etc etc/mtree share/man/man5
Message-ID:  <201409081118.s88BIRpu006510@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: des
Date: Mon Sep  8 11:18:27 2014
New Revision: 271260
URL: http://svnweb.freebsd.org/changeset/base/271260

Log:
  MFH (r270392, r270676, r270679, r270698): add support for subdirectories in rc.conf.d
  
  Approved by:	re (glebius)

Modified:
  stable/10/etc/mtree/BSD.root.dist
  stable/10/etc/rc.subr
  stable/10/share/man/man5/rc.conf.5
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/mtree/BSD.root.dist
==============================================================================
--- stable/10/etc/mtree/BSD.root.dist	Mon Sep  8 11:01:57 2014	(r271259)
+++ stable/10/etc/mtree/BSD.root.dist	Mon Sep  8 11:18:27 2014	(r271260)
@@ -58,6 +58,8 @@
         ..
         ppp
         ..
+        rc.conf.d
+        ..
         rc.d
         ..
         security

Modified: stable/10/etc/rc.subr
==============================================================================
--- stable/10/etc/rc.subr	Mon Sep  8 11:01:57 2014	(r271259)
+++ stable/10/etc/rc.subr	Mon Sep  8 11:18:27 2014	(r271260)
@@ -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,10 +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"
-	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: stable/10/share/man/man5/rc.conf.5
==============================================================================
--- stable/10/share/man/man5/rc.conf.5	Mon Sep  8 11:01:57 2014	(r271259)
+++ stable/10/share/man/man5/rc.conf.5	Mon Sep  8 11:18:27 2014	(r271260)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 15, 2014
+.Dd August 27, 2014
 .Dt RC.CONF 5
 .Os
 .Sh NAME
@@ -63,18 +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, 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?201409081118.s88BIRpu006510>