tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: mountcritlocal rcorder (Was: Restrict mtree to specific directories)



I implemented the split and it works nicely for me.

I can now just add things like "populate_var" into rc.d which REQUIRE:
mountcritlocal and have BEFORE: MOUNTCRITLOCAL to fill the /var tmpfs
that has just been mounted.

While there I found that random_seed play special tricks and we might
consider moving it in this new section as well, or add another stage
in between, like:

	mountcritlocal -> [various] -> MOUNTCRITLOCAL1
	 -> random_seed -> MOUNTCRITLOCAL

Martin
Index: distrib/sets/lists/etc/mi
===================================================================
RCS file: /cvsroot/src/distrib/sets/lists/etc/mi,v
retrieving revision 1.259
diff -u -p -r1.259 mi
--- distrib/sets/lists/etc/mi	15 Sep 2019 19:38:08 -0000	1.259
+++ distrib/sets/lists/etc/mi	7 Jun 2020 19:21:19 -0000
@@ -200,6 +200,7 @@
 ./etc/rc.d/btuartd				etc-obsolete		obsolete
 ./etc/rc.d/ccd					etc-sys-rc
 ./etc/rc.d/cgd					etc-sys-rc
+./etc/rc.d/clearcritlocal				etc-sys-rc
 ./etc/rc.d/cleartmp				etc-sys-rc
 ./etc/rc.d/cron					etc-cron-rc
 ./etc/rc.d/devpubd				etc-sys-rc
@@ -242,6 +243,7 @@
 ./etc/rc.d/lkm1					etc-obsolete		obsolete
 ./etc/rc.d/lkm2					etc-obsolete		obsolete
 ./etc/rc.d/lkm3					etc-obsolete		obsolete
+./etc/rc.d/llvmlockdir				etc-sys-rc
 ./etc/rc.d/local				etc-sys-rc
 ./etc/rc.d/lpd					etc-lpr-rc
 ./etc/rc.d/lvm					etc-sys-rc
@@ -253,6 +255,7 @@
 ./etc/rc.d/motd					etc-sys-rc
 ./etc/rc.d/mountall				etc-sys-rc
 ./etc/rc.d/mountcritlocal			etc-sys-rc
+./etc/rc.d/MOUNTCRITLOCAL			etc-sys-rc
 ./etc/rc.d/mountcritremote			etc-sys-rc
 ./etc/rc.d/mountd				etc-nfsserver-rc
 ./etc/rc.d/moused				etc-sysutil-rc
Index: etc/rc.d/MOUNTCRITLOCAL
===================================================================
RCS file: etc/rc.d/MOUNTCRITLOCAL
diff -N etc/rc.d/MOUNTCRITLOCAL
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ etc/rc.d/MOUNTCRITLOCAL	7 Jun 2020 19:21:19 -0000
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# $NetBSD: NETWORKING,v 1.2 2002/03/22 04:33:57 thorpej Exp $
+#
+
+# REQUIRE: mountcritlocal
+# PROVIDE: MOUNTCRITLOCAL
+
+#	This is a dummy dependency, for services which require local
+#	disks to be mounted and fully setup
Index: etc/rc.d/Makefile
===================================================================
RCS file: /cvsroot/src/etc/rc.d/Makefile,v
retrieving revision 1.106
diff -u -p -r1.106 Makefile
--- etc/rc.d/Makefile	18 Sep 2019 05:16:15 -0000	1.106
+++ etc/rc.d/Makefile	7 Jun 2020 19:21:19 -0000
@@ -17,7 +17,7 @@ CONFIGFILES=\
 		DAEMON DISKS LOGIN NETWORKING SERVERS \
 		accounting altqd amd apmd automount automountd autounmountd \
 		bluetooth bootconf.sh bootparams \
-		ccd cgd cleartmp cron \
+		ccd cgd clearcritlocal cleartmp cron \
 		devpubd dhcpcd dhcpd dhcpd6 dhcrelay dmesg \
 		downinterfaces \
 		envsys \
@@ -27,9 +27,10 @@ CONFIGFILES=\
 		identd ifwatchd inetd ip6addrctl ipfilter ipfs ipmon ipnat \
 		ipsec irdaattach iscsi_target iscsid isibootd \
 		kdc \
-		ldconfig ldpd local lpd lvm \
+		ldconfig ldpd llvmlockdir local lpd lvm \
 		makemandb mdnsd mixerctl modules mopd motd mountall \
-		mountcritlocal mountcritremote mountd moused mrouted \
+		mountcritlocal MOUNTCRITLOCAL \
+		mountcritremote mountd moused mrouted \
 		named ndbootd network newsyslog nfsd nfslocking npf npf_boot \
 		npfd ntpd ntpdate \
 		perusertmp pf pf_boot pflogd postfix powerd ppp pwcheck \
