diff options
author | des <des@FreeBSD.org> | 2014-12-01 12:17:42 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2014-12-01 12:17:42 +0000 |
commit | 48aea3a5cfec4baa4776ec2c7eed854d48e5bc7e (patch) | |
tree | 8a2d23abd663c936f9284835681f05d1d70471f9 /etc/rc.subr | |
parent | 12fec3618b88732ec95820e4717a392d431ddb61 (diff) | |
download | FreeBSD-src-48aea3a5cfec4baa4776ec2c7eed854d48e5bc7e.zip FreeBSD-src-48aea3a5cfec4baa4776ec2c7eed854d48e5bc7e.tar.gz |
Allow load_rc_config to be called without a service name.
MFC after: 1 week
Diffstat (limited to 'etc/rc.subr')
-rw-r--r-- | etc/rc.subr | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/etc/rc.subr b/etc/rc.subr index 6534f68..7b1e387 100644 --- a/etc/rc.subr +++ b/etc/rc.subr @@ -1315,9 +1315,6 @@ load_rc_config() { local _name _rcvar_val _var _defval _v _msg _new _d _name=$1 - if [ -z "$_name" ]; then - err 3 'USAGE: load_rc_config name' - fi if ${_rc_conf_loaded:-false}; then : @@ -1333,20 +1330,24 @@ load_rc_config() _rc_conf_loaded=true 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 + # If a service name was specified, attempt to load + # service-specific configuration + if [ -n "$_name" ] ; then + 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 + fi # Set defaults if defined. for _var in $rcvar $rcvars; do |