From 0c8230694b82c48e72c312293ae43c10c6681629 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Thu, 11 Dec 2003 23:28:41 +0000 Subject: [PATCH] Adjust rc.subr to generate system-wide varsyms tracking RCNG operations. This will allow us to support run-time dependancy management. Have dummy rc files (that exist just to specify dependancies) call a dummy command routine which will set the appropriate varsym variables representing the keywords they provide. --- etc/rc.d/DAEMON | 6 +++++- etc/rc.d/LOGIN | 4 +++- etc/rc.d/Makefile | 22 +++++++++++++--------- etc/rc.d/NETWORKING | 6 +++++- etc/rc.d/SERVERS | 5 ++++- etc/rc.d/archdep | 5 ++++- etc/rc.d/atm2.sh | 3 ++- etc/rc.d/atm3.sh | 3 ++- etc/rc.d/bootconf.sh | 7 ++++++- etc/rc.d/cleanvar | 6 +++++- etc/rc.d/diskless | 7 ++++++- etc/rc.d/downinterfaces | 3 ++- etc/rc.d/early.sh | 6 +++++- etc/rc.d/initdiskless | 4 +++- etc/rc.d/msgs | 5 ++++- etc/rc.d/netoptions | 4 +++- etc/rc.d/network3 | 3 ++- etc/rc.d/othermta | 4 ++-- etc/rc.d/rcconf.sh | 3 ++- etc/rc.d/savecore | 19 +++++++++++++------ etc/rc.d/serial | 5 ++++- 21 files changed, 95 insertions(+), 35 deletions(-) diff --git a/etc/rc.d/DAEMON b/etc/rc.d/DAEMON index 96349cc7bb..7269e88310 100644 --- a/etc/rc.d/DAEMON +++ b/etc/rc.d/DAEMON @@ -2,7 +2,7 @@ # # $NetBSD: DAEMON,v 1.8 2002/03/22 04:33:57 thorpej Exp $ # $FreeBSD: src/etc/rc.d/DAEMON,v 1.3 2002/10/12 13:49:20 schweikh Exp $ -# $DragonFly: src/etc/rc.d/DAEMON,v 1.1 2003/07/24 06:35:37 dillon Exp $ +# $DragonFly: src/etc/rc.d/DAEMON,v 1.2 2003/12/11 23:28:41 dillon Exp $ # # PROVIDE: DAEMON @@ -11,3 +11,7 @@ # This is a dummy dependency, to ensure that general purpose daemons # are run _after_ the above are. + +. /etc/rc.subr +dummy_rc_command "$1" + diff --git a/etc/rc.d/LOGIN b/etc/rc.d/LOGIN index 857a93d28d..e3b9637932 100644 --- a/etc/rc.d/LOGIN +++ b/etc/rc.d/LOGIN @@ -2,7 +2,7 @@ # # $NetBSD: LOGIN,v 1.7 2002/03/22 04:33:57 thorpej Exp $ # $FreeBSD: src/etc/rc.d/LOGIN,v 1.3 2002/10/12 13:49:20 schweikh Exp $ -# $DragonFly: src/etc/rc.d/LOGIN,v 1.1 2003/07/24 06:35:37 dillon Exp $ +# $DragonFly: src/etc/rc.d/LOGIN,v 1.2 2003/12/11 23:28:41 dillon Exp $ # # PROVIDE: LOGIN @@ -14,3 +14,5 @@ # the administrator has increased the system security level and # wants to delay user logins until the system is (almost) fully # operational. +. /etc/rc.subr +dummy_rc_command "$1" diff --git a/etc/rc.d/Makefile b/etc/rc.d/Makefile index 567ca1b260..6a516eb1e7 100644 --- a/etc/rc.d/Makefile +++ b/etc/rc.d/Makefile @@ -1,27 +1,31 @@ # $NetBSD: Makefile,v 1.16 2001/01/14 15:37:22 minoura Exp $ # $FreeBSD: src/etc/rc.d/Makefile,v 1.20 2003/06/29 05:15:57 mtm Exp $ -# $DragonFly: src/etc/rc.d/Makefile,v 1.2 2003/08/08 11:55:19 rob Exp $ +# $DragonFly: src/etc/rc.d/Makefile,v 1.3 2003/12/11 23:28:41 dillon Exp $ .include # note: bgfsk, devd, devfs, and lomac left out (from 5.0) # -FILES= DAEMON LOGIN NETWORKING SERVERS abi accounting addswap adjkerntz amd \ - apm apmd archdep atm1 atm2.sh atm3.sh bootparams ccd cleanvar \ +FILES= DAEMON LOGIN NETWORKING SERVERS abi accounting addswap adjkerntz \ + altqd amd \ + apm apmd archdep atm1 atm2.sh atm3.sh \ + bootconf.sh bootparams ccd cleanvar \ cleartmp cron dhclient diskless dmesg dumpon fsck \ hostname inetd initdiskless initrandom ip6fw ipfilter ipfs ipfw ipmon \ ipnat ipsec ipxrouted isdnd jail \ kadmind kerberos keyserv kldxref kpasswdd \ - ldconfig local localdaemons lpd \ - motd mountcritlocal mountcritremote \ + ldconfig lkm1 lkm2 lkm3 local localdaemons lpd \ + motd mountall mountcritlocal mountcritremote \ mountd moused mroute6d mrouted msgs \ - named netif netoptions network1 network2 network3 \ + named netif netoptions network network1 network2 network3 \ network_ipv6 nfsclient nfsd nfslocking nfsserver nisdomain ntpd \ - ntpdate othermta pccard pcvt ppp-user pppoed pwcheck quota random \ + ntpdate othermta pccard pcvt ppp ppp-user pppoed pwcheck quota random \ rarpd rcconf.sh root route6d routed routing rpcbind rtadvd rwho \ - sysdb savecore securelevel sendmail serial sppp sshd swap1 syscons sysctl \ + sysdb savecore securelevel sendmail serial sppp sshd swap1 \ + syscons sysctl \ syslogd timed ttys usbd vinum virecover watchdogd ypbind \ - yppasswdd ypserv ypset ypupdated ypxfrd + yppasswdd ypserv ypset ypupdated ypxfrd \ + wscons FILESDIR= /etc/rc.d FILESMODE= ${BINMODE} diff --git a/etc/rc.d/NETWORKING b/etc/rc.d/NETWORKING index 147cee9609..e075dc2071 100644 --- a/etc/rc.d/NETWORKING +++ b/etc/rc.d/NETWORKING @@ -2,7 +2,7 @@ # # $NetBSD: NETWORKING,v 1.2 2002/03/22 04:33:57 thorpej Exp $ # $FreeBSD: src/etc/rc.d/NETWORKING,v 1.6 2003/06/29 05:15:57 mtm Exp $ -# $DragonFly: src/etc/rc.d/NETWORKING,v 1.1 2003/07/24 06:35:37 dillon Exp $ +# $DragonFly: src/etc/rc.d/NETWORKING,v 1.2 2003/12/11 23:28:41 dillon Exp $ # # PROVIDE: NETWORKING NETWORK @@ -12,3 +12,7 @@ # This is a dummy dependency, for services which require networking # to be operational before starting. + +. /etc/rc.subr +dummy_rc_command "$1" + diff --git a/etc/rc.d/SERVERS b/etc/rc.d/SERVERS index e7f4c0843e..8462b98756 100644 --- a/etc/rc.d/SERVERS +++ b/etc/rc.d/SERVERS @@ -2,7 +2,7 @@ # # $NetBSD: SERVERS,v 1.9 2002/03/22 04:33:57 thorpej Exp $ # $FreeBSD: src/etc/rc.d/SERVERS,v 1.3 2002/10/12 13:49:21 schweikh Exp $ -# $DragonFly: src/etc/rc.d/SERVERS,v 1.1 2003/07/24 06:35:37 dillon Exp $ +# $DragonFly: src/etc/rc.d/SERVERS,v 1.2 2003/12/11 23:28:41 dillon Exp $ # # PROVIDE: SERVERS @@ -11,3 +11,6 @@ # This is a dummy dependency, for early-start servers relying on # some basic configuration. +. /etc/rc.subr +dummy_rc_command "$1" + diff --git a/etc/rc.d/archdep b/etc/rc.d/archdep index d40a5970b3..06afb7f3b0 100644 --- a/etc/rc.d/archdep +++ b/etc/rc.d/archdep @@ -1,7 +1,7 @@ #!/bin/sh # # $FreeBSD: src/etc/rc.d/archdep,v 1.5 2003/05/06 00:09:51 obrien Exp $ -# $DragonFly: src/etc/rc.d/Attic/archdep,v 1.1 2003/07/24 06:35:37 dillon Exp $ +# $DragonFly: src/etc/rc.d/Attic/archdep,v 1.2 2003/12/11 23:28:41 dillon Exp $ # # PROVIDE: archdep @@ -68,4 +68,7 @@ ia64) unaligned_warnings ;; esac + +dummy_rc_command "$1" + echo '.' diff --git a/etc/rc.d/atm2.sh b/etc/rc.d/atm2.sh index 8d2cb1c92d..29b6a33b0c 100644 --- a/etc/rc.d/atm2.sh +++ b/etc/rc.d/atm2.sh @@ -25,7 +25,7 @@ # SUCH DAMAGE. # # $FreeBSD: src/etc/rc.d/atm2.sh,v 1.13 2003/06/29 05:15:57 mtm Exp $ -# $DragonFly: src/etc/rc.d/atm2.sh,v 1.1 2003/07/24 06:35:37 dillon Exp $ +# $DragonFly: src/etc/rc.d/atm2.sh,v 1.2 2003/12/11 23:28:41 dillon Exp $ # # PROVIDE: atm2 @@ -38,6 +38,7 @@ # . /etc/rc.subr +dummy_rc_command "$1" atm2_start() { diff --git a/etc/rc.d/atm3.sh b/etc/rc.d/atm3.sh index ac45881d78..708e4e4725 100644 --- a/etc/rc.d/atm3.sh +++ b/etc/rc.d/atm3.sh @@ -25,7 +25,7 @@ # SUCH DAMAGE. # # $FreeBSD: src/etc/rc.d/atm3.sh,v 1.10 2002/06/13 22:14:36 gordon Exp $ -# $DragonFly: src/etc/rc.d/atm3.sh,v 1.1 2003/07/24 06:35:37 dillon Exp $ +# $DragonFly: src/etc/rc.d/atm3.sh,v 1.2 2003/12/11 23:28:41 dillon Exp $ # # Start ATM daemons @@ -39,6 +39,7 @@ # KEYWORD: DragonFly FreeBSD . /etc/rc.subr +dummy_rc_command "$1" atm3_start() { diff --git a/etc/rc.d/bootconf.sh b/etc/rc.d/bootconf.sh index 592e4a7347..9d7f4316fc 100644 --- a/etc/rc.d/bootconf.sh +++ b/etc/rc.d/bootconf.sh @@ -2,12 +2,14 @@ # # $NetBSD: bootconf.sh,v 1.5 2002/03/25 03:22:10 wiz Exp $ # $FreeBSD: src/etc/rc.d/bootconf.sh,v 1.4 2002/10/12 10:31:31 schweikh Exp $ -# $DragonFly: src/etc/rc.d/Attic/bootconf.sh,v 1.1 2003/07/24 06:35:37 dillon Exp $ +# $DragonFly: src/etc/rc.d/Attic/bootconf.sh,v 1.2 2003/12/11 23:28:41 dillon Exp $ # # PROVIDE: bootconf # REQUIRE: mountcritlocal +. /etc/rc.subr + bootconf_start() { # Refer to newbtconf(8) for more information @@ -81,3 +83,6 @@ case "$1" in bootconf_start ;; esac + +dummy_rc_command $1 XXX + diff --git a/etc/rc.d/cleanvar b/etc/rc.d/cleanvar index ca3b7af3a6..5e281507ee 100644 --- a/etc/rc.d/cleanvar +++ b/etc/rc.d/cleanvar @@ -1,13 +1,17 @@ #!/bin/sh # # $FreeBSD: src/etc/rc.d/cleanvar,v 1.5 2003/07/14 13:02:36 mtm Exp $ -# $DragonFly: src/etc/rc.d/cleanvar,v 1.1 2003/07/24 06:35:37 dillon Exp $ +# $DragonFly: src/etc/rc.d/cleanvar,v 1.2 2003/12/11 23:28:41 dillon Exp $ # # PROVIDE: cleanvar # REQUIRE: mountcritlocal # KEYWORD: DragonFly FreeBSD +. /etc/rc.subr + +dummy_rc_command "$1" + purgedir() { local dir file diff --git a/etc/rc.d/diskless b/etc/rc.d/diskless index 616cc09109..887c3f56dd 100644 --- a/etc/rc.d/diskless +++ b/etc/rc.d/diskless @@ -25,7 +25,7 @@ # SUCH DAMAGE. # # $FreeBSD: src/etc/rc.d/diskless,v 1.25 2003/02/15 16:34:14 jhay Exp $ -# $DragonFly: src/etc/rc.d/diskless,v 1.2 2003/11/19 10:32:45 eirikn Exp $ +# $DragonFly: src/etc/rc.d/diskless,v 1.3 2003/12/11 23:28:41 dillon Exp $ # # PROVIDE: diskless @@ -33,6 +33,11 @@ # BEFORE: addswap random # KEYWORD: DragonFly FreeBSD +if [ -r /etc/rc.subr ]; then + . /etc/rc.subr + dummy_rc_command "$1" +fi + dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null` [ ${dlv:=0} -eq 0 ] && exit 0 diff --git a/etc/rc.d/downinterfaces b/etc/rc.d/downinterfaces index e0fae511b1..124cf36604 100644 --- a/etc/rc.d/downinterfaces +++ b/etc/rc.d/downinterfaces @@ -1,7 +1,7 @@ #!/bin/sh # # $NetBSD: downinterfaces,v 1.2 2001/09/04 20:40:40 martin Exp $ -# $DragonFly: src/etc/rc.d/Attic/downinterfaces,v 1.1 2003/07/24 06:35:37 dillon Exp $ +# $DragonFly: src/etc/rc.d/Attic/downinterfaces,v 1.2 2003/12/11 23:28:41 dillon Exp $ # # PROVIDE: downinterfaces @@ -10,6 +10,7 @@ if [ "x$1" != "xstop" ]; then exit 0; fi . /etc/rc.conf +dummy_rc_command "$1" tmp=`ifconfig -lu` iflist="" diff --git a/etc/rc.d/early.sh b/etc/rc.d/early.sh index e342442d5d..cd464ace65 100644 --- a/etc/rc.d/early.sh +++ b/etc/rc.d/early.sh @@ -1,7 +1,7 @@ #!/bin/sh # # $FreeBSD: src/etc/rc.d/early.sh,v 1.1 2003/04/24 08:27:29 mtm Exp $ -# $DragonFly: src/etc/rc.d/Attic/early.sh,v 1.1 2003/07/24 06:35:37 dillon Exp $ +# $DragonFly: src/etc/rc.d/Attic/early.sh,v 1.2 2003/12/11 23:28:41 dillon Exp $ # # PROVIDE: early @@ -15,3 +15,7 @@ if [ -r /etc/rc.early ]; then . /etc/rc.early fi + +. /etc/rc.subr +dummy_rc_command "$1" + diff --git a/etc/rc.d/initdiskless b/etc/rc.d/initdiskless index 687bc31bc1..24cc5e61f8 100644 --- a/etc/rc.d/initdiskless +++ b/etc/rc.d/initdiskless @@ -25,11 +25,13 @@ # SUCH DAMAGE. # # $FreeBSD: src/etc/rc.d/initdiskless,v 1.24 2003/06/30 21:47:06 brooks Exp $ -# $DragonFly: src/etc/rc.d/initdiskless,v 1.3 2003/11/19 10:32:45 eirikn Exp $ +# $DragonFly: src/etc/rc.d/initdiskless,v 1.4 2003/12/11 23:28:41 dillon Exp $ # # PROVIDE: initdiskless # KEYWORD: DragonFly FreeBSD +. /etc/rc.subr +dummy_rc_command "$1" # On entry to this script the entire system consists of a read-only root # mounted via NFS. We use the contents of /conf to create and populate diff --git a/etc/rc.d/msgs b/etc/rc.d/msgs index 39b8e3c09f..3d1160a0c2 100644 --- a/etc/rc.d/msgs +++ b/etc/rc.d/msgs @@ -1,13 +1,16 @@ #!/bin/sh # # $FreeBSD: src/etc/rc.d/msgs,v 1.1 2002/06/13 22:14:36 gordon Exp $ -# $DragonFly: src/etc/rc.d/msgs,v 1.1 2003/07/24 06:35:37 dillon Exp $ +# $DragonFly: src/etc/rc.d/msgs,v 1.2 2003/12/11 23:28:41 dillon Exp $ # # PROVIDE: msgs # REQUIRE: LOGIN # KEYWORD: DragonFly FreeBSD +. /etc/rc.subr +dummy_rc_command "$1" + # Make a bounds file for msgs(1) if there isn't one already # if [ -d /var/msgs -a ! -f /var/msgs/bounds -a ! -L /var/msgs/bounds ]; then diff --git a/etc/rc.d/netoptions b/etc/rc.d/netoptions index bfccf6ccd7..decf3442c2 100644 --- a/etc/rc.d/netoptions +++ b/etc/rc.d/netoptions @@ -1,7 +1,7 @@ #!/bin/sh # # $FreeBSD: src/etc/rc.d/netoptions,v 1.138 2003/06/29 05:09:48 mtm Exp $ -# $DragonFly: src/etc/rc.d/netoptions,v 1.1 2003/07/24 06:35:37 dillon Exp $ +# $DragonFly: src/etc/rc.d/netoptions,v 1.2 2003/12/11 23:28:41 dillon Exp $ # # PROVIDE: netoptions @@ -12,6 +12,8 @@ . /etc/rc.subr load_rc_config 'XXX' +dummy_rc_command "$1" + echo -n 'Additional TCP options:' case ${log_in_vain} in diff --git a/etc/rc.d/network3 b/etc/rc.d/network3 index 7c372e0f54..f902e63412 100644 --- a/etc/rc.d/network3 +++ b/etc/rc.d/network3 @@ -1,7 +1,7 @@ #!/bin/sh # # $FreeBSD: src/etc/rc.d/network3,v 1.138 2003/06/29 05:15:57 mtm Exp $ -# $DragonFly: src/etc/rc.d/Attic/network3,v 1.1 2003/07/24 06:35:37 dillon Exp $ +# $DragonFly: src/etc/rc.d/Attic/network3,v 1.2 2003/12/11 23:28:41 dillon Exp $ # # PROVIDE: network3 @@ -12,6 +12,7 @@ . /etc/rc.subr load_rc_config 'XXX' +dummy_rc_command "$1" echo -n 'Additional TCP options:' case ${log_in_vain} in diff --git a/etc/rc.d/othermta b/etc/rc.d/othermta index ec490ae423..0df633f044 100644 --- a/etc/rc.d/othermta +++ b/etc/rc.d/othermta @@ -1,7 +1,7 @@ #!/bin/sh # # $FreeBSD: src/etc/rc.d/othermta,v 1.2 2002/08/09 17:45:04 gordon Exp $ -# $DragonFly: src/etc/rc.d/othermta,v 1.1 2003/07/24 06:35:37 dillon Exp $ +# $DragonFly: src/etc/rc.d/othermta,v 1.2 2003/12/11 23:28:41 dillon Exp $ # # PROVIDE: mail @@ -11,8 +11,8 @@ # XXX - TEMPORARY SCRIPT UNTIL YOU WRITE YOUR OWN REPLACEMENT. # . /etc/rc.subr - load_rc_config 'XXX' +dummy_rc_command "$1" if [ -n "${mta_start_script}" ]; then [ "${mta_start_script}" != "/etc/rc.sendmail" ] && \ diff --git a/etc/rc.d/rcconf.sh b/etc/rc.d/rcconf.sh index 5cec3889a9..9cda01e852 100644 --- a/etc/rc.d/rcconf.sh +++ b/etc/rc.d/rcconf.sh @@ -1,7 +1,7 @@ #!/bin/sh # # $FreeBSD: src/etc/rc.d/rcconf.sh,v 1.2 2003/01/25 20:02:35 mtm Exp $ -# $DragonFly: src/etc/rc.d/rcconf.sh,v 1.1 2003/07/24 06:35:37 dillon Exp $ +# $DragonFly: src/etc/rc.d/rcconf.sh,v 1.2 2003/12/11 23:28:41 dillon Exp $ # # PROVIDE: rcconf @@ -10,6 +10,7 @@ # KEYWORD: DragonFly FreeBSD . /etc/rc.subr +dummy_rc_command "$1" echo "Loading configuration files." load_rc_config 'XXX' diff --git a/etc/rc.d/savecore b/etc/rc.d/savecore index 9da7148baf..750b85c3e9 100644 --- a/etc/rc.d/savecore +++ b/etc/rc.d/savecore @@ -2,7 +2,7 @@ # # $NetBSD: savecore,v 1.5 2002/03/22 04:34:00 thorpej Exp $ # $FreeBSD: src/etc/rc.d/savecore,v 1.3 2002/09/06 16:18:05 gordon Exp $ -# $DragonFly: src/etc/rc.d/savecore,v 1.2 2003/11/19 10:32:45 eirikn Exp $ +# $DragonFly: src/etc/rc.d/savecore,v 1.3 2003/12/11 23:28:41 dillon Exp $ # # PROVIDE: savecore @@ -36,7 +36,8 @@ savecore_prestart() case ${dumpdev} in [Nn][Oo] | '') debug 'No dump device. Quitting.' - return 1 + dumpdev= + return 0 ;; esac # If there is no crash directory set it now @@ -50,7 +51,8 @@ savecore_prestart() esac if [ ! -e "${dumpdev}" -o ! -d "${dumpdir}" ]; then warn "Wrong dump device or directory. Savecore not run." - return 1 + dumpdev= + return 0 fi ;; FreeBSD) @@ -58,7 +60,8 @@ savecore_prestart() case ${dumpdev} in [Nn][Oo] | '') debug 'No dump device. Quitting.' - return 1 + dumpdev= + return 0 ;; esac @@ -74,13 +77,15 @@ savecore_prestart() if [ ! -e "${dumpdev}" -o ! -d "${dumpdir}" ]; then warn "Wrong dump device or directory. Savecore not run." - return 1 + dumpdev= + return 0 fi ;; NetBSD) if [ ! -d "${dumpdir}" ]; then warn "No /var/crash directory; savecore not run." - return 1 + dumpdev= + return 0 fi ;; esac @@ -89,8 +94,10 @@ savecore_prestart() savecore_start() { + if [ X$dumpdev != X ]; then echo "Checking for core dump..." savecore ${savecore_flags} ${DUMPDIR} + fi } load_rc_config $name diff --git a/etc/rc.d/serial b/etc/rc.d/serial index becae67e91..b6b3336dac 100644 --- a/etc/rc.d/serial +++ b/etc/rc.d/serial @@ -25,13 +25,16 @@ # SUCH DAMAGE. # # $FreeBSD: src/etc/rc.d/serial,v 1.20 2003/05/05 03:26:50 bde Exp $ -# $DragonFly: src/etc/rc.d/serial,v 1.1 2003/07/24 06:35:37 dillon Exp $ +# $DragonFly: src/etc/rc.d/serial,v 1.2 2003/12/11 23:28:41 dillon Exp $ # # PROVIDE: serial # REQUIRE: root # KEYWORD: DragonFly FreeBSD +. /etc/rc.subr +dummy_rc_command "$1" + # Change some defaults for serial devices. # Standard defaults are: # dtrwait 300 drainwait `sysctl -n kern.drainwait` -- 2.41.0