Index: etc/rc.d/bootconf.sh
===================================================================
RCS file: /cvsroot/src/etc/rc.d/bootconf.sh,v
retrieving revision 1.15
diff -u -p -r1.15 bootconf.sh
--- etc/rc.d/bootconf.sh	31 Dec 2012 23:21:27 -0000	1.15
+++ etc/rc.d/bootconf.sh	7 Jun 2020 19:21:19 -0000
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: bootconf
-# REQUIRE: mountcritlocal
+# REQUIRE: MOUNTCRITLOCAL
 # KEYWORD: interactive
 
 $_rc_subr_loaded . /etc/rc.subr
Index: etc/rc.d/clearcritlocal
===================================================================
RCS file: etc/rc.d/clearcritlocal
diff -N etc/rc.d/clearcritlocal
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ etc/rc.d/clearcritlocal	7 Jun 2020 19:21:19 -0000
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# $NetBSD: mountcritlocal,v 1.15 2016/07/23 01:38:35 kre Exp $
+#
+
+# REQUIRE: mountcritlocal
+# BEFORE: MOUNTCRITLOCAL
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="clearcritlocal"
+start_cmd="clearcritlocal_start"
+stop_cmd=":"
+
+clearcritlocal_start()
+{
+	#	clean up left-over files.
+	#	this could include the cleanup of lock files and /var/run, etc.
+	#
+	rm -f /etc/nologin /var/spool/lock/LCK.*
+	test -d /var/run && (cd /var/run && rm -rf -- *)
+}
+
+load_rc_config $name
+run_rc_command "$1"
Index: etc/rc.d/dhcpcd
===================================================================
RCS file: /cvsroot/src/etc/rc.d/dhcpcd,v
retrieving revision 1.9
diff -u -p -r1.9 dhcpcd
--- etc/rc.d/dhcpcd	31 May 2020 12:58:09 -0000	1.9
+++ etc/rc.d/dhcpcd	7 Jun 2020 19:21:19 -0000
@@ -3,7 +3,7 @@
 # $NetBSD: dhcpcd,v 1.9 2020/05/31 12:58:09 roy Exp $
 
 # PROVIDE: dhcpcd
-# REQUIRE: network mountcritlocal
+# REQUIRE: network MOUNTCRITLOCAL
 # BEFORE:  NETWORKING
 
 $_rc_subr_loaded . /etc/rc.subr
Index: etc/rc.d/ip6addrctl
===================================================================
RCS file: /cvsroot/src/etc/rc.d/ip6addrctl,v
retrieving revision 1.5
diff -u -p -r1.5 ip6addrctl
--- etc/rc.d/ip6addrctl	14 Feb 2020 12:12:07 -0000	1.5
+++ etc/rc.d/ip6addrctl	7 Jun 2020 19:21:19 -0000
@@ -5,7 +5,7 @@
 #
 
 # PROVIDE: ip6addrctl
-# REQUIRE: root bootconf mountcritlocal tty
+# REQUIRE: root bootconf MOUNTCRITLOCAL tty
 
 $_rc_subr_loaded . /etc/rc.subr
 
Index: etc/rc.d/ipfilter
===================================================================
RCS file: /cvsroot/src/etc/rc.d/ipfilter,v
retrieving revision 1.18
diff -u -p -r1.18 ipfilter
--- etc/rc.d/ipfilter	23 Mar 2009 18:52:02 -0000	1.18
+++ etc/rc.d/ipfilter	7 Jun 2020 19:21:19 -0000
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: ipfilter
-# REQUIRE: root bootconf mountcritlocal tty
+# REQUIRE: root bootconf MOUNTCRITLOCAL tty
 
 $_rc_subr_loaded . /etc/rc.subr
 
Index: etc/rc.d/ipsec
===================================================================
RCS file: /cvsroot/src/etc/rc.d/ipsec,v
retrieving revision 1.16
diff -u -p -r1.16 ipsec
--- etc/rc.d/ipsec	27 Jan 2020 08:28:33 -0000	1.16
+++ etc/rc.d/ipsec	7 Jun 2020 19:21:19 -0000
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: ipsec
-# REQUIRE: root bootconf mountcritlocal tty
+# REQUIRE: root bootconf MOUNTCRITLOCAL tty
 # BEFORE:  DAEMON
 
 $_rc_subr_loaded . /etc/rc.subr
Index: etc/rc.d/iscsid
===================================================================
RCS file: /cvsroot/src/etc/rc.d/iscsid,v
retrieving revision 1.1
diff -u -p -r1.1 iscsid
--- etc/rc.d/iscsid	21 Feb 2015 23:13:00 -0000	1.1
+++ etc/rc.d/iscsid	7 Jun 2020 19:21:19 -0000
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: iscsid
-# REQUIRE: NETWORKING mountcritlocal
+# REQUIRE: NETWORKING MOUNTCRITLOCAL
 # BEFORE:  securelevel mountcritremote
 
 $_rc_subr_loaded . /etc/rc.subr
