rc.subr (272976) | rc.subr (275359) |
---|---|
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 272976 2014-10-12 02:42:36Z hrs $ | 2# $FreeBSD: head/etc/rc.subr 275359 2014-12-01 12:17:42Z des $ |
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 --- 1299 unchanged lines hidden (view full) --- 1310# 1311# load_rc_config name 1312# Source in the configuration file for a given name. 1313# 1314load_rc_config() 1315{ 1316 local _name _rcvar_val _var _defval _v _msg _new _d 1317 _name=$1 | 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 --- 1299 unchanged lines hidden (view full) --- 1310# 1311# load_rc_config name 1312# Source in the configuration file for a given name. 1313# 1314load_rc_config() 1315{ 1316 local _name _rcvar_val _var _defval _v _msg _new _d 1317 _name=$1 |
1318 if [ -z "$_name" ]; then 1319 err 3 'USAGE: load_rc_config name' 1320 fi | |
1321 1322 if ${_rc_conf_loaded:-false}; then 1323 : 1324 else 1325 if [ -r /etc/defaults/rc.conf ]; then 1326 debug "Sourcing /etc/defaults/rc.conf" 1327 . /etc/defaults/rc.conf 1328 source_rc_confs 1329 elif [ -r /etc/rc.conf ]; then 1330 debug "Sourcing /etc/rc.conf (/etc/defaults/rc.conf doesn't exist)." 1331 . /etc/rc.conf 1332 fi 1333 _rc_conf_loaded=true 1334 fi 1335 | 1318 1319 if ${_rc_conf_loaded:-false}; then 1320 : 1321 else 1322 if [ -r /etc/defaults/rc.conf ]; then 1323 debug "Sourcing /etc/defaults/rc.conf" 1324 . /etc/defaults/rc.conf 1325 source_rc_confs 1326 elif [ -r /etc/rc.conf ]; then 1327 debug "Sourcing /etc/rc.conf (/etc/defaults/rc.conf doesn't exist)." 1328 . /etc/rc.conf 1329 fi 1330 _rc_conf_loaded=true 1331 fi 1332 |
1336 for _d in /etc ${local_startup%*/rc.d}; do 1337 if [ -f ${_d}/rc.conf.d/"$_name" ]; then 1338 debug "Sourcing ${_d}/rc.conf.d/$_name" 1339 . ${_d}/rc.conf.d/"$_name" 1340 elif [ -d ${_d}/rc.conf.d/"$_name" ] ; then 1341 local _rc 1342 for _rc in ${_d}/rc.conf.d/"$_name"/* ; do 1343 if [ -f "$_rc" ] ; then 1344 debug "Sourcing $_rc" 1345 . "$_rc" 1346 fi 1347 done 1348 fi 1349 done | 1333 # If a service name was specified, attempt to load 1334 # service-specific configuration 1335 if [ -n "$_name" ] ; then 1336 for _d in /etc ${local_startup%*/rc.d}; do 1337 if [ -f ${_d}/rc.conf.d/"$_name" ]; then 1338 debug "Sourcing ${_d}/rc.conf.d/$_name" 1339 . ${_d}/rc.conf.d/"$_name" 1340 elif [ -d ${_d}/rc.conf.d/"$_name" ] ; then 1341 local _rc 1342 for _rc in ${_d}/rc.conf.d/"$_name"/* ; do 1343 if [ -f "$_rc" ] ; then 1344 debug "Sourcing $_rc" 1345 . "$_rc" 1346 fi 1347 done 1348 fi 1349 done 1350 fi |
1350 1351 # Set defaults if defined. 1352 for _var in $rcvar $rcvars; do 1353 eval _defval=\$${_var}_defval 1354 if [ -n "$_defval" ]; then 1355 eval : \${$_var:=\$${_var}_defval} 1356 fi 1357 done --- 731 unchanged lines hidden --- | 1351 1352 # Set defaults if defined. 1353 for _var in $rcvar $rcvars; do 1354 eval _defval=\$${_var}_defval 1355 if [ -n "$_defval" ]; then 1356 eval : \${$_var:=\$${_var}_defval} 1357 fi 1358 done --- 731 unchanged lines hidden --- |