Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Dec 2002 17:30:49 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        Mike Makonnen <mtm@identd.net>
Cc:        jake@locore.ca, cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/etc rc.diskless1
Message-ID:  <200212230130.gBN1UnHG033982@apollo.backplane.com>
References:  <20021222134047.51723c7c.mtm@identd.net> <200212222226.gBMMQQSu033211@apollo.backplane.com> <20021223005643.GA34206@matrix.identd.net>

next in thread | previous in thread | raw e-mail | index | archive | help
    Here's a patch to get rid of the rc variable pollution once and for all.

					-Matt

Index: rc
===================================================================
RCS file: /home/ncvs/src/etc/rc,v
retrieving revision 1.325
diff -u -r1.325 rc
--- rc	22 Dec 2002 22:18:41 -0000	1.325
+++ rc	23 Dec 2002 01:29:25 -0000
@@ -50,20 +50,41 @@
 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"
+# 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.
 #
-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()
+{
+	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
+/bin/sh
 
 case ${rc_ng} in
 [Yy][Ee][Ss])

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212230130.gBN1UnHG033982>