[Midnightbsd-cvs] src [11772] trunk/etc/rc: add firstboot logic
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Wed Jul 11 12:29:59 EDT 2018
Revision: 11772
http://svnweb.midnightbsd.org/src/?rev=11772
Author: laffer1
Date: 2018-07-11 12:29:59 -0400 (Wed, 11 Jul 2018)
Log Message:
-----------
add firstboot logic
Modified Paths:
--------------
trunk/etc/rc
Property Changed:
----------------
trunk/etc/rc
Modified: trunk/etc/rc
===================================================================
--- trunk/etc/rc 2018-07-11 14:42:15 UTC (rev 11771)
+++ trunk/etc/rc 2018-07-11 16:29:59 UTC (rev 11772)
@@ -25,7 +25,8 @@
# SUCH DAMAGE.
#
# @(#)rc 5.27 (Berkeley) 6/5/91
-# $MidnightBSD: src/etc/rc,v 1.4 2011/05/03 13:30:22 laffer1 Exp $
+# $MidnightBSD$
+#
# System startup script run by init on autoboot
# or after single-user.
@@ -70,6 +71,11 @@
. /etc/rc.subr
load_rc_config 'XXX'
+# If we receive a SIGALRM, re-source /etc/rc.conf; this allows rc.d
+# scripts to perform "boot-time configuration" including enabling and
+# disabling rc.d scripts which appear later in the boot order.
+trap "_rc_conf_loaded=false; load_rc_config 'XXX'" ALRM
+
skip="-s nostart"
if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; then
skip="$skip -s nojail"
@@ -81,10 +87,15 @@
fi
fi
+# If the firstboot sentinel doesn't exist, we want to skip firstboot scripts.
+if ! [ -e ${firstboot_sentinel} ]; then
+ skip_firstboot="-s firstboot"
+fi
+
# 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`
+files=`rcorder ${skip} ${skip_firstboot} /etc/rc.d/* 2>/dev/null`
_rc_elem_done=' '
for _rc_elem in ${files}; do
@@ -106,7 +117,13 @@
*) find_local_scripts_new ;;
esac
-files=`rcorder ${skip} /etc/rc.d/* ${local_rc} 2>/dev/null`
+# The firstboot sentinel might be on a newly mounted filesystem; look for it
+# again and unset skip_firstboot if we find it.
+if [ -e ${firstboot_sentinel} ]; then
+ skip_firstboot=""
+fi
+
+files=`rcorder ${skip} ${skip_firstboot} /etc/rc.d/* ${local_rc} 2>/dev/null`
for _rc_elem in ${files}; do
case "$_rc_elem_done" in
*" $_rc_elem "*) continue ;;
@@ -115,6 +132,15 @@
run_rc_script ${_rc_elem} ${_boot}
done
+# Remove the firstboot sentinel, and reboot if it was requested.
+if [ -e ${firstboot_sentinel} ]; then
+ rm ${firstboot_sentinel}
+ if [ -e ${firstboot_sentinel}-reboot ]; then
+ rm ${firstboot_sentinel}-reboot
+ kill -INT 1
+ fi
+fi
+
echo ''
date
exit 0
Property changes on: trunk/etc/rc
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
More information about the Midnightbsd-cvs
mailing list