Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 09 Dec 2005 02:45:23 -0800
From:      Doug Barton <dougb@FreeBSD.org>
To:        Brooks Davis <brooks@one-eyed-alien.net>
Cc:        freebsd-rc@freebsd.org
Subject:   Re: For Review: Latest update to rcorder patch
Message-ID:  <43996043.8020609@FreeBSD.org>
In-Reply-To: <20051208222013.GB5759@odin.ac.hmc.edu>
References:  <4398AB6A.3000209@FreeBSD.org> <20051208222013.GB5759@odin.ac.hmc.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------040501060006070409010202
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Brooks Davis wrote:

> Conceptually, I'm happy with this.  A few things.
> 
>  - I'd suggest explicitly stating that the only sane values
>    for $early_late_divider are probably root, mountcritlocal, and
>    mountcritremote.

Yeah, I ended up having to finish my message in a hurry (real life called),
and I forgot to add that I hadn't finished the rc.conf man page entry yet. I
am always hesitant to add too much info to the rc.conf file, mostly because
people who are determined to self foot-shoot will ignore it anyway. :)

I've added my proposed patch to rc.conf(5).

>  - diskless.8 should probably be updated to mentation that
>    early_late_divider must be set to mountcritremote for the documented
>    configuration to work.

I can do that as part of the change if you want, or you can do it, just let
me know.

>  - If you want to depend on an rc.conf value in /etc/rc,
>    /etc/rc.d/rcconf.sh should die.  early_late_divider is only non-zero
>    every time through the loop by accident at this point. 

Ok, good plan. :) Based on our earlier conversation, I've also moved the
sourcing of rc.subr to after rc.initdiskless. In the non-diskless case, this
should be a total noop, so I'm not worried about this part of the change,
and if we're going to do it, we should do it now. Although I didn't include
it in this patch, I'll remove rcconf.sh as well.

> Since
>    rcconf.sh is no longer needed due to moving rc.d/initdiskless back
>    to /etc/rc.initdiskless, it's safe to handle configuration in /etc/rc.

Sounds great to me!

Thanks as always for your feedback and careful thought here.

Doug

-- 

      This .signature sanitized for your protection




--------------040501060006070409010202
Content-Type: text/plain;
 name="rc.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="rc.diff"

Index: etc/rc
===================================================================
RCS file: /usr/local/ncvs/src/etc/rc,v
retrieving revision 1.337
diff -u -r1.337 rc
--- etc/rc	2 Dec 2005 20:06:07 -0000	1.337
+++ etc/rc	9 Dec 2005 09:55:41 -0000
@@ -50,12 +50,6 @@
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 export HOME PATH
 
-. /etc/rc.subr
-
-# Note: the system configuration files are loaded as part of
-# the rc.d system (rc.d/rcconf.sh).  Do not load them here as it may
-# interfere with diskless booting.
-#
 if [ "$1" = autoboot ]; then
 	autoboot=yes
 	_boot="faststart"
@@ -70,10 +64,18 @@
 	sh /etc/rc.initdiskless
 fi
 
+# Run these after determining whether we are booting diskless in order
+# to minimize the number of files that are needed on a diskless system,
+# and to make the configuration file variables available to rc itself.
+#
+. /etc/rc.subr
+echo "Loading configuration files."
+load_rc_config 'XXX'
+
 skip="-s nostart"
 [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ] && skip="$skip -s nojail"
 
-# Do a first pass to get everything up to mountcritremote so that
+# Do a first pass to get everything up to $early_late_divider so that
 # we can do a second pass that includes $local_startup directories
 #
 files=`rcorder ${skip} /etc/rc.d/* 2>/dev/null`
@@ -82,7 +84,7 @@
 	run_rc_script ${_rc_elem} ${_boot}
 
 	case "$_rc_elem" in
-	*/mountcritremote)	break ;;
+	*/${early_late_divider})	break ;;
 	esac
 done
 
@@ -101,7 +103,7 @@
 for _rc_elem in ${files}; do
 	case "$_skip_early" in
 	1)	case "$_rc_elem" in
-		*/mountcritremote)	_skip_early=0 ;;
+		*/${early_late_divider})	_skip_early=0 ;;
 		esac
 		continue
 		;;
Index: etc/rc.subr
===================================================================
RCS file: /usr/local/ncvs/src/etc/rc.subr,v
retrieving revision 1.45
diff -u -r1.45 rc.subr
--- etc/rc.subr	5 Dec 2005 07:04:15 -0000	1.45
+++ etc/rc.subr	8 Dec 2005 21:20:15 -0000
@@ -1380,7 +1380,7 @@
 	local_rc=''
 	for dir in ${local_startup}; do
 		if [ -d "${dir}" ]; then
-			for file in `grep -l '^# PROVIDE:' ${dir}/*`; do
+			for file in `grep -l '^# PROVIDE:' ${dir}/* 2>/dev/null`; do
 				case "$file" in
 				*.sample) ;;
 				*)	if [ -x "$file" ]; then
Index: etc/defaults/rc.conf
===================================================================
RCS file: /usr/local/ncvs/src/etc/defaults/rc.conf,v
retrieving revision 1.265
diff -u -r1.265 rc.conf
--- etc/defaults/rc.conf	24 Nov 2005 14:39:41 -0000	1.265
+++ etc/defaults/rc.conf	9 Dec 2005 10:16:12 -0000
@@ -24,6 +24,11 @@
 rc_debug="NO"		# Set to YES to enable debugging output from rc.d
 rc_info="NO"		# Enables display of informational messages at boot.
 rcshutdown_timeout="30" # Seconds to wait before terminating rc.shutdown
+early_late_divider="mountcritlocal" 	# Script that separates early/late
+			# stages of the boot process.  Make sure you know
+			# the ramifications if you change this.
+			# See rc.conf(5) for more details.
+
 swapfile="NO"		# Set to name of swapfile if aux swapfile desired.
 apm_enable="NO"		# Set to YES to enable APM BIOS functions (or NO).
 apmd_enable="NO"	# Run apmd to handle APM event from userland.
Index: share/man/man5/rc.conf.5
===================================================================
RCS file: /usr/local/ncvs/src/share/man/man5/rc.conf.5,v
retrieving revision 1.271
diff -u -r1.271 rc.conf.5
--- share/man/man5/rc.conf.5	18 Nov 2005 10:52:23 -0000	1.271
+++ share/man/man5/rc.conf.5	9 Dec 2005 10:18:37 -0000
@@ -90,6 +90,29 @@
 Informational messages are displayed when
 a condition that is not serious enough to warrant a warning or
 an error occurs.
+.It Va early_late_divider
+.Pq Vt str
+The name of the script that should be used as the
+delimiter between the
+.Dq early
+and
+.Dq late
+stages of the boot process.
+The early stage should contain all the services needed to
+get the disks (local or remote) mounted so that the late
+stage can include scripts contained in the directories
+listed in the
+.Va local_startup
+variable (see below).
+Thus, the two likely candidates for this value are
+mountcritlocal for the typical system,
+and mountcritremote if the system is
+.Dq diskless .
+Extreme care should be taken when changing this value,
+and before changing it one should ensure that there are
+adequate provisions to recover from a failed boot
+(such as physical contact with the machine,
+or reliable remote console access).
 .It Va swapfile
 .Pq Vt str
 If set to


--------------040501060006070409010202--



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