diff options
author | dillon <dillon@FreeBSD.org> | 2002-12-23 07:09:44 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 2002-12-23 07:09:44 +0000 |
commit | 42849ff8067a7355c47a5e9b214be4790137fe10 (patch) | |
tree | d6d577220065433c4ff52e9056956eda2fb9b7ba /etc | |
parent | 6a9b175c845be9b72afbebeec4bcfbdf3013894d (diff) | |
download | FreeBSD-src-42849ff8067a7355c47a5e9b214be4790137fe10.zip FreeBSD-src-42849ff8067a7355c47a5e9b214be4790137fe10.tar.gz |
Redo the initial rc_ng check to avoid rc.conf pollution occuring too early,
initdiskless may retarget /etc and various rc.conf files. The initial check
is now done in a subshell.
Reviewed by: Mike Makonnen <mtm@identd.net>
Diffstat (limited to 'etc')
-rw-r--r-- | etc/rc | 48 |
1 files changed, 34 insertions, 14 deletions
@@ -50,23 +50,43 @@ 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 +# check_rcng() is run in a subshell solely to determine the +# RCNG mode. We do not want to pollute our variable space +# too soon so the procedure must be run in a subshell. An +# exit code of 3 indicates RCNG is enabled. +# +check_rcng() +{ + 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" + # 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]) + exit 3 + ;; + *) + exit 0 + ;; + esac +} + +( check_rcng ) +if [ $? = 3 ]; then + rc_ng=YES +else + rc_ng=NO +fi case ${rc_ng} in -[Yy][Ee][Ss]) +YES) . /etc/rc.subr # Note: the system configuration files are loaded as part of |