Index: etc/rc.d/llvmlockdir
===================================================================
RCS file: etc/rc.d/llvmlockdir
diff -N etc/rc.d/llvmlockdir
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ etc/rc.d/llvmlockdir	7 Jun 2020 19:21:19 -0000
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# $NetBSD: mountcritlocal,v 1.15 2016/07/23 01:38:35 kre Exp $
+#
+
+# REQUIRE: mountcritlocal
+# BEFORE: MOUNTCRITLOCAL
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="llvmlockdir"
+start_cmd="llvmlockdir_start"
+stop_cmd=":"
+
+llvmlockdir_start()
+{
+	#       create LVM locking directory, it needs to be owned by operator
+	#	group and has parmissions to allow lock file creation.
+	#
+	mkdir -p /var/run/lvm
+	chown root:operator /var/run/lvm
+	chmod 770 /var/run/lvm
+}
+
+load_rc_config $name
+run_rc_command "$1"
Index: etc/rc.d/mdnsd
===================================================================
RCS file: /cvsroot/src/etc/rc.d/mdnsd,v
retrieving revision 1.3
diff -u -p -r1.3 mdnsd
--- etc/rc.d/mdnsd	15 Oct 2015 16:47:28 -0000	1.3
+++ etc/rc.d/mdnsd	7 Jun 2020 19:21:19 -0000
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: mdnsd
-# REQUIRE: network mountcritlocal staticroute
+# REQUIRE: network MOUNTCRITLOCAL staticroute
 # BEFORE:  NETWORKING
 
 $_rc_subr_loaded . /etc/rc.subr
Index: etc/rc.d/mountcritlocal
===================================================================
RCS file: /cvsroot/src/etc/rc.d/mountcritlocal,v
retrieving revision 1.15
diff -u -p -r1.15 mountcritlocal
--- etc/rc.d/mountcritlocal	23 Jul 2016 01:38:35 -0000	1.15
+++ etc/rc.d/mountcritlocal	7 Jun 2020 19:21:19 -0000
@@ -19,19 +19,6 @@ mountcritlocal_start()
 	#	This usually includes /var.
 	#
 	mount_critical_filesystems local || return $?
-
-	#	clean up left-over files.
-	#	this could include the cleanup of lock files and /var/run, etc.
-	#
-	rm -f /etc/nologin /var/spool/lock/LCK.*
-	test -d /var/run && (cd /var/run && rm -rf -- *)
-
-	#       create LVM locking directory, it needs to be owned by operator
-	#	group and has parmissions to allow lock file creation.
-	#
-	mkdir -p /var/run/lvm
-	chown root:operator /var/run/lvm
-	chmod 770 /var/run/lvm
 	return 0
 }
 
Index: etc/rc.d/mountcritremote
===================================================================
RCS file: /cvsroot/src/etc/rc.d/mountcritremote,v
retrieving revision 1.9
diff -u -p -r1.9 mountcritremote
--- etc/rc.d/mountcritremote	22 Jul 2014 17:11:09 -0000	1.9
+++ etc/rc.d/mountcritremote	7 Jun 2020 19:21:19 -0000
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: mountcritremote
-# REQUIRE: NETWORKING root mountcritlocal
+# REQUIRE: NETWORKING root MOUNTCRITLOCAL
 
 $_rc_subr_loaded . /etc/rc.subr
 
Index: etc/rc.d/network
===================================================================
RCS file: /cvsroot/src/etc/rc.d/network,v
retrieving revision 1.78
diff -u -p -r1.78 network
--- etc/rc.d/network	15 Apr 2020 20:31:57 -0000	1.78
+++ etc/rc.d/network	7 Jun 2020 19:21:19 -0000
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: network
-# REQUIRE: ipfilter ipsec mountcritlocal root tty sysctl
+# REQUIRE: ipfilter ipsec MOUNTCRITLOCAL root tty sysctl
 # BEFORE:  NETWORKING
 
 $_rc_subr_loaded . /etc/rc.subr
Index: etc/rc.d/npf
===================================================================
RCS file: /cvsroot/src/etc/rc.d/npf,v
retrieving revision 1.4
diff -u -p -r1.4 npf
--- etc/rc.d/npf	19 Apr 2019 18:36:25 -0000	1.4
+++ etc/rc.d/npf	7 Jun 2020 19:21:19 -0000
@@ -6,7 +6,7 @@
 #
 
 # PROVIDE: npf
-# REQUIRE: root bootconf mountcritlocal tty network
+# REQUIRE: root bootconf MOUNTCRITLOCAL tty network
 # BEFORE: NETWORKING
 
 $_rc_subr_loaded . /etc/rc.subr
Index: etc/rc.d/npf_boot
===================================================================
RCS file: /cvsroot/src/etc/rc.d/npf_boot,v
retrieving revision 1.2
diff -u -p -r1.2 npf_boot
--- etc/rc.d/npf_boot	5 Oct 2019 22:21:29 -0000	1.2
+++ etc/rc.d/npf_boot	7 Jun 2020 19:21:19 -0000
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: npf_boot
-# REQUIRE: root bootconf mountcritlocal tty
+# REQUIRE: root bootconf MOUNTCRITLOCAL tty
 # BEFORE: network
 
 $_rc_subr_loaded . /etc/rc.subr
Index: etc/rc.d/pf
===================================================================
RCS file: /cvsroot/src/etc/rc.d/pf,v
retrieving revision 1.11
diff -u -p -r1.11 pf
--- etc/rc.d/pf	29 Jun 2018 12:34:15 -0000	1.11
+++ etc/rc.d/pf	7 Jun 2020 19:21:19 -0000
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: pf
-# REQUIRE: root bootconf mountcritlocal tty network dhcpcd
+# REQUIRE: root bootconf MOUNTCRITLOCAL tty network dhcpcd
 # BEFORE: NETWORKING
 
 $_rc_subr_loaded . /etc/rc.subr
Index: etc/rc.d/pf_boot
===================================================================
RCS file: /cvsroot/src/etc/rc.d/pf_boot,v
retrieving revision 1.5
diff -u -p -r1.5 pf_boot
--- etc/rc.d/pf_boot	5 Oct 2019 22:21:29 -0000	1.5
+++ etc/rc.d/pf_boot	7 Jun 2020 19:21:19 -0000
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: pf_boot
-# REQUIRE: root bootconf mountcritlocal tty
+# REQUIRE: root bootconf MOUNTCRITLOCAL tty
 # BEFORE: network
 
 $_rc_subr_loaded . /etc/rc.subr
Index: etc/rc.d/random_seed
===================================================================
RCS file: /cvsroot/src/etc/rc.d/random_seed,v
retrieving revision 1.13
diff -u -p -r1.13 random_seed
--- etc/rc.d/random_seed	7 May 2020 20:01:04 -0000	1.13
+++ etc/rc.d/random_seed	7 Jun 2020 19:21:19 -0000
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: random_seed
-# REQUIRE: mountcritlocal
+# REQUIRE: MOUNTCRITLOCAL
 # BEFORE: securelevel
 # BEFORE: bootconf
 # KEYWORD: shutdown
Index: etc/rc.d/route6d
===================================================================
RCS file: /cvsroot/src/etc/rc.d/route6d,v
retrieving revision 1.9
diff -u -p -r1.9 route6d
--- etc/rc.d/route6d	18 Aug 2011 16:46:14 -0000	1.9
+++ etc/rc.d/route6d	7 Jun 2020 19:21:19 -0000
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: route6d
-# REQUIRE: network mountcritlocal
+# REQUIRE: network MOUNTCRITLOCAL
 # BEFORE:  NETWORKING
 
 $_rc_subr_loaded . /etc/rc.subr
Index: etc/rc.d/smtoff
===================================================================
RCS file: /cvsroot/src/etc/rc.d/smtoff,v
retrieving revision 1.4
diff -u -p -r1.4 smtoff
--- etc/rc.d/smtoff	13 May 2019 18:53:10 -0000	1.4
+++ etc/rc.d/smtoff	7 Jun 2020 19:21:19 -0000
@@ -6,7 +6,7 @@
 #
 
 # PROVIDE: smtoff
-# REQUIRE: root bootconf mountcritlocal tty
+# REQUIRE: root bootconf MOUNTCRITLOCAL tty
 
 $_rc_subr_loaded . /etc/rc.subr
 
Index: etc/rc.d/wpa_supplicant
===================================================================
RCS file: /cvsroot/src/etc/rc.d/wpa_supplicant,v
retrieving revision 1.7
diff -u -p -r1.7 wpa_supplicant
--- etc/rc.d/wpa_supplicant	29 Jun 2018 12:34:15 -0000	1.7
+++ etc/rc.d/wpa_supplicant	7 Jun 2020 19:21:19 -0000
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: wpa_supplicant
-# REQUIRE: network mountcritlocal
+# REQUIRE: network MOUNTCRITLOCAL
 # BEFORE:  NETWORKING dhcpcd
 #
 #	We need to run a command that resides in /usr/sbin, and the


Home | Main Index | Thread Index | Old Index