summaryrefslogtreecommitdiffstats
path: root/etc/rc
diff options
context:
space:
mode:
authorgordon <gordon@FreeBSD.org>2002-06-13 22:30:02 +0000
committergordon <gordon@FreeBSD.org>2002-06-13 22:30:02 +0000
commit71e9fd7b1ab1a0ffb8cf3c2ebb80c97ea3364b2e (patch)
tree1507ceaafbb91402503acd68aeecbe74212b3649 /etc/rc
parentc61b4c2e3d37d795fa74f9d97e181d9de2fc77a8 (diff)
downloadFreeBSD-src-71e9fd7b1ab1a0ffb8cf3c2ebb80c97ea3364b2e.zip
FreeBSD-src-71e9fd7b1ab1a0ffb8cf3c2ebb80c97ea3364b2e.tar.gz
Add the final bits that allow the use of rc.d. Note that you can toggle
between rc.d and the classic boot scripts based on the rcng variable in your rc.conf. Defaults to classic boot scripts. Submitted by: Mike Makonnen
Diffstat (limited to 'etc/rc')
-rw-r--r--etc/rc55
1 files changed, 53 insertions, 2 deletions
diff --git a/etc/rc b/etc/rc
index eb6aec1..25f07a1 100644
--- a/etc/rc
+++ b/etc/rc
@@ -46,12 +46,63 @@ stty status '^T'
trap : 2
trap : 3 # shouldn't be needed
-bootmode=$1
-
HOME=/
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export HOME PATH
+# If there is a global system configuration file, suck it in.
+# XXX - The only purpose of duplicating it here is to catch rc_ng="YES"
+#
+if [ -r /etc/defaults/rc.conf ]; then
+ . /etc/defaults/rc.conf
+ source_rc_confs
+elif [ -r /etc/rc.conf ]; then
+ . /etc/rc.conf
+fi
+
+# Diskless setups have to depend on a different mechanism since
+# their config files haven't been retargeted yet.
+#
+[ -e /.rcng_yes ] && rc_ng="YES"
+
+case ${rc_ng} in
+[Yy][Ee][Ss])
+ . /etc/rc.subr
+
+ # Load system configuration files. The 'XXX' is there because
+ # the function requires an argument that we don't need to use.
+ #
+ load_rc_config 'XXX'
+
+ if [ "$1" = autoboot ]; then
+ autoboot=yes
+ _boot="faststart"
+ rc_fast=yes # run_rc_command(): do fast booting
+ export autoboot
+ export rc_fast
+ else
+ autoboot=no
+ _boot="start"
+ fi
+
+ os=`eval ${CMD_OSTYPE}`
+ files=`rcorder -k ${os} -s nostart /etc/rc.d/*`
+
+ for _rc_elem in ${files}; do
+ run_rc_script ${_rc_elem} ${_boot}
+ done
+
+ echo ''
+ date
+ exit 0
+ ;;
+*)
+ # fall-through to the old rc scripts
+ ;;
+esac
+
+bootmode=$1
+
# BOOTP diskless boot. We have to run the rc file early in order to
# retarget various config files.
#
OpenPOWER on IntegriCloud