From 156819c49891b3da4cc03f62d8576f19c55d26ee Mon Sep 17 00:00:00 2001 From: dougb Date: Sat, 10 Dec 2005 20:21:46 +0000 Subject: Remove rcconf.sh from /etc/rc.d, and instead load the configuration as part of rc. Doing this, and the sourcing of rc.subr after we have determined if we are booting diskless (and correspondingly run rc.initdiskless if necessary) are safe, and actually allow fewer files to be needed on the diskless box. This also allows variables from the configuration to be available to rc itself, such as ... Add a variable to rc.conf, early_late_divider, which designates the script which separates the early and late stages of the boot process. Default this to mountcritlocal, and add text to etc/defaults/rc.conf, rc.conf(5) and diskless(8) which describes how and why one might want to change this. Reviewed by: brooks --- etc/rc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'etc/rc') diff --git a/etc/rc b/etc/rc index a94d923..ea7d502 100644 --- a/etc/rc +++ b/etc/rc @@ -50,12 +50,6 @@ HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin export HOME PATH -. /etc/rc.subr - -# Note: the system configuration files are loaded as part of -# the rc.d system (rc.d/rcconf.sh). Do not load them here as it may -# interfere with diskless booting. -# if [ "$1" = autoboot ]; then autoboot=yes _boot="faststart" @@ -70,10 +64,18 @@ if [ ${dlv:=0} -ne 0 -o -f /etc/diskless ]; then sh /etc/rc.initdiskless fi +# Run these after determining whether we are booting diskless in order +# to minimize the number of files that are needed on a diskless system, +# and to make the configuration file variables available to rc itself. +# +. /etc/rc.subr +echo "Loading configuration files." +load_rc_config 'XXX' + skip="-s nostart" [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ] && skip="$skip -s nojail" -# Do a first pass to get everything up to mountcritremote so that +# Do a first pass to get everything up to $early_late_divider so that # we can do a second pass that includes $local_startup directories # files=`rcorder ${skip} /etc/rc.d/* 2>/dev/null` @@ -82,7 +84,7 @@ for _rc_elem in ${files}; do run_rc_script ${_rc_elem} ${_boot} case "$_rc_elem" in - */mountcritremote) break ;; + */${early_late_divider}) break ;; esac done @@ -101,7 +103,7 @@ _skip_early=1 for _rc_elem in ${files}; do case "$_skip_early" in 1) case "$_rc_elem" in - */mountcritremote) _skip_early=0 ;; + */${early_late_divider}) _skip_early=0 ;; esac continue ;; -- cgit v1.1