Deleted Added
full compact
rc.subr (270676) rc.subr (270698)
1# $NetBSD: rc.subr,v 1.67 2006/10/07 11:25:15 elad Exp $
1# $NetBSD: rc.subr,v 1.67 2006/10/07 11:25:15 elad Exp $
2# $FreeBSD: head/etc/rc.subr 270676 2014-08-26 22:33:34Z bapt $
2# $FreeBSD: head/etc/rc.subr 270698 2014-08-27 09:19:22Z hrs $
3#
4# Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
5# All rights reserved.
6#
7# This code is derived from software contributed to The NetBSD Foundation
8# by Luke Mewburn.
9#
10# Redistribution and use in source and binary forms, with or without

--- 1254 unchanged lines hidden (view full) ---

1265}
1266
1267#
1268# load_rc_config name
1269# Source in the configuration file for a given name.
1270#
1271load_rc_config()
1272{
3#
4# Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
5# All rights reserved.
6#
7# This code is derived from software contributed to The NetBSD Foundation
8# by Luke Mewburn.
9#
10# Redistribution and use in source and binary forms, with or without

--- 1254 unchanged lines hidden (view full) ---

1265}
1266
1267#
1268# load_rc_config name
1269# Source in the configuration file for a given name.
1270#
1271load_rc_config()
1272{
1273 local _name _rcvar_val _var _defval _v _msg _new
1273 local _name _rcvar_val _var _defval _v _msg _new _d
1274 _name=$1
1275 if [ -z "$_name" ]; then
1276 err 3 'USAGE: load_rc_config name'
1277 fi
1278
1279 if ${_rc_conf_loaded:-false}; then
1280 :
1281 else
1282 if [ -r /etc/defaults/rc.conf ]; then
1283 debug "Sourcing /etc/defaults/rc.conf"
1284 . /etc/defaults/rc.conf
1285 source_rc_confs
1286 elif [ -r /etc/rc.conf ]; then
1287 debug "Sourcing /etc/rc.conf (/etc/defaults/rc.conf doesn't exist)."
1288 . /etc/rc.conf
1289 fi
1290 _rc_conf_loaded=true
1291 fi
1274 _name=$1
1275 if [ -z "$_name" ]; then
1276 err 3 'USAGE: load_rc_config name'
1277 fi
1278
1279 if ${_rc_conf_loaded:-false}; then
1280 :
1281 else
1282 if [ -r /etc/defaults/rc.conf ]; then
1283 debug "Sourcing /etc/defaults/rc.conf"
1284 . /etc/defaults/rc.conf
1285 source_rc_confs
1286 elif [ -r /etc/rc.conf ]; then
1287 debug "Sourcing /etc/rc.conf (/etc/defaults/rc.conf doesn't exist)."
1288 . /etc/rc.conf
1289 fi
1290 _rc_conf_loaded=true
1291 fi
1292 if [ -f /etc/rc.conf.d/"$_name" ]; then
1293 debug "Sourcing /etc/rc.conf.d/$_name"
1294 . /etc/rc.conf.d/"$_name"
1295 elif [ -d /etc/rc.conf.d/"$_name" ] ; then
1296 local _rc
1297 for _rc in /etc/rc.conf.d/"$_name"/* ; do
1298 if [ -f "$_rc" ] ; then
1299 debug "Sourcing $_rc"
1300 . "$_rc"
1301 fi
1302 done
1303 fi
1304 if [ -f ${LOCALBASE:-/usr/local}/etc/rc.conf.d/"$_name" ]; then
1305 debug "Sourcing ${LOCALBASE:-/usr/local}/etc/rc.conf.d/${_name}"
1306 . ${LOCALBASE:-/usr/local}/etc/rc.conf.d/"$_name"
1307 fi
1308
1292
1293 for _d in /etc ${local_startup%*/rc.d}; do
1294 if [ -f ${_d}/rc.conf.d/"$_name" ]; then
1295 debug "Sourcing ${_d}/rc.conf.d/$_name"
1296 . ${_d}/rc.conf.d/"$_name"
1297 elif [ -d ${_d}/rc.conf.d/"$_name" ] ; then
1298 local _rc
1299 for _rc in ${_d}/rc.conf.d/"$_name"/* ; do
1300 if [ -f "$_rc" ] ; then
1301 debug "Sourcing $_rc"
1302 . "$_rc"
1303 fi
1304 done
1305 fi
1306 done
1307
1309 # Set defaults if defined.
1310 for _var in $rcvar; do
1311 eval _defval=\$${_var}_defval
1312 if [ -n "$_defval" ]; then
1313 eval : \${$_var:=\$${_var}_defval}
1314 fi
1315 done
1316

--- 714 unchanged lines hidden ---
1308 # Set defaults if defined.
1309 for _var in $rcvar; do
1310 eval _defval=\$${_var}_defval
1311 if [ -n "$_defval" ]; then
1312 eval : \${$_var:=\$${_var}_defval}
1313 fi
1314 done
1315

--- 714 unchanged lines hidden ---