From owner-cvs-all Sun Dec 22 17:30:52 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5CEA637B401; Sun, 22 Dec 2002 17:30:50 -0800 (PST) Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 00B8243EE8; Sun, 22 Dec 2002 17:30:50 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: from apollo.backplane.com (localhost [127.0.0.1]) by apollo.backplane.com (8.12.5/8.12.5) with ESMTP id gBN1UnOM033983; Sun, 22 Dec 2002 17:30:49 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.12.5/8.12.5/Submit) id gBN1UnHG033982; Sun, 22 Dec 2002 17:30:49 -0800 (PST) (envelope-from dillon) Date: Sun, 22 Dec 2002 17:30:49 -0800 (PST) From: Matthew Dillon Message-Id: <200212230130.gBN1UnHG033982@apollo.backplane.com> To: Mike Makonnen Cc: jake@locore.ca, cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/etc rc.diskless1 References: <20021222134047.51723c7c.mtm@identd.net> <200212222226.gBMMQQSu033211@apollo.backplane.com> <20021223005643.GA34206@matrix.identd.net> Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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