Source-Changes-HG archive

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

[src/trunk]: src/etc/rc.d Split the local disk availability step into two pha...



details:   https://anonhg.NetBSD.org/src/rev/338051008f5c
branches:  trunk
changeset: 936238:338051008f5c
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Jul 22 16:50:41 2020 +0000

description:
Split the local disk availability step into two phases to allow scripts
that pre-populate parts of the system (e.g. a tmpfs based /var) an
easy place to plug in like:

# REQUIRE: mountcritlocal
# BEFORE: MOUNTCRITLOCAL

This also cleans up the existing special handling a bit by separating it
into new scripts. All later scripts now depend on MOUNTCRITLOCAL.
Discussed on tech-userlevel some time ago.

diffstat:

 distrib/sets/lists/etc/mi |   5 ++++-
 etc/rc                    |   8 ++++----
 etc/rc.d/MOUNTCRITLOCAL   |  10 ++++++++++
 etc/rc.d/Makefile         |   9 +++++----
 etc/rc.d/bootconf.sh      |   4 ++--
 etc/rc.d/clearcritlocal   |  26 ++++++++++++++++++++++++++
 etc/rc.d/dhcpcd           |   4 ++--
 etc/rc.d/ip6addrctl       |   4 ++--
 etc/rc.d/ipfilter         |   4 ++--
 etc/rc.d/ipsec            |   4 ++--
 etc/rc.d/iscsid           |   4 ++--
 etc/rc.d/llvmlockdir      |  27 +++++++++++++++++++++++++++
 etc/rc.d/mdnsd            |   4 ++--
 etc/rc.d/mountcritlocal   |  15 +--------------
 etc/rc.d/mountcritremote  |   4 ++--
 etc/rc.d/network          |   4 ++--
 etc/rc.d/npf              |   4 ++--
 etc/rc.d/npf_boot         |   4 ++--
 etc/rc.d/pf               |   4 ++--
 etc/rc.d/pf_boot          |   4 ++--
 etc/rc.d/random_seed      |   4 ++--
 etc/rc.d/route6d          |   4 ++--
 etc/rc.d/smtoff           |   4 ++--
 etc/rc.d/wpa_supplicant   |   4 ++--
 24 files changed, 111 insertions(+), 57 deletions(-)

diffs (truncated from 479 to 300 lines):

diff -r 2a527e288d3e -r 338051008f5c distrib/sets/lists/etc/mi
--- a/distrib/sets/lists/etc/mi Wed Jul 22 15:01:18 2020 +0000
+++ b/distrib/sets/lists/etc/mi Wed Jul 22 16:50:41 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.260 2020/06/15 01:57:30 christos Exp $
+# $NetBSD: mi,v 1.261 2020/07/22 16:50:41 martin Exp $
 #
 # Note: end-user configuration files that are moved to another location
 #      should not be marked "obsolete"; they should just be removed from
@@ -201,6 +201,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
@@ -243,6 +244,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
@@ -254,6 +256,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
diff -r 2a527e288d3e -r 338051008f5c etc/rc
--- a/etc/rc    Wed Jul 22 15:01:18 2020 +0000
+++ b/etc/rc    Wed Jul 22 16:50:41 2020 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: rc,v 1.173 2017/03/20 16:02:48 christos Exp $
+# $NetBSD: rc,v 1.174 2020/07/22 16:50:41 martin Exp $
 #
 # rc --
 #      Run the scripts in /etc/rc.d with rcorder, and log output
@@ -191,7 +191,7 @@
 #  * Scripts run during the boot may clear /tmp and/var/run, so even
 #    if they are writable, using those directories too early may be
 #    problematic.  We assume that it's safe to write to our log file
-#    after the mountcritlocal script has run.
+#    after the MOUNTCRITLOCAL script has run.
 #
 #  * /usr/bin/tee cannot be used because the /usr file system may not
 #    be mounted early in the boot.
@@ -322,10 +322,10 @@
                                printf "%s\n" "$msg"
                        fi
                fi
-               # After the mountcritlocal script has finished, it's
+               # After the MOUNTCRITLOCAL script has finished, it's
                # OK to flush the log to disk
                case "$1" in
-               */mountcritlocal)
+               */MOUNTCRITLOCAL)
                        rc_log_flush OK
                        ;;
                esac
diff -r 2a527e288d3e -r 338051008f5c etc/rc.d/MOUNTCRITLOCAL
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/etc/rc.d/MOUNTCRITLOCAL   Wed Jul 22 16:50:41 2020 +0000
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# $NetBSD: MOUNTCRITLOCAL,v 1.1 2020/07/22 16:50:41 martin Exp $
+#
+
+# REQUIRE: mountcritlocal
+# PROVIDE: MOUNTCRITLOCAL
+
+#      This is a dummy dependency, for services which require local
+#      disks to be mounted and fully setup
diff -r 2a527e288d3e -r 338051008f5c etc/rc.d/Makefile
--- a/etc/rc.d/Makefile Wed Jul 22 15:01:18 2020 +0000
+++ b/etc/rc.d/Makefile Wed Jul 22 16:50:41 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.106 2019/09/18 05:16:15 nonaka Exp $
+# $NetBSD: Makefile,v 1.107 2020/07/22 16:50:41 martin Exp $
 
 .include <bsd.own.mk>
 
@@ -17,7 +17,7 @@
                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 @@
                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 \
diff -r 2a527e288d3e -r 338051008f5c etc/rc.d/bootconf.sh
--- a/etc/rc.d/bootconf.sh      Wed Jul 22 15:01:18 2020 +0000
+++ b/etc/rc.d/bootconf.sh      Wed Jul 22 16:50:41 2020 +0000
@@ -1,10 +1,10 @@
 #!/bin/sh
 #
-# $NetBSD: bootconf.sh,v 1.16 2020/07/04 06:24:53 skrll Exp $
+# $NetBSD: bootconf.sh,v 1.17 2020/07/22 16:50:41 martin Exp $
 #
 
 # PROVIDE: bootconf
-# REQUIRE: mountcritlocal
+# REQUIRE: MOUNTCRITLOCAL
 # KEYWORD: interactive
 
 $_rc_subr_loaded . /etc/rc.subr
diff -r 2a527e288d3e -r 338051008f5c etc/rc.d/clearcritlocal
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/etc/rc.d/clearcritlocal   Wed Jul 22 16:50:41 2020 +0000
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# $NetBSD: clearcritlocal,v 1.1 2020/07/22 16:50:41 martin 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 -- *)
+       return 0
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff -r 2a527e288d3e -r 338051008f5c etc/rc.d/dhcpcd
--- a/etc/rc.d/dhcpcd   Wed Jul 22 15:01:18 2020 +0000
+++ b/etc/rc.d/dhcpcd   Wed Jul 22 16:50:41 2020 +0000
@@ -1,9 +1,9 @@
 #!/bin/sh
 
-# $NetBSD: dhcpcd,v 1.9 2020/05/31 12:58:09 roy Exp $
+# $NetBSD: dhcpcd,v 1.10 2020/07/22 16:50:41 martin Exp $
 
 # PROVIDE: dhcpcd
-# REQUIRE: network mountcritlocal
+# REQUIRE: network MOUNTCRITLOCAL
 # BEFORE:  NETWORKING
 
 $_rc_subr_loaded . /etc/rc.subr
diff -r 2a527e288d3e -r 338051008f5c etc/rc.d/ip6addrctl
--- a/etc/rc.d/ip6addrctl       Wed Jul 22 15:01:18 2020 +0000
+++ b/etc/rc.d/ip6addrctl       Wed Jul 22 16:50:41 2020 +0000
@@ -1,11 +1,11 @@
 #!/bin/sh
 #
-# $NetBSD: ip6addrctl,v 1.5 2020/02/14 12:12:07 kim Exp $
+# $NetBSD: ip6addrctl,v 1.6 2020/07/22 16:50:41 martin Exp $
 # FreeBSD: head/etc/rc.d/ip6addrctl 270836 2014-08-30 07:08:10Z hrs
 #
 
 # PROVIDE: ip6addrctl
-# REQUIRE: root bootconf mountcritlocal tty
+# REQUIRE: root bootconf MOUNTCRITLOCAL tty
 
 $_rc_subr_loaded . /etc/rc.subr
 
diff -r 2a527e288d3e -r 338051008f5c etc/rc.d/ipfilter
--- a/etc/rc.d/ipfilter Wed Jul 22 15:01:18 2020 +0000
+++ b/etc/rc.d/ipfilter Wed Jul 22 16:50:41 2020 +0000
@@ -1,10 +1,10 @@
 #!/bin/sh
 #
-# $NetBSD: ipfilter,v 1.19 2020/07/04 06:24:53 skrll Exp $
+# $NetBSD: ipfilter,v 1.20 2020/07/22 16:50:41 martin Exp $
 #
 
 # PROVIDE: ipfilter
-# REQUIRE: root bootconf mountcritlocal tty
+# REQUIRE: root bootconf MOUNTCRITLOCAL tty
 
 $_rc_subr_loaded . /etc/rc.subr
 
diff -r 2a527e288d3e -r 338051008f5c etc/rc.d/ipsec
--- a/etc/rc.d/ipsec    Wed Jul 22 15:01:18 2020 +0000
+++ b/etc/rc.d/ipsec    Wed Jul 22 16:50:41 2020 +0000
@@ -1,10 +1,10 @@
 #!/bin/sh
 #
-# $NetBSD: ipsec,v 1.16 2020/01/27 08:28:33 kim Exp $
+# $NetBSD: ipsec,v 1.17 2020/07/22 16:50:41 martin Exp $
 #
 
 # PROVIDE: ipsec
-# REQUIRE: root bootconf mountcritlocal tty
+# REQUIRE: root bootconf MOUNTCRITLOCAL tty
 # BEFORE:  DAEMON
 
 $_rc_subr_loaded . /etc/rc.subr
diff -r 2a527e288d3e -r 338051008f5c etc/rc.d/iscsid
--- a/etc/rc.d/iscsid   Wed Jul 22 15:01:18 2020 +0000
+++ b/etc/rc.d/iscsid   Wed Jul 22 16:50:41 2020 +0000
@@ -1,10 +1,10 @@
 #!/bin/sh
 #
-# $NetBSD: iscsid,v 1.1 2015/02/21 23:13:00 joerg Exp $
+# $NetBSD: iscsid,v 1.2 2020/07/22 16:50:41 martin Exp $
 #
 
 # PROVIDE: iscsid
-# REQUIRE: NETWORKING mountcritlocal
+# REQUIRE: NETWORKING MOUNTCRITLOCAL
 # BEFORE:  securelevel mountcritremote
 
 $_rc_subr_loaded . /etc/rc.subr
diff -r 2a527e288d3e -r 338051008f5c etc/rc.d/llvmlockdir
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/etc/rc.d/llvmlockdir      Wed Jul 22 16:50:41 2020 +0000
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# $NetBSD: llvmlockdir,v 1.1 2020/07/22 16:50:41 martin 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
+       return 0
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff -r 2a527e288d3e -r 338051008f5c etc/rc.d/mdnsd
--- a/etc/rc.d/mdnsd    Wed Jul 22 15:01:18 2020 +0000
+++ b/etc/rc.d/mdnsd    Wed Jul 22 16:50:41 2020 +0000
@@ -1,10 +1,10 @@
 #!/bin/sh
 #
-# $NetBSD: mdnsd,v 1.4 2020/07/04 06:24:53 skrll Exp $
+# $NetBSD: mdnsd,v 1.5 2020/07/22 16:50:41 martin Exp $
 #
 
 # PROVIDE: mdnsd
-# REQUIRE: network mountcritlocal staticroute
+# REQUIRE: network MOUNTCRITLOCAL staticroute
 # BEFORE:  NETWORKING
 
 $_rc_subr_loaded . /etc/rc.subr
diff -r 2a527e288d3e -r 338051008f5c etc/rc.d/mountcritlocal
--- a/etc/rc.d/mountcritlocal   Wed Jul 22 15:01:18 2020 +0000
+++ b/etc/rc.d/mountcritlocal   Wed Jul 22 16:50:41 2020 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: mountcritlocal,v 1.15 2016/07/23 01:38:35 kre Exp $
+# $NetBSD: mountcritlocal,v 1.16 2020/07/22 16:50:41 martin Exp $
 #
 
 # PROVIDE: mountcritlocal
@@ -19,19 +19,6 @@
        #       This usually includes /var.
        #
        mount_critical_filesystems local || return $?
-



Home | Main Index | Thread Index | Old Index