summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/mtree/BSD.root.dist2
-rw-r--r--etc/rc.subr21
-rw-r--r--share/man/man5/rc.conf.523
3 files changed, 39 insertions, 7 deletions
diff --git a/etc/mtree/BSD.root.dist b/etc/mtree/BSD.root.dist
index e3ca074..19409ce 100644
--- a/etc/mtree/BSD.root.dist
+++ b/etc/mtree/BSD.root.dist
@@ -58,6 +58,8 @@
..
ppp
..
+ rc.conf.d
+ ..
rc.d
..
security
diff --git a/etc/rc.subr b/etc/rc.subr
index b6172db..ff4e898 100644
--- a/etc/rc.subr
+++ b/etc/rc.subr
@@ -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
diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5
index e05291d..ce1230e 100644
--- a/share/man/man5/rc.conf.5
+++ b/share/man/man5/rc.conf.5
@@ -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.
OpenPOWER on IntegriCloud