summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordougb <dougb@FreeBSD.org>2005-12-10 20:21:46 +0000
committerdougb <dougb@FreeBSD.org>2005-12-10 20:21:46 +0000
commit156819c49891b3da4cc03f62d8576f19c55d26ee (patch)
tree5ded1b51d381a4c99cb73693b054a0b1d6c00a3b
parent18ad8e36cd3d532baad01a00fd3b5879f273cbd5 (diff)
downloadFreeBSD-src-156819c49891b3da4cc03f62d8576f19c55d26ee.zip
FreeBSD-src-156819c49891b3da4cc03f62d8576f19c55d26ee.tar.gz
Remove rcconf.sh from /etc/rc.d, and instead load the configuration
as part of rc. Doing this, and the sourcing of rc.subr after we have determined if we are booting diskless (and correspondingly run rc.initdiskless if necessary) are safe, and actually allow fewer files to be needed on the diskless box. This also allows variables from the configuration to be available to rc itself, such as ... Add a variable to rc.conf, early_late_divider, which designates the script which separates the early and late stages of the boot process. Default this to mountcritlocal, and add text to etc/defaults/rc.conf, rc.conf(5) and diskless(8) which describes how and why one might want to change this. Reviewed by: brooks
-rw-r--r--etc/defaults/rc.conf5
-rw-r--r--etc/rc20
-rw-r--r--etc/rc.d/devfs2
-rw-r--r--etc/rc.d/dumpon1
-rw-r--r--etc/rc.d/initrandom1
-rw-r--r--etc/rc.d/rcconf.sh12
-rw-r--r--etc/rc.d/resolv1
-rw-r--r--share/man/man5/rc.conf.529
-rw-r--r--share/man/man8/diskless.814
9 files changed, 58 insertions, 27 deletions
diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf
index 7f851ef..ddfa971 100644
--- a/etc/defaults/rc.conf
+++ b/etc/defaults/rc.conf
@@ -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.
diff --git a/etc/rc b/etc/rc
index a94d923..ea7d502 100644
--- a/etc/rc
+++ b/etc/rc
@@ -50,12 +50,6 @@ HOME=/
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 @@ if [ ${dlv:=0} -ne 0 -o -f /etc/diskless ]; then
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 @@ for _rc_elem in ${files}; do
run_rc_script ${_rc_elem} ${_boot}
case "$_rc_elem" in
- */mountcritremote) break ;;
+ */${early_late_divider}) break ;;
esac
done
@@ -101,7 +103,7 @@ _skip_early=1
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
;;
diff --git a/etc/rc.d/devfs b/etc/rc.d/devfs
index d74e988..e7a6071 100644
--- a/etc/rc.d/devfs
+++ b/etc/rc.d/devfs
@@ -4,7 +4,7 @@
#
# PROVIDE: devfs
-# REQUIRE: rcconf mountcritremote
+# REQUIRE: mountcritremote
# BEFORE: SERVERS securelevel
# KEYWORD: nojail
diff --git a/etc/rc.d/dumpon b/etc/rc.d/dumpon
index 7697eab..cc049ec 100644
--- a/etc/rc.d/dumpon
+++ b/etc/rc.d/dumpon
@@ -4,7 +4,6 @@
#
# PROVIDE: dumpon
-# REQUIRE: rcconf
# BEFORE: disks savecore initrandom
# KEYWORD: nojail
diff --git a/etc/rc.d/initrandom b/etc/rc.d/initrandom
index 2c8dc52..a336cb8 100644
--- a/etc/rc.d/initrandom
+++ b/etc/rc.d/initrandom
@@ -4,7 +4,6 @@
#
# PROVIDE: initrandom
-# REQUIRE: rcconf
# BEFORE: disks
# KEYWORD: nojail
diff --git a/etc/rc.d/rcconf.sh b/etc/rc.d/rcconf.sh
deleted file mode 100644
index fdcd95b..0000000
--- a/etc/rc.d/rcconf.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD$
-#
-
-# PROVIDE: rcconf
-# BEFORE: disks initrandom
-
-. /etc/rc.subr
-
-echo "Loading configuration files."
-load_rc_config 'XXX'
diff --git a/etc/rc.d/resolv b/etc/rc.d/resolv
index d2d6371..08e775f 100644
--- a/etc/rc.d/resolv
+++ b/etc/rc.d/resolv
@@ -28,7 +28,6 @@
#
# PROVIDE: resolv
-# REQUIRE: rcconf
# KEYWORD: nojail
. /etc/rc.subr
diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5
index 9abb684..cb4ad13 100644
--- a/share/man/man5/rc.conf.5
+++ b/share/man/man5/rc.conf.5
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd September 28, 2005
+.Dd December 10, 2005
.Dt RC.CONF 5
.Os
.Sh NAME
@@ -90,6 +90,33 @@ disable informational messages from the rc scripts.
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 needs remote file
+systems mounted to get access to the
+.Va local_startup
+directories; for example when
+.Pa /usr/local
+is NFS mounted.
+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
diff --git a/share/man/man8/diskless.8 b/share/man/man8/diskless.8
index 01b53d5..da302fd 100644
--- a/share/man/man8/diskless.8
+++ b/share/man/man8/diskless.8
@@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd September 28, 2004
+.Dd December 10, 2005
.Dt DISKLESS 8
.Os
.Sh NAME
@@ -248,6 +248,18 @@ scripts provide a mechanism through which you can override various files
in
.Pa /etc
(as well as other subdirectories of root).
+.Pp
+One difference that you should pay particular attention to is
+the value of
+.Va local_startup
+in
+.Pa /etc/defaults/rc.conf .
+A typical value for a
+.Nm
+boot is
+.Va mountcritremote ,
+however your needs may be different.
+.Pp
The scripts provide four
overriding directories situated in
.Pa /conf/base ,
OpenPOWER on IntegriCloud