summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/rc48
1 files changed, 34 insertions, 14 deletions
diff --git a/etc/rc b/etc/rc
index 3a660e9..3ff2473 100644
--- a/etc/rc
+++ b/etc/rc
@@ -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
OpenPOWER on IntegriCloud