From be026881b1db1eb89066293625a4289fcf75d49f Mon Sep 17 00:00:00 2001 From: "David E. O'Brien" Date: Fri, 21 Jun 2002 19:07:21 +0000 Subject: [PATCH] Sync with NetBSD's mainline. --- etc/rc.d/DAEMON | 8 ++--- etc/rc.d/LOGIN | 8 ++--- etc/rc.d/Makefile | 29 +++++++++------- etc/rc.d/NETWORKING | 9 +++++ etc/rc.d/SERVERS | 6 ++-- etc/rc.d/accounting | 15 ++++++--- etc/rc.d/altqd | 21 ++++++++++++ etc/rc.d/amd | 3 +- etc/rc.d/apmd | 3 +- etc/rc.d/bootconf.sh | 26 ++++++++++---- etc/rc.d/bootparams | 3 +- etc/rc.d/cleartmp | 3 +- etc/rc.d/dhclient | 3 +- etc/rc.d/dhcpd | 3 +- etc/rc.d/dhcrelay | 3 +- etc/rc.d/dmesg | 8 +++-- etc/rc.d/downinterfaces | 27 +++++++++++++++ etc/rc.d/fsck | 6 ++-- etc/rc.d/ifwatchd | 17 ++++++++++ etc/rc.d/ipfilter | 11 ++++-- etc/rc.d/ipfs | 36 ++++++++++++++++++++ etc/rc.d/ipmon | 5 +-- etc/rc.d/ipnat | 3 +- etc/rc.d/ipsec | 3 +- etc/rc.d/isdnd | 56 ++++-------------------------- etc/rc.d/kdc | 5 +-- etc/rc.d/ldconfig | 8 +++-- etc/rc.d/lkm3 | 3 +- etc/rc.d/local | 3 +- etc/rc.d/lpd | 3 +- etc/rc.d/mixerctl | 26 ++++++++++++++ etc/rc.d/mopd | 3 +- etc/rc.d/motd | 5 ++- etc/rc.d/mountcritlocal | 7 ++-- etc/rc.d/mountcritremote | 19 +++++++---- etc/rc.d/mountd | 8 ++--- etc/rc.d/moused | 16 +++++++++ etc/rc.d/mrouted | 3 +- etc/rc.d/named | 45 +++++++++++++++++++++++-- etc/rc.d/ndbootd | 18 ++++++++++ etc/rc.d/network | 73 ++++++++++++++++++---------------------- etc/rc.d/newsyslog | 8 ++--- etc/rc.d/nfsd | 4 +-- etc/rc.d/nfslocking | 6 ++-- etc/rc.d/ntpd | 35 ++++++++++++++++++- etc/rc.d/ntpdate | 6 ++-- etc/rc.d/postfix | 33 +++++++++++++----- etc/rc.d/pwcheck | 3 +- etc/rc.d/quota | 3 +- etc/rc.d/racoon | 5 +-- etc/rc.d/raidframe | 21 +++++------- etc/rc.d/rarpd | 3 +- etc/rc.d/rbootd | 3 +- etc/rc.d/route6d | 3 +- etc/rc.d/routed | 5 +-- etc/rc.d/rpcbind | 4 +-- etc/rc.d/rtadvd | 3 +- etc/rc.d/rtsold | 3 +- etc/rc.d/rwho | 3 +- etc/rc.d/savecore | 5 +-- etc/rc.d/screenblank | 3 +- etc/rc.d/securelevel | 23 ++++++++----- etc/rc.d/sendmail | 12 +++---- etc/rc.d/sshd | 42 +++++++++++++++-------- etc/rc.d/swap1 | 20 +++++++++-- etc/rc.d/swap2 | 3 +- etc/rc.d/sysctl | 19 ++--------- etc/rc.d/sysdb | 5 +-- etc/rc.d/syslogd | 32 ++++++++++++++++-- etc/rc.d/timed | 3 +- etc/rc.d/ttys | 12 +++++-- etc/rc.d/virecover | 17 +++------- etc/rc.d/wscons | 36 +++++++++++++++++++- etc/rc.d/xfs | 3 +- etc/rc.d/ypbind | 3 +- etc/rc.d/yppasswdd | 3 +- 76 files changed, 656 insertions(+), 296 deletions(-) create mode 100644 etc/rc.d/NETWORKING create mode 100644 etc/rc.d/altqd create mode 100644 etc/rc.d/downinterfaces create mode 100644 etc/rc.d/ifwatchd create mode 100755 etc/rc.d/ipfs create mode 100755 etc/rc.d/mixerctl create mode 100644 etc/rc.d/moused create mode 100755 etc/rc.d/ndbootd diff --git a/etc/rc.d/DAEMON b/etc/rc.d/DAEMON index 5619e56bff4b..917dd1c5f0b7 100755 --- a/etc/rc.d/DAEMON +++ b/etc/rc.d/DAEMON @@ -1,12 +1,10 @@ #!/bin/sh # -# $NetBSD: DAEMON,v 1.4 2000/08/21 23:39:07 lukem Exp $ +# $NetBSD: DAEMON,v 1.7 2002/01/31 01:26:05 lukem Exp $ # # PROVIDE: DAEMON -# REQUIRE: accounting aftermountlkm amd cleartmp dmesg ipmon -# REQUIRE: ipnat ipsec ldconfig named network nonlocalswap nfslocking -# REQUIRE: pwcheck quota savecore securelevel sysctl sysdb virecover ypbind +# REQUIRE: NETWORKING SERVERS -# This is a dummy dependancy, to ensure that general purpose daemons +# This is a dummy dependency, to ensure that general purpose daemons # are run _after_ the above are. diff --git a/etc/rc.d/LOGIN b/etc/rc.d/LOGIN index 39fc88bbaf24..416aec2126eb 100755 --- a/etc/rc.d/LOGIN +++ b/etc/rc.d/LOGIN @@ -1,14 +1,12 @@ #!/bin/sh # -# $NetBSD: LOGIN,v 1.3 2000/07/20 23:36:56 lukem Exp $ +# $NetBSD: LOGIN,v 1.6 2001/04/19 16:00:29 lukem Exp $ # # PROVIDE: LOGIN -# REQUIRE: apmd bootparams dhcpd dhcrelay gated local lpd mopd motd -# REQUIRE: mrouted ntpd rarpd rbootd route6d routed rtadvd rtsold -# REQUIRE: rwho screenblank timed wscons xfs yppasswdd +# REQUIRE: DAEMON -# This is a dummy dependancy to ensure user services such as xdm, +# This is a dummy dependency to ensure user services such as xdm, # inetd, cron and kerberos are started after everything else, incase # the administrator has increased the system security level and # wants to delay user logins until the system is (almost) fully diff --git a/etc/rc.d/Makefile b/etc/rc.d/Makefile index 9c26553b0570..61d6e05978ec 100755 --- a/etc/rc.d/Makefile +++ b/etc/rc.d/Makefile @@ -1,20 +1,23 @@ -# $NetBSD: Makefile,v 1.16 2001/01/14 15:37:22 minoura Exp $ +# $NetBSD: Makefile,v 1.28 2002/04/24 08:18:47 lukem Exp $ .include -FILES= DAEMON LOGIN NETWORK SERVERS accounting amd apmd bootparams \ - bootconf.sh ccd cleartmp cron dhclient dhcpd dhcrelay dmesg \ - fsck gated inetd ipfilter ipmon ipnat ipsec isdnd kdc ldconfig \ - lkm1 lkm2 lkm3 local lpd mopd motd mountall mountcritlocal \ - mountcritremote mountd mrouted named network newsyslog nfsd \ - nfslocking ntpd ntpdate rpcbind poffd postfix ppp pwcheck racoon \ - quota raidframe rarpd rbootd root route6d routed rtadvd rtsold rwho \ - savecore screenblank sendmail securelevel sshd swap1 swap2 sysdb \ - sysctl syslogd timed ttys virecover wscons xdm xfs ypbind \ - yppasswdd ypserv +FILES= DAEMON LOGIN NETWORKING SERVERS \ + accounting altqd amd apmd \ + bootparams bootconf.sh ccd cleartmp cron \ + dhclient dhcpd dhcrelay dmesg downinterfaces fsck \ + ifwatchd inetd ipfilter ipfs ipmon ipnat ipsec isdnd kdc \ + ldconfig lkm1 lkm2 lkm3 local lpd \ + mixerctl mopd motd mountall mountcritlocal mountcritremote mountd \ + moused mrouted \ + named ndbootd network newsyslog nfsd nfslocking ntpd ntpdate \ + poffd postfix ppp pwcheck quota \ + racoon rpcbind raidframe rarpd rbootd root \ + route6d routed rtadvd rtsold rwho \ + savecore screenblank sendmail securelevel sshd \ + swap1 swap2 sysdb sysctl syslogd \ + timed ttys virecover wscons xdm xfs ypbind yppasswdd ypserv FILESDIR= /etc/rc.d FILESMODE= ${BINMODE} -NOPROG= noprog - .include diff --git a/etc/rc.d/NETWORKING b/etc/rc.d/NETWORKING new file mode 100644 index 000000000000..1bc62a4946a6 --- /dev/null +++ b/etc/rc.d/NETWORKING @@ -0,0 +1,9 @@ +#!/bin/sh +# +# $NetBSD: NETWORKING,v 1.1 2002/01/31 01:26:05 lukem Exp $ +# + +# PROVIDE: NETWORKING NETWORK + +# This is a dummy dependency, for services which require networking +# to be operational before starting. diff --git a/etc/rc.d/SERVERS b/etc/rc.d/SERVERS index 99a9c17f7faa..e3c7a24047d4 100755 --- a/etc/rc.d/SERVERS +++ b/etc/rc.d/SERVERS @@ -1,10 +1,10 @@ #!/bin/sh # -# $NetBSD: SERVERS,v 1.4 2000/09/21 10:38:04 ad Exp $ +# $NetBSD: SERVERS,v 1.8 2001/04/26 03:56:20 lukem Exp $ # # PROVIDE: SERVERS -# REQUIRE: ipmon kdc newsyslog ppp savecore syslogd ike +# REQUIRE: mountcritremote -# This is a dummy dependancy, for early-start servers relying on +# This is a dummy dependency, for early-start servers relying on # some basic configuration. diff --git a/etc/rc.d/accounting b/etc/rc.d/accounting index aecb2ad2bfc4..e05c58bc0925 100755 --- a/etc/rc.d/accounting +++ b/etc/rc.d/accounting @@ -1,30 +1,35 @@ #!/bin/sh # -# $NetBSD: accounting,v 1.2 2000/05/13 08:45:06 lukem Exp $ +# $NetBSD: accounting,v 1.6 2001/04/29 23:57:25 lukem Exp $ # # PROVIDE: accounting # REQUIRE: mountall +# BEFORE: DAEMON . /etc/rc.subr name="accounting" rcvar=$name +accounting_command="/usr/sbin/accton" +accounting_file="/var/account/acct" start_cmd="accounting_start" stop_cmd="accounting_stop" accounting_start() { - if [ -f /var/account/acct ]; then - echo "Turning on accounting." - /usr/sbin/accton /var/account/acct + if [ ! -f ${accounting_file} ]; then + echo "Creating accounting file ${accounting_file}" + ( umask 022 ; > ${accounting_file} ) fi + echo "Turning on accounting." + ${accounting_command} ${accounting_file} } accounting_stop() { echo "Turning off accounting." - /usr/sbin/accton + ${accounting_command} } load_rc_config $name diff --git a/etc/rc.d/altqd b/etc/rc.d/altqd new file mode 100644 index 000000000000..85252d5d2460 --- /dev/null +++ b/etc/rc.d/altqd @@ -0,0 +1,21 @@ +#!/bin/sh +# +# $NetBSD: altqd,v 1.1 2001/04/05 23:55:00 thorpej Exp $ +# + +# PROVIDE: altqd +# REQUIRE: network mountcritlocal dhclient +# BEFORE: NETWORKING +# KEYWORD: shutdown + +. /etc/rc.subr + +name="altqd" +rcvar=$name +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/altq.conf" +extra_commands="reload" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/amd b/etc/rc.d/amd index a674a24fd2b6..1f1598b39e77 100755 --- a/etc/rc.d/amd +++ b/etc/rc.d/amd @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: amd,v 1.6 2000/09/19 13:04:38 lukem Exp $ +# $NetBSD: amd,v 1.9 2002/03/22 04:33:58 thorpej Exp $ # # PROVIDE: amd # REQUIRE: rpcbind mountall ypbind +# BEFORE: DAEMON . /etc/rc.subr diff --git a/etc/rc.d/apmd b/etc/rc.d/apmd index 01f26d1caff2..2448b2880527 100755 --- a/etc/rc.d/apmd +++ b/etc/rc.d/apmd @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: apmd,v 1.3 2000/05/13 08:45:06 lukem Exp $ +# $NetBSD: apmd,v 1.4 2000/09/19 13:04:38 lukem Exp $ # # PROVIDE: apmd # REQUIRE: DAEMON +# BEFORE: LOGIN . /etc/rc.subr diff --git a/etc/rc.d/bootconf.sh b/etc/rc.d/bootconf.sh index 8f663ca58739..a15b5a00bb7a 100755 --- a/etc/rc.d/bootconf.sh +++ b/etc/rc.d/bootconf.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: bootconf.sh,v 1.2 2000/08/21 23:34:45 lukem Exp $ +# $NetBSD: bootconf.sh,v 1.4 2002/03/24 15:08:58 lukem Exp $ # # PROVIDE: bootconf @@ -20,9 +20,13 @@ bootconf_start() else default=current fi + if [ "$default" = "current" ]; then + def=`ls -ld /etc/etc.current 2>&1` + default="${def##*-> etc.}" + fi + spc="" - for i in /etc/etc.* - do + for i in /etc/etc.*; do name="${i##/etc/etc.}" case $name in current|default|\*) @@ -43,11 +47,11 @@ bootconf_start() _DUMMY=/etc/passwd conf=${_DUMMY} while [ ! -d /etc/etc.$conf/. ]; do - trap "conf=$default; echo; echo Using default of $conf" 14 + trap "conf=$default; echo; echo Using default of $conf" ALRM echo -n "Which configuration [$default] ? " (sleep 30 && kill -ALRM $master) >/dev/null 2>&1 & read conf - trap : 14 + trap : ALRM if [ -z $conf ] ; then conf=$default fi @@ -55,8 +59,16 @@ bootconf_start() conf=${_DUMMY} fi done - rm -f /etc/etc.current - ln -s /etc/etc.$conf /etc/etc.current + + case $conf in + current|default) + ;; + *) + rm -f /etc/etc.current + ln -s /etc/etc.$conf /etc/etc.current + ;; + esac + if [ -f /etc/rc.conf ] ; then . /etc/rc.conf fi diff --git a/etc/rc.d/bootparams b/etc/rc.d/bootparams index 2f27d4f9e5bc..d9b75e9a6a2f 100755 --- a/etc/rc.d/bootparams +++ b/etc/rc.d/bootparams @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: bootparams,v 1.4 2000/06/02 22:54:11 fvdl Exp $ +# $NetBSD: bootparams,v 1.5 2000/09/19 13:04:38 lukem Exp $ # # PROVIDE: bootparams # REQUIRE: rpcbind DAEMON +# BEFORE: LOGIN . /etc/rc.subr diff --git a/etc/rc.d/cleartmp b/etc/rc.d/cleartmp index 943e5ca5ee69..6feeccc156d1 100755 --- a/etc/rc.d/cleartmp +++ b/etc/rc.d/cleartmp @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: cleartmp,v 1.2 2000/05/13 08:45:06 lukem Exp $ +# $NetBSD: cleartmp,v 1.3 2000/09/19 13:04:38 lukem Exp $ # # PROVIDE: cleartmp # REQUIRE: mountall +# BEFORE: DAEMON . /etc/rc.subr diff --git a/etc/rc.d/dhclient b/etc/rc.d/dhclient index 453062e3ee31..6bd2f8f4c78f 100755 --- a/etc/rc.d/dhclient +++ b/etc/rc.d/dhclient @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: dhclient,v 1.6 2000/07/26 00:11:49 lukem Exp $ +# $NetBSD: dhclient,v 1.7 2000/09/19 13:04:38 lukem Exp $ # # PROVIDE: dhclient # REQUIRE: network mountcritlocal +# BEFORE: NETWORKING # # Note that there no syslog logging of dhclient messages at boot because # dhclient needs to start before services that syslog depends upon do. diff --git a/etc/rc.d/dhcpd b/etc/rc.d/dhcpd index 1126769c8e6b..c5547a36a5fa 100755 --- a/etc/rc.d/dhcpd +++ b/etc/rc.d/dhcpd @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: dhcpd,v 1.3 2000/05/13 08:45:06 lukem Exp $ +# $NetBSD: dhcpd,v 1.4 2000/09/19 13:04:38 lukem Exp $ # # PROVIDE: dhcpd # REQUIRE: DAEMON +# BEFORE: LOGIN . /etc/rc.subr diff --git a/etc/rc.d/dhcrelay b/etc/rc.d/dhcrelay index 4d76dbad88c4..014a87b1d492 100755 --- a/etc/rc.d/dhcrelay +++ b/etc/rc.d/dhcrelay @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: dhcrelay,v 1.3 2000/05/13 08:45:06 lukem Exp $ +# $NetBSD: dhcrelay,v 1.4 2000/09/19 13:04:38 lukem Exp $ # # PROVIDE: dhcrelay # REQUIRE: DAEMON +# BEFORE: LOGIN . /etc/rc.subr diff --git a/etc/rc.d/dmesg b/etc/rc.d/dmesg index 41ad00f4750b..a66162c3f466 100755 --- a/etc/rc.d/dmesg +++ b/etc/rc.d/dmesg @@ -1,22 +1,24 @@ #!/bin/sh # -# $NetBSD: dmesg,v 1.4 2000/07/26 00:11:49 lukem Exp $ +# $NetBSD: dmesg,v 1.7 2002/03/22 04:16:39 lukem Exp $ # # PROVIDE: dmesg # REQUIRE: mountcritremote +# BEFORE: DAEMON . /etc/rc.subr name="dmesg" rcvar=$name +dmesg_file="/var/run/dmesg.boot" start_cmd="do_dmesg" stop_cmd=":" do_dmesg() { - rm -f /var/run/dmesg.boot - dmesg $dmesg_flags > /var/run/dmesg.boot + rm -f ${dmesg_file} + ( umask 022 ; /sbin/dmesg $rc_flags > ${dmesg_file} ) } load_rc_config $name diff --git a/etc/rc.d/downinterfaces b/etc/rc.d/downinterfaces new file mode 100644 index 000000000000..6a5c9433b22a --- /dev/null +++ b/etc/rc.d/downinterfaces @@ -0,0 +1,27 @@ +#!/bin/sh +# +# $NetBSD: downinterfaces,v 1.2 2001/09/04 20:40:40 martin Exp $ +# + +# PROVIDE: downinterfaces +# KEYWORD: shutdown + +if [ "x$1" != "xstop" ]; then exit 0; fi + +. /etc/rc.conf + +tmp=`ifconfig -lu` +iflist="" +for int in $tmp; do + case $int in + pppoe*) iflist="$iflist $int" + ;; + esac +done +iflist="$iflist $force_down_interfaces" +if [ "$iflist" = "" ] || [ "$iflist" = " " ]; then exit 0; fi + +echo "Shutting down interfaces:$iflist" +for int in $iflist; do + ifconfig $int down +done diff --git a/etc/rc.d/fsck b/etc/rc.d/fsck index ddd43024740f..31f1e982a19f 100755 --- a/etc/rc.d/fsck +++ b/etc/rc.d/fsck @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD$ +# $NetBSD: fsck,v 1.1 2000/08/21 23:38:07 lukem Exp $ # # PROVIDE: fsck @@ -27,11 +27,11 @@ fsck_start() { if [ -e /fastboot ]; then echo "Fast boot: skipping disk checks." - elif [ "$autoboot" = yes ]; then + else # During fsck ignore SIGQUIT trap : 3 - echo "Automatic boot in progress: starting file system checks." + echo "Starting file system checks:" fsck -p case $? in 0) diff --git a/etc/rc.d/ifwatchd b/etc/rc.d/ifwatchd new file mode 100644 index 000000000000..ec23ce28421e --- /dev/null +++ b/etc/rc.d/ifwatchd @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD$ +# + +# PROVIDE: ifwatchd +# REQUIRE: mountcritremote network + +. /etc/rc.subr + +name="ifwatchd" +rcvar=$name +command="/usr/sbin/${name}" + +load_rc_config $name +run_rc_command "$1" + diff --git a/etc/rc.d/ipfilter b/etc/rc.d/ipfilter index a2d0c2098b8d..557eefb51289 100755 --- a/etc/rc.d/ipfilter +++ b/etc/rc.d/ipfilter @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: ipfilter,v 1.8 2000/10/01 05:58:06 lukem Exp $ +# $NetBSD: ipfilter,v 1.9 2000/10/09 06:11:38 nisimura Exp $ # # PROVIDE: ipfilter @@ -16,9 +16,11 @@ stop_precmd="test -f /etc/ipf.conf -o -f /etc/ipf6.conf" stop_cmd="ipfilter_stop" reload_precmd="$stop_precmd" reload_cmd="ipfilter_reload" +resync_precmd="$stop_precmd" +resync_cmd="ipfilter_resync" status_precmd="$stop_precmd" status_cmd="ipfilter_status" -extra_commands="reload status" +extra_commands="reload resync status" ipfilter_prestart() { @@ -70,6 +72,11 @@ ipfilter_reload() /sbin/ipf -s } +ipfilter_resync() +{ + /sbin/ipf -y +} + ipfilter_status() { /sbin/ipf -V diff --git a/etc/rc.d/ipfs b/etc/rc.d/ipfs new file mode 100755 index 000000000000..0abdba07826c --- /dev/null +++ b/etc/rc.d/ipfs @@ -0,0 +1,36 @@ +#!/bin/sh +# +# $NetBSD: ipfs,v 1.3 2002/02/11 13:55:42 lukem Exp $ +# + +# PROVIDE: ipfs +# REQUIRE: ipnat mountcritremote +# KEYWORD: shutdown + +. /etc/rc.subr + +name="ipfs" +rcvar=$name +start_cmd="ipfs_start" +stop_cmd="ipfs_stop" + +ipfs_start() +{ + if [ -r /var/db/ipf/ipstate.ipf -a -r /var/db/ipf/ipnat.ipf ]; then + /usr/sbin/ipfs -R ${rc_flags} + rm -f /var/db/ipf/ipstate.ipf /var/db/ipf/ipnat.ipf + fi +} + +ipfs_stop() +{ + if [ ! -d /var/db/ipf ]; then + mkdir /var/db/ipf + chmod 700 /var/db/ipf + chown root:wheel /var/db/ipf + fi + /usr/sbin/ipfs -W ${rc_flags} +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/ipmon b/etc/rc.d/ipmon index 6f635c5082f9..67e46b658c53 100755 --- a/etc/rc.d/ipmon +++ b/etc/rc.d/ipmon @@ -1,17 +1,18 @@ #!/bin/sh # -# $NetBSD: ipmon,v 1.2 2000/05/13 08:45:07 lukem Exp $ +# $NetBSD: ipmon,v 1.6 2002/03/22 04:33:58 thorpej Exp $ # # PROVIDE: ipmon # REQUIRE: syslogd +# BEFORE: SERVERS . /etc/rc.subr name="ipmon" rcvar=$name command="/usr/sbin/${name}" -command_args="&" +command_args="-D" load_rc_config $name run_rc_command "$1" diff --git a/etc/rc.d/ipnat b/etc/rc.d/ipnat index 1ac21c0d53f7..05162ef74aaf 100755 --- a/etc/rc.d/ipnat +++ b/etc/rc.d/ipnat @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: ipnat,v 1.5 2000/08/21 23:33:50 lukem Exp $ +# $NetBSD: ipnat,v 1.6 2000/09/19 13:04:38 lukem Exp $ # # PROVIDE: ipnat # REQUIRE: ipfilter mountcritremote +# BEFORE: DAEMON . /etc/rc.subr diff --git a/etc/rc.d/ipsec b/etc/rc.d/ipsec index 01313f921dd4..0f84bde7fa8c 100755 --- a/etc/rc.d/ipsec +++ b/etc/rc.d/ipsec @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: ipsec,v 1.5 2000/07/21 01:16:07 lukem Exp $ +# $NetBSD: ipsec,v 1.6 2000/09/19 13:04:38 lukem Exp $ # # PROVIDE: ipsec # REQUIRE: root beforenetlkm mountcritlocal tty +# BEFORE: DAEMON # it does not really require beforenetlkm. diff --git a/etc/rc.d/isdnd b/etc/rc.d/isdnd index 87c8a40b1c2c..5363df4ae7db 100644 --- a/etc/rc.d/isdnd +++ b/etc/rc.d/isdnd @@ -1,10 +1,15 @@ #!/bin/sh # -# $NetBSD: isdnd,v 1.2 2001/01/07 17:53:36 martin Exp $ +# $NetBSD: isdnd,v 1.8 2002/03/22 04:33:58 thorpej Exp $ # # PROVIDE: isdnd -# REQUIRE: NETWORK syslogd mountcritremote +# REQUIRE: NETWORKING syslogd mountcritremote +# BEFORE: SERVERS +# +# Note that this means that syslogd will not be listening on +# any isdn addresses. This is considered a feature. +# . /etc/rc.subr @@ -17,50 +22,3 @@ pidfile="/var/run/${name}.pid" load_rc_config $name run_rc_command "$1" - -if checkyesno isdnd && checkyesno isdn_autoupdown; then - - # The isdn network interfaces could not be marked UP in the - # ifconfig.* files, since the daemon wasn't available then. - # If we are doing start: now it's running, so figure which - # interfaces these applies to and UP them. If doing stop: - # down them (for symetry, and effectively they are down). - - case "$_arg" in - start) - ifflag="-d" - ifcmd="up" - ;; - stop) - ifflag="-u" - ifcmd="down" - ;; - *) - exit 0 - ;; - esac - - if [ -z "$isdn_interfaces" ]; then - # the user has not specified a list of interface - # to track isdnd - try to figure ourselfs - tmp=`ifconfig -l $ifflag` - for int in $tmp; do - # Check if the interface has been configured at all - # XXX - does this work with IPv6 ? - if ifconfig $int | fgrep inet >/dev/null; then - case $int in - isp*) - isdn_interfaces="$isdn_interfaces $int" - ;; - ipr*) - isdn_interfaces="$isdn_interfaces $int" - ;; - esac - fi - done - fi - for int in $isdn_interfaces; do - ifconfig $int $ifcmd - done -fi - diff --git a/etc/rc.d/kdc b/etc/rc.d/kdc index 0d887f312380..d91cefd8ff1b 100755 --- a/etc/rc.d/kdc +++ b/etc/rc.d/kdc @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: kdc,v 1.2 2000/09/19 13:04:38 lukem Exp $ +# $NetBSD: kdc,v 1.4 2002/01/31 01:26:05 lukem Exp $ # # PROVIDE: kdc -# REQUIRE: NETWORK +# REQUIRE: NETWORKING +# BEFORE: SERVERS . /etc/rc.subr diff --git a/etc/rc.d/ldconfig b/etc/rc.d/ldconfig index 73cbba538a02..22cf6734385e 100755 --- a/etc/rc.d/ldconfig +++ b/etc/rc.d/ldconfig @@ -1,22 +1,24 @@ #!/bin/sh # -# $NetBSD: ldconfig,v 1.2 2000/05/13 08:45:07 lukem Exp $ +# $NetBSD: ldconfig,v 1.4 2001/04/25 13:00:17 lukem Exp $ # # PROVIDE: ldconfig # REQUIRE: mountall +# BEFORE: DAEMON . /etc/rc.subr name="ldconfig" +ldconfig_command="/sbin/ldconfig" start_cmd="ldconfig_start" stop_cmd=":" ldconfig_start() { - if [ -f /sbin/ldconfig ]; then + if [ -f ${ldconfig_command} ]; then echo "Creating a.out runtime link editor directory cache." - ldconfig + ${ldconfig_command} fi } diff --git a/etc/rc.d/lkm3 b/etc/rc.d/lkm3 index a02e0dcb3db8..d16647e656ac 100755 --- a/etc/rc.d/lkm3 +++ b/etc/rc.d/lkm3 @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: lkm3,v 1.4 2000/07/15 02:30:18 lukem Exp $ +# $NetBSD: lkm3,v 1.5 2000/09/19 13:04:38 lukem Exp $ # # PROVIDE: aftermountlkm # REQUIRE: mountall +# BEFORE: DAEMON . /etc/rc.subr diff --git a/etc/rc.d/local b/etc/rc.d/local index 8d6926faed9b..5a86440101ea 100755 --- a/etc/rc.d/local +++ b/etc/rc.d/local @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: local,v 1.4 2000/05/13 08:45:07 lukem Exp $ +# $NetBSD: local,v 1.5 2000/08/21 23:33:06 lukem Exp $ # # REQUIRE: DAEMON # PROVIDE: local +# BEFORE: LOGIN # KEYWORD: shutdown . /etc/rc.subr diff --git a/etc/rc.d/lpd b/etc/rc.d/lpd index 83a543a4f1d1..99ed994f9af1 100755 --- a/etc/rc.d/lpd +++ b/etc/rc.d/lpd @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: lpd,v 1.3 2000/05/13 08:45:07 lukem Exp $ +# $NetBSD: lpd,v 1.4 2000/09/19 13:04:38 lukem Exp $ # # PROVIDE: lpd # REQUIRE: DAEMON +# BEFORE: LOGIN . /etc/rc.subr diff --git a/etc/rc.d/mixerctl b/etc/rc.d/mixerctl new file mode 100755 index 000000000000..16fcbb9d4163 --- /dev/null +++ b/etc/rc.d/mixerctl @@ -0,0 +1,26 @@ +#!/bin/sh +# +# $NetBSD: mixerctl,v 1.2 2002/06/02 19:04:10 jmcneill Exp $ +# + +# PROVIDE: mixerctl +# REQUIRE: mountcritremote + +. /etc/rc.subr + +name="mixerctl" +start_cmd="mixerctl_start" +stop_cmd=":" + +mixerctl_start() +{ + if [ -r /etc/mixerctl.conf ]; then + echo "Setting mixerctl variables..." + while read setting; do + mixerctl -n -w $setting + done < /etc/mixerctl.conf + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/mopd b/etc/rc.d/mopd index 888c4d6f1cb6..f7d1c0dc86ee 100755 --- a/etc/rc.d/mopd +++ b/etc/rc.d/mopd @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: mopd,v 1.3 2000/05/13 08:45:07 lukem Exp $ +# $NetBSD: mopd,v 1.4 2000/09/19 13:04:38 lukem Exp $ # # PROVIDE: mopd # REQUIRE: DAEMON +# BEFORE: LOGIN . /etc/rc.subr diff --git a/etc/rc.d/motd b/etc/rc.d/motd index f0003647f965..9032539f1cec 100755 --- a/etc/rc.d/motd +++ b/etc/rc.d/motd @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: motd,v 1.5 2000/09/19 13:04:38 lukem Exp $ +# $NetBSD: motd,v 1.7 2001/04/25 23:23:37 lukem Exp $ # # PROVIDE: motd # REQUIRE: mountcritremote +# BEFORE: LOGIN . /etc/rc.subr @@ -23,11 +24,13 @@ motd_start() if [ ! -f /etc/motd ]; then install -c -o root -g wheel -m 664 /dev/null /etc/motd fi + ( umask 022 T=/etc/_motd sysctl -n kern.version | while read i; do echo $i; break; done > $T sed '1{/^NetBSD.*/{d;};};' < /etc/motd >> $T cmp -s $T /etc/motd || cp $T /etc/motd rm -f $T + ) } load_rc_config $name diff --git a/etc/rc.d/mountcritlocal b/etc/rc.d/mountcritlocal index 38b75f45783b..53d8d4a6b5f9 100755 --- a/etc/rc.d/mountcritlocal +++ b/etc/rc.d/mountcritlocal @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: mountcritlocal,v 1.3 2000/07/26 00:11:49 lukem Exp $ +# $NetBSD: mountcritlocal,v 1.6 2002/03/27 08:53:42 lukem Exp $ # # PROVIDE: mountcritlocal @@ -14,8 +14,9 @@ stop_cmd=":" mountcritlocal_start() { - # mount critical local filesystems - # (as specified in $critical_filesystems_beforenet) + # Mount critical filesystems that are `local' + # (as specified in $critical_filesystems_local) + # This usually includes /var. # mount_critical_filesystems local diff --git a/etc/rc.d/mountcritremote b/etc/rc.d/mountcritremote index 6479ea1058b1..1e7b8395ae78 100755 --- a/etc/rc.d/mountcritremote +++ b/etc/rc.d/mountcritremote @@ -1,19 +1,26 @@ #!/bin/sh # -# $NetBSD: mountcritremote,v 1.2 2000/05/13 08:45:07 lukem Exp $ +# $NetBSD: mountcritremote,v 1.6 2002/03/27 08:53:42 lukem Exp $ # # PROVIDE: mountcritremote -# REQUIRE: NETWORK root mountcritlocal +# REQUIRE: NETWORKING root mountcritlocal . /etc/rc.subr -# mount critical remote filesystems -# (as specified in $critical_filesystems) -# name="mountcritremote" -start_cmd="mount_critical_filesystems remote" +start_cmd="mountcritremote_start" stop_cmd=":" +mountcritremote_start() +{ + # Mount critical filesystems that may be `remote'. + # (as specified in $critical_filesystems_remote) + # This usually includes /usr. + # + mount_critical_filesystems remote + +} + load_rc_config $name run_rc_command "$1" diff --git a/etc/rc.d/mountd b/etc/rc.d/mountd index d1a64bf643cc..713d72b6768a 100755 --- a/etc/rc.d/mountd +++ b/etc/rc.d/mountd @@ -1,15 +1,15 @@ #!/bin/sh # -# $NetBSD: mountd,v 1.6 2000/06/02 22:54:11 fvdl Exp $ +# $NetBSD: mountd,v 1.10 2001/06/16 06:13:10 lukem Exp $ # # PROVIDE: mountd -# REQUIRE: NETWORK mountall beforemountlkm rpcbind quota +# REQUIRE: NETWORKING mountall beforemountlkm rpcbind quota . /etc/rc.subr name="mountd" -rcvar="nfs_server" +rcvar=$name command="/usr/sbin/${name}" required_files="/etc/exports" start_precmd="mountd_precmd" @@ -18,7 +18,7 @@ extra_commands="reload" mountd_precmd() { rm -f /var/db/mountdtab - echo -n > /var/db/mountdtab + ( umask 022 ; > /var/db/mountdtab ) return 0 } diff --git a/etc/rc.d/moused b/etc/rc.d/moused new file mode 100644 index 000000000000..075bf48a7219 --- /dev/null +++ b/etc/rc.d/moused @@ -0,0 +1,16 @@ +#!/bin/sh +# +# $NetBSD: $ +# + +# PROVIDE: moused +# REQUIRE: DAEMON + +. /etc/rc.subr + +name="moused" +rcvar=$name +command="/usr/sbin/${name}" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/mrouted b/etc/rc.d/mrouted index 82393841fc05..7d40ec4f3610 100755 --- a/etc/rc.d/mrouted +++ b/etc/rc.d/mrouted @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: mrouted,v 1.4 2000/05/13 08:45:07 lukem Exp $ +# $NetBSD: mrouted,v 1.5 2000/09/19 13:04:39 lukem Exp $ # # PROVIDE: mrouted # REQUIRE: DAEMON +# BEFORE: LOGIN . /etc/rc.subr diff --git a/etc/rc.d/named b/etc/rc.d/named index b31182234e5d..903a20a60b91 100755 --- a/etc/rc.d/named +++ b/etc/rc.d/named @@ -1,10 +1,12 @@ #!/bin/sh # -# $NetBSD: named,v 1.5 2000/05/13 08:45:07 lukem Exp $ +# $NetBSD: named,v 1.10 2002/03/22 04:33:59 thorpej Exp $ # # PROVIDE: named # REQUIRE: SERVERS +# BEFORE: DAEMON +# KEYWORD: chrootdir . /etc/rc.subr @@ -12,8 +14,47 @@ name="named" rcvar=$name command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" - +start_precmd="named_precmd" extra_commands="reload" +required_dirs="$named_chrootdir" # if it is set, it must exist + +named_precmd() +{ + if [ -z "$named_chrootdir" ]; then + return 0; + fi + + # If running in a chroot cage, ensure that the appropriate files + # exist inside the cage, as well as helper symlinks into the cage + # from outside. + # + # As this is called after the is_running and required_dir checks + # are made in run_rc_command(), we can safely assume ${named_chrootdir} + # exists and named isn't running at this point (unless forcestart + # is used). + # + + if [ ! -x "${named_chrootdir}/usr/libexec/named-xfer" -o \ + "${named_chrootdir}/usr/libexec/named-xfer" -ot \ + /usr/libexec/named-xfer ]; then + rm -f "${named_chrootdir}/usr/libexec/named-xfer" + cp -p /usr/libexec/named-xfer "${named_chrootdir}/usr/libexec" + fi + if [ ! -c "${named_chrootdir}/dev/null" ]; then + rm -f "${named_chrootdir}/dev/null" + ( cd /dev ; /bin/pax -rw -pe null "${named_chrootdir}/dev" ) + fi + if [ -f /etc/localtime ]; then + cmp -s /etc/localtime "${named_chrootdir}/etc/localtime" || \ + cp -p /etc/localtime "${named_chrootdir}/etc/localtime" + fi + ln -fs "${named_chrootdir}/var/run/named.pid" /var/run/named.pid + ln -fs "${named_chrootdir}/var/run/ndc" /var/run/ndc + + # Change run_rc_commands()'s internal copy of $named_flags + # + rc_flags="-u named -g named -t ${named_chrootdir} $rc_flags" +} load_rc_config $name run_rc_command "$1" diff --git a/etc/rc.d/ndbootd b/etc/rc.d/ndbootd new file mode 100755 index 000000000000..e24f8fc0a971 --- /dev/null +++ b/etc/rc.d/ndbootd @@ -0,0 +1,18 @@ +#!/bin/sh +# +# $NetBSD$ +# + +# PROVIDE: ndbootd +# REQUIRE: DAEMON + +. /etc/rc.subr + +name="ndbootd" +rcvar=$name +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/ethers" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/network b/etc/rc.d/network index c9856b6008df..906ce16f9e5d 100755 --- a/etc/rc.d/network +++ b/etc/rc.d/network @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: network,v 1.29 2001/01/11 17:56:16 itojun Exp $ +# $NetBSD: network,v 1.37 2002/04/29 12:13:14 lukem Exp $ # # PROVIDE: network # REQUIRE: ipfilter ipsec mountcritlocal root tty sysctl +# BEFORE: NETWORKING . /etc/rc.subr @@ -57,13 +58,13 @@ network_start() # auto-route from a newly configured interface's address to lo0 # works correctly. # - # NOTE: obscure networking problems may occur if lo0 isn't configured... + # NOTE: obscure networking problems will occur if lo0 isn't configured. # ifconfig lo0 inet 127.0.0.1 - # According to RFC1122, 127.0.0.0/8 should not leave the node. + # According to RFC1122, 127.0.0.0/8 must not leave the node. # - route add -inet 127.0.0.0 -netmask 0xff000000 127.0.0.1 -reject + route -q add -inet 127.0.0.0 -netmask 0xff000000 127.0.0.1 -reject # IPv6 routing setups, and host/router mode selection. # @@ -73,7 +74,7 @@ network_start() # disallow link-local unicast dest without outgoing scope # identifiers. # - route add -inet6 fe80:: -prefixlen 10 ::1 -reject + route -q add -inet6 fe80:: -prefixlen 10 ::1 -reject # disallow site-local unicast dest without outgoing scope # identifiers. @@ -82,26 +83,26 @@ network_start() # boundary), you may want to comment the following one out. # if ! checkyesno ip6sitelocal; then - route add -inet6 fec0:: -prefixlen 10 ::1 -reject + route -q add -inet6 fec0:: -prefixlen 10 ::1 -reject fi # disallow "internal" addresses to appear on the wire. # - route add -inet6 ::ffff:0.0.0.0 -prefixlen 96 ::1 -reject + route -q add -inet6 ::ffff:0.0.0.0 -prefixlen 96 ::1 -reject # disallow packets to malicious IPv4 compatible prefix # - route add -inet6 ::224.0.0.0 -prefixlen 100 ::1 -reject - route add -inet6 ::127.0.0.0 -prefixlen 104 ::1 -reject - route add -inet6 ::0.0.0.0 -prefixlen 104 ::1 -reject - route add -inet6 ::255.0.0.0 -prefixlen 104 ::1 -reject + route -q add -inet6 ::224.0.0.0 -prefixlen 100 ::1 -reject + route -q add -inet6 ::127.0.0.0 -prefixlen 104 ::1 -reject + route -q add -inet6 ::0.0.0.0 -prefixlen 104 ::1 -reject + route -q add -inet6 ::255.0.0.0 -prefixlen 104 ::1 -reject # disallow packets to malicious 6to4 prefix # - route add -inet6 2002:e000:: -prefixlen 20 ::1 -reject - route add -inet6 2002:7f00:: -prefixlen 24 ::1 -reject - route add -inet6 2002:0000:: -prefixlen 24 ::1 -reject - route add -inet6 2002:ff00:: -prefixlen 24 ::1 -reject + route -q add -inet6 2002:e000:: -prefixlen 20 ::1 -reject + route -q add -inet6 2002:7f00:: -prefixlen 24 ::1 -reject + route -q add -inet6 2002:0000:: -prefixlen 24 ::1 -reject + route -q add -inet6 2002:ff00:: -prefixlen 24 ::1 -reject # Completely disallow packets to IPv4 compatible prefix. # This may conflict with RFC1933 under following circumstances: @@ -117,41 +118,27 @@ network_start() # Due to rare use of IPv4 compatible address, and security # issues with it, we disable it by default. # - route add -inet6 ::0.0.0.0 -prefixlen 96 ::1 -reject + route -q add -inet6 ::0.0.0.0 -prefixlen 96 ::1 -reject - sysctl -w net.inet6.ip6.forwarding=0 >/dev/null - sysctl -w net.inet6.ip6.accept_rtadv=0 >/dev/null - - # backward compatibility - # - if [ -z "$ip6mode" ] && [ -n "$ip6forwarding" ]; then - warn 'Please migrate to newer rc.conf' \ - '(use ip6mode, not ip6forwarding)' - if checkyesno ip6forwarding; then - ip6mode=router - elif checkyesno rtsol; then - ip6mode=autohost - else - ip6mode=host - fi - fi + sysctl -qw net.inet6.ip6.forwarding=0 + sysctl -qw net.inet6.ip6.accept_rtadv=0 case $ip6mode in router) echo 'IPv6 mode: router' - sysctl -w net.inet6.ip6.forwarding=1 >/dev/null + sysctl -qw net.inet6.ip6.forwarding=1 ;; autohost) echo 'IPv6 mode: autoconfigured host' - sysctl -w net.inet6.ip6.accept_rtadv=1 >/dev/null + sysctl -qw net.inet6.ip6.accept_rtadv=1 ;; host) echo 'IPv6 mode: host' ;; - *) echo 'WARNING: invalid value in ip6mode' + *) warn "invalid \$ip6mode value "\"$ip6mode\" ;; esac @@ -164,7 +151,7 @@ network_start() # we do "ifconfig xxN $ifconfig_xxN". # If there is no such variable, we take the contents of the file # /etc/ifconfig.xxN, and run "ifconfig xxN" repeatedly, using each - # line of the file as the arguments for a seperate "ifconfig" + # line of the file as the arguments for a separate "ifconfig" # invocation. # # In order to configure an interface reasonably, you at the very least @@ -266,8 +253,6 @@ network_start() ifconfig $int inet alias $addr \ netmask $net fi - # Use loopback, not the wire - route add $addr 127.0.0.1 done fi done @@ -292,8 +277,6 @@ network_start() else ifconfig $int inet alias $addr netmask $net fi - # use loopback, not the wire - route add $addr 127.0.0.1 done < /etc/ifaliases fi @@ -325,6 +308,11 @@ network_start() fi fi + # resync ipf(4) + if checkyesno ipfilter; then + /sbin/ipf -y + fi + # XXX this must die if [ -s /etc/netstart.local ]; then sh /etc/netstart.local start @@ -381,6 +369,11 @@ network_stop() # route -n flush + # resync ipf(4) + if checkyesno ipfilter; then + /sbin/ipf -y + fi + } load_rc_config $name diff --git a/etc/rc.d/newsyslog b/etc/rc.d/newsyslog index a842e4036b23..e4a097ec332c 100755 --- a/etc/rc.d/newsyslog +++ b/etc/rc.d/newsyslog @@ -1,24 +1,24 @@ #!/bin/sh # -# $NetBSD$ +# $NetBSD: newsyslog,v 1.4 2002/03/22 04:33:59 thorpej Exp $ # # PROVIDE: newsyslog # REQUIRE: mountcritremote sysdb -# BEFORE: syslogd +# BEFORE: syslogd SERVERS . /etc/rc.subr name="newsyslog" +rcvar=$name required_files="/etc/newsyslog.conf" -start_precmd="checkyesno newsyslog" start_cmd="newsyslog_start" stop_cmd=":" newsyslog_start() { echo -n "Trimming log files:" - /usr/bin/newsyslog -s $newsyslog_flags + /usr/bin/newsyslog -s $rc_flags echo " done." } diff --git a/etc/rc.d/nfsd b/etc/rc.d/nfsd index a0d3aa19f9a8..7d84dcff87f1 100755 --- a/etc/rc.d/nfsd +++ b/etc/rc.d/nfsd @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: nfsd,v 1.2 2000/05/13 08:45:07 lukem Exp $ +# $NetBSD: nfsd,v 1.3 2000/06/02 22:54:12 fvdl Exp $ # # PROVIDE: nfsd @@ -11,7 +11,7 @@ name="nfsd" rcvar="nfs_server" command="/usr/sbin/${name}" -required_vars="rpcbind" +required_vars="mountd rpcbind" load_rc_config $name run_rc_command "$1" diff --git a/etc/rc.d/nfslocking b/etc/rc.d/nfslocking index bddec8265267..a9efc314dc05 100755 --- a/etc/rc.d/nfslocking +++ b/etc/rc.d/nfslocking @@ -1,16 +1,18 @@ #!/bin/sh # -# $NetBSD: nfslocking,v 1.3 2000/05/13 08:45:07 lukem Exp $ +# $NetBSD: nfslocking,v 1.5 2002/03/22 04:33:59 thorpej Exp $ # # PROVIDE: nfslocking # REQUIRE: nfsd +# BEFORE: DAEMON . /etc/rc.subr arg=$1 -start_precmd='checkyesno nfs_server || checkyesno nfs_client' +start_precmd='checkyesno nfs_server || checkyesno nfs_client || + [ -n "$rc_force" ]' stop_precmd=$start_precmd status_precmd=$start_precmd diff --git a/etc/rc.d/ntpd b/etc/rc.d/ntpd index b09c4d1971bb..ae54ebba3902 100755 --- a/etc/rc.d/ntpd +++ b/etc/rc.d/ntpd @@ -1,10 +1,12 @@ #!/bin/sh # -# $NetBSD: ntpd,v 1.2 2000/05/13 08:45:07 lukem Exp $ +# $NetBSD: ntpd,v 1.8 2002/06/17 06:47:59 lukem Exp $ # # PROVIDE: ntpd # REQUIRE: DAEMON +# BEFORE: LOGIN +# KEYWORD: chrootdir . /etc/rc.subr @@ -12,7 +14,38 @@ name="ntpd" rcvar=$name command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" +start_precmd="ntpd_precmd" required_files="/etc/ntp.conf" +ntpd_precmd() +{ + if [ -z "$ntpd_chrootdir" ]; then + return 0; + fi + + # If running in a chroot cage, ensure that the appropriate files + # exist inside the cage, as well as helper symlinks into the cage + # from outside. + # + # As this is called after the is_running and required_dir checks + # are made in run_rc_command(), we can safely assume ${ntpd_chrootdir} + # exists and ntpd isn't running at this point (unless forcestart + # is used). + # + # Before enabling ntpd_chrootdir, ensure that: + # - The kernel has "pseudo-device clockctl" compiled in + # - /dev/clockctl is present + # + if [ ! -c "${ntpd_chrootdir}/dev/clockctl" ]; then + rm -f "${ntpd_chrootdir}/dev/clockctl" + ( cd /dev ; /bin/pax -rw -pe clockctl "${ntpd_chrootdir}/dev" ) + fi + ln -fs "${ntpd_chrootdir}/var/db/ntp.drift" /var/db/ntp.drift + + # Change run_rc_commands()'s internal copy of $ntpd_flags + # + rc_flags="-u ntpd:ntpd -i ${ntpd_chrootdir} $rc_flags" +} + load_rc_config $name run_rc_command "$1" diff --git a/etc/rc.d/ntpdate b/etc/rc.d/ntpdate index d0a8a18adab3..4105b85d0552 100755 --- a/etc/rc.d/ntpdate +++ b/etc/rc.d/ntpdate @@ -1,10 +1,10 @@ #!/bin/sh # -# $NetBSD: ntpdate,v 1.5 2000/08/21 14:48:39 abs Exp $ +# $NetBSD: ntpdate,v 1.7 2002/01/31 01:26:06 lukem Exp $ # # PROVIDE: ntpdate -# REQUIRE: NETWORK syslogd +# REQUIRE: NETWORKING syslogd . /etc/rc.subr @@ -23,7 +23,7 @@ ntpdate_start() fi if [ -n "$ntpdate_hosts" ]; then echo "Setting date via ntp." - ntpdate $ntpdate_flags $ntpdate_hosts + ntpdate $rc_flags $ntpdate_hosts fi } diff --git a/etc/rc.d/postfix b/etc/rc.d/postfix index b453464dedd5..e826ccc9e116 100755 --- a/etc/rc.d/postfix +++ b/etc/rc.d/postfix @@ -1,24 +1,41 @@ #!/bin/sh # -# $NetBSD: postfix,v 1.4 2000/05/13 08:45:08 lukem Exp $ +# $NetBSD: postfix,v 1.5 2000/09/19 13:04:39 lukem Exp $ # # PROVIDE: mail # REQUIRE: LOGIN - -# we could do this, but make mail start late, so that things like -# .forward's are not processed until the system is fully operational -## REQUIRE: DAEMON +# we make mail start late, so that things like .forward's are not +# processed until the system is fully operational . /etc/rc.subr name="postfix" rcvar=$name required_files="/etc/${name}/main.cf" -start_cmd="postfix start" -stop_cmd="postfix stop" -reload_cmd="postfix reload" +start_precmd="postfix_precmd" +start_cmd="${name} start" +stop_cmd="${name} stop" +reload_cmd="${name} reload" extra_commands="reload" +spooletcdir="/var/spool/${name}/etc" +required_dirs=$spooletcdir + +postfix_precmd() +{ + # As this is called after the is_running and required_dir checks + # are made in run_rc_command(), we can safely assume ${spooletcdir} + # exists and postfix isn't running at this point (unless forcestart + # is used). + # + + for f in localtime resolv.conf services; do + if [ -f /etc/$f ]; then + cmp -s /etc/$f ${spooletcdir}/$f || \ + cp -p /etc/$f ${spooletcdir}/$f + fi + done +} load_rc_config $name run_rc_command "$1" diff --git a/etc/rc.d/pwcheck b/etc/rc.d/pwcheck index 80949e967645..9597bca0d315 100755 --- a/etc/rc.d/pwcheck +++ b/etc/rc.d/pwcheck @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: pwcheck,v 1.2 2000/05/13 08:45:08 lukem Exp $ +# $NetBSD: pwcheck,v 1.3 2000/07/26 00:11:49 lukem Exp $ # # PROVIDE: pwcheck # REQUIRE: mountcritremote syslogd +# BEFORE: DAEMON . /etc/rc.subr diff --git a/etc/rc.d/quota b/etc/rc.d/quota index 8f632553a109..57898baabc6b 100755 --- a/etc/rc.d/quota +++ b/etc/rc.d/quota @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: quota,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# $NetBSD: quota,v 1.2 2000/05/13 08:45:08 lukem Exp $ # # PROVIDE: quota # REQUIRE: mountall +# BEFORE: DAEMON . /etc/rc.subr diff --git a/etc/rc.d/racoon b/etc/rc.d/racoon index ebc06279f78d..cd30b083093f 100755 --- a/etc/rc.d/racoon +++ b/etc/rc.d/racoon @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD$ +# $NetBSD: racoon,v 1.2 2001/04/26 03:55:16 lukem Exp $ # # PROVIDE: ike -# REQUIRE: kdc ppp +# REQUIRE: isdnd kdc ppp +# BEFORE: SERVERS . /etc/rc.subr diff --git a/etc/rc.d/raidframe b/etc/rc.d/raidframe index 640ad6f9dad4..e0a974ad593a 100755 --- a/etc/rc.d/raidframe +++ b/etc/rc.d/raidframe @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: raidframe,v 1.4 2000/05/16 16:54:33 oster Exp $ +# $NetBSD: raidframe,v 1.5 2000/11/17 05:43:46 lukem Exp $ # # PROVIDE: disks @@ -13,7 +13,7 @@ stop_cmd=":" raidframe_start() { - # Configure raid devices. + # Configure non-auto-configured raid devices. # Ensure order by globbing raid[0-9].conf before raid[0-9][0-9].conf. # for cfg in /etc/raid[0-9].conf /etc/raid[0-9][0-9].conf ; do @@ -23,18 +23,15 @@ raidframe_start() raidctl -c $cfg $dev done - # Initiate parity/mirror reconstruction as needed. - # Backgrounded, and sequentially ordered. - # - # XXX: this currently doesn't work for autoconfigured raid devices - # that don't have a corresponding raidN.conf + # Initiate parity/mirror reconstruction as needed, in the background. # ( - for cfg in /etc/raid[0-9].conf /etc/raid[0-9][0-9].conf ; do - [ ! -f $cfg ] && continue - dev=${cfg##*/} - dev=${dev%%.conf} - raidctl -P $dev + for dev in `sysctl -n hw.disknames`; do + case $dev in + raid[0-9]*) + raidctl -P $dev + ;; + esac done ) & } diff --git a/etc/rc.d/rarpd b/etc/rc.d/rarpd index b0e4212d4469..c5bbd9352781 100755 --- a/etc/rc.d/rarpd +++ b/etc/rc.d/rarpd @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: rarpd,v 1.3 2000/05/13 08:45:09 lukem Exp $ +# $NetBSD: rarpd,v 1.4 2000/09/19 13:04:39 lukem Exp $ # # PROVIDE: rarpd # REQUIRE: DAEMON +# BEFORE: LOGIN . /etc/rc.subr diff --git a/etc/rc.d/rbootd b/etc/rc.d/rbootd index ba64fdf8bf6c..b205768f5b61 100755 --- a/etc/rc.d/rbootd +++ b/etc/rc.d/rbootd @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: rbootd,v 1.4 2000/05/13 08:45:09 lukem Exp $ +# $NetBSD: rbootd,v 1.5 2000/09/19 13:04:39 lukem Exp $ # # PROVIDE: rbootd # REQUIRE: DAEMON +# BEFORE: LOGIN . /etc/rc.subr diff --git a/etc/rc.d/route6d b/etc/rc.d/route6d index 0edfcb3df9c8..be157f536ae7 100755 --- a/etc/rc.d/route6d +++ b/etc/rc.d/route6d @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: route6d,v 1.3 2000/05/13 08:45:09 lukem Exp $ +# $NetBSD: route6d,v 1.4 2000/09/19 13:04:39 lukem Exp $ # # PROVIDE: route6d # REQUIRE: DAEMON +# BEFORE: LOGIN . /etc/rc.subr diff --git a/etc/rc.d/routed b/etc/rc.d/routed index c9ae52393784..e96aa393dc07 100755 --- a/etc/rc.d/routed +++ b/etc/rc.d/routed @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: routed,v 1.4 2000/05/13 08:45:09 lukem Exp $ +# $NetBSD: routed,v 1.6 2001/04/06 09:38:54 wiz Exp $ # # PROVIDE: routed -# REQUIRE: DAEMON gated +# REQUIRE: DAEMON +# BEFORE: LOGIN . /etc/rc.subr diff --git a/etc/rc.d/rpcbind b/etc/rc.d/rpcbind index 1715975fa148..1a479e9ef305 100755 --- a/etc/rc.d/rpcbind +++ b/etc/rc.d/rpcbind @@ -1,10 +1,10 @@ #!/bin/sh # -# $NetBSD: rpcbind,v 1.4 2000/07/26 00:11:49 lukem Exp $ +# $NetBSD: rpcbind,v 1.5 2000/09/19 13:04:39 lukem Exp $ # # PROVIDE: rpcbind -# REQUIRE: NETWORK ntpdate syslogd named ppp +# REQUIRE: NETWORKING ntpdate syslogd named ppp . /etc/rc.subr diff --git a/etc/rc.d/rtadvd b/etc/rc.d/rtadvd index 73470358e052..4ec9c7f079e2 100755 --- a/etc/rc.d/rtadvd +++ b/etc/rc.d/rtadvd @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: rtadvd,v 1.3 2000/05/13 08:45:09 lukem Exp $ +# $NetBSD: rtadvd,v 1.4 2000/09/19 13:04:39 lukem Exp $ # # PROVIDE: rtadvd # REQUIRE: DAEMON +# BEFORE: LOGIN . /etc/rc.subr diff --git a/etc/rc.d/rtsold b/etc/rc.d/rtsold index 840ab2abb8ee..ef9b07c2ffb4 100755 --- a/etc/rc.d/rtsold +++ b/etc/rc.d/rtsold @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: rtsold,v 1.3 2000/05/13 08:45:09 lukem Exp $ +# $NetBSD: rtsold,v 1.4 2000/09/19 13:04:39 lukem Exp $ # # PROVIDE: rtsold # REQUIRE: DAEMON +# BEFORE: LOGIN . /etc/rc.subr diff --git a/etc/rc.d/rwho b/etc/rc.d/rwho index e62817165f29..6361ea74b6c3 100755 --- a/etc/rc.d/rwho +++ b/etc/rc.d/rwho @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: rwho,v 1.3 2000/05/13 08:45:09 lukem Exp $ +# $NetBSD: rwho,v 1.4 2000/09/19 13:04:39 lukem Exp $ # # PROVIDE: rwho # REQUIRE: DAEMON +# BEFORE: LOGIN . /etc/rc.subr diff --git a/etc/rc.d/savecore b/etc/rc.d/savecore index 5b6e1150b246..054ba80edb76 100755 --- a/etc/rc.d/savecore +++ b/etc/rc.d/savecore @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: savecore,v 1.2 2000/05/13 08:45:09 lukem Exp $ +# $NetBSD: savecore,v 1.4 2002/03/22 04:16:39 lukem Exp $ # # PROVIDE: savecore # REQUIRE: syslogd +# BEFORE: SERVERS . /etc/rc.subr @@ -20,7 +21,7 @@ savecore_start() # if [ -d /var/crash/. ]; then echo "Checking for core dump..." - savecore $savecore_flags /var/crash + savecore $rc_flags /var/crash else warn "No /var/crash directory; savecore not run." fi diff --git a/etc/rc.d/screenblank b/etc/rc.d/screenblank index 6ac8f5ed9b73..b71b7e7ad29d 100755 --- a/etc/rc.d/screenblank +++ b/etc/rc.d/screenblank @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: screenblank,v 1.3 2000/05/13 08:45:09 lukem Exp $ +# $NetBSD: screenblank,v 1.4 2000/09/19 13:04:39 lukem Exp $ # # PROVIDE: screenblank # REQUIRE: DAEMON +# BEFORE: LOGIN . /etc/rc.subr diff --git a/etc/rc.d/securelevel b/etc/rc.d/securelevel index a683a7456397..bfeca93d8f9d 100755 --- a/etc/rc.d/securelevel +++ b/etc/rc.d/securelevel @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: securelevel,v 1.1 2000/08/21 23:31:24 lukem Exp $ +# $NetBSD: securelevel,v 1.3 2002/03/01 17:58:00 mrg Exp $ # # PROVIDE: securelevel # REQUIRE: aftermountlkm ipnat mountd +# BEFORE: DAEMON . /etc/rc.subr @@ -14,15 +15,21 @@ stop_cmd=":" securelevel_start() { - # if $securelevel is set, change it here, else if it is 0, - # change it to 1 here, before we start daemons or login services. + # if $securelevel is set higher, change it here, else if + # it is 0, change it to 1 here, before we start daemons + # or login services. # - if [ -n "$securelevel" ]; then - echo -n "Setting securelevel: " - sysctl -w kern.securelevel=$securelevel + osecurelevel=`sysctl -n kern.securelevel` + if [ -n "$securelevel" -a "$securelevel" != "$osecurelevel" ]; then + if [ "$securelevel" -lt "$osecurelevel" ]; then + echo "Can't lower securelevel." + exit 1 + else + echo -n "Setting securelevel: " + sysctl -w kern.securelevel=$securelevel + fi else - securelevel=`sysctl -n kern.securelevel` - if [ x"$securelevel" = x0 ]; then + if [ "$osecurelevel" = 0 ]; then echo -n "Setting securelevel: " sysctl -w kern.securelevel=1 fi diff --git a/etc/rc.d/sendmail b/etc/rc.d/sendmail index 61a0b6f4db2f..992db664fa4a 100755 --- a/etc/rc.d/sendmail +++ b/etc/rc.d/sendmail @@ -1,14 +1,12 @@ #!/bin/sh # -# $NetBSD: sendmail,v 1.12 2000/10/09 06:11:38 nisimura Exp $ +# $NetBSD: sendmail,v 1.13 2000/12/18 07:56:41 jmc Exp $ # # PROVIDE: mail # REQUIRE: LOGIN - -# we could do this, but make mail start late, so that things like -# .forward's are not processed until the system is fully operational -## REQUIRE: DAEMON +# we make mail start late, so that things like .forward's are not +# processed until the system is fully operational . /etc/rc.subr @@ -47,8 +45,8 @@ sendmail_precmd() # check couple of common db files, too for f in genericstable virtusertable domaintable mailertable; do - if [ -r "/etc/mail/$f" ] && [ "/etc/mail/$f" -nt "/etc/mail/$f.db" ]; - then + if [ -r "/etc/mail/$f" -a \ + "/etc/mail/$f" -nt "/etc/mail/$f.db" ]; then echo \ "${name}: /etc/mail/$f newer than /etc/mail/$f.db, regenerating" /usr/sbin/makemap hash /etc/mail/$f < /etc/mail/$f diff --git a/etc/rc.d/sshd b/etc/rc.d/sshd index e31a0282f868..bf6f3a8efa57 100755 --- a/etc/rc.d/sshd +++ b/etc/rc.d/sshd @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: sshd,v 1.7 2000/08/10 22:49:43 lukem Exp $ +# $NetBSD: sshd,v 1.17 2002/04/29 05:55:06 lukem Exp $ # # PROVIDE: sshd @@ -12,32 +12,46 @@ name="sshd" rcvar=$name command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" -required_files="/etc/${name}.conf" +required_files="/etc/ssh/sshd_config" extra_commands="keygen reload" sshd_keygen() { - if [ -f /etc/ssh_host_key ]; then - echo "You already have an RSA host key in /etc/ssh_host_key" - echo "Skipping RSA Key Generation" + ( + umask 022 + if [ -f /etc/ssh/ssh_host_key ]; then + echo "You already have an RSA host key" \ + "in /etc/ssh/ssh_host_key" + echo "Skipping protocol version 1 RSA Key Generation" else - umask 022 - /usr/bin/ssh-keygen -b 1024 -f /etc/ssh_host_key -N '' + /usr/bin/ssh-keygen -t rsa1 -b 1024 \ + -f /etc/ssh/ssh_host_key -N '' fi - if [ -f /etc/ssh_host_dsa_key ]; then - echo "You already have a DSA host key in /etc/ssh_host_dsa_key" - echo "Skipping DSA Key Generation" + if [ -f /etc/ssh/ssh_host_dsa_key ]; then + echo "You already have a DSA host key" \ + "in /etc/ssh/ssh_host_dsa_key" + echo "Skipping protocol version 2 DSA Key Generation" else - umask 022 - /usr/bin/ssh-keygen -d -f /etc/ssh_host_dsa_key -N '' + /usr/bin/ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N '' fi + + if [ -f /etc/ssh/ssh_host_rsa_key ]; then + echo "You already have a RSA host key" \ + "in /etc/ssh/ssh_host_rsa_key" + echo "Skipping protocol version 2 RSA Key Generation" + else + /usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' + fi + ) } sshd_precmd() { - if [ ! -f /etc/ssh_host_key -o ! -f /etc/ssh_host_dsa_key ]; then - /etc/rc.d/sshd keygen + if [ ! -f /etc/ssh/ssh_host_key -o \ + ! -f /etc/ssh/ssh_host_dsa_key -o \ + ! -f /etc/ssh/ssh_host_rsa_key ]; then + run_rc_command keygen fi } diff --git a/etc/rc.d/swap1 b/etc/rc.d/swap1 index 0582498af949..4977e867c405 100755 --- a/etc/rc.d/swap1 +++ b/etc/rc.d/swap1 @@ -1,23 +1,37 @@ #!/bin/sh # -# $NetBSD: swap1,v 1.4 2000/05/13 08:45:09 lukem Exp $ +# $NetBSD: swap1,v 1.7 2002/03/21 23:08:36 lukem Exp $ # # PROVIDE: localswap # REQUIRE: disks +# KEYWORD: shutdown . /etc/rc.subr name="swap1" +start_cmd="swap1_start" +stop_cmd="swap1_stop" # Add all block-type swap devices; these might be necessary # during disk checks. # -start_cmd='swapctl -A -t blk' +swap1_start() +{ + if ! checkyesno no_swap; then + swapctl -A -t blk + fi +} # Remove all block-type swap devices # -stop_cmd="swapctl -U -t blk" +swap1_stop() +{ + if checkyesno swapoff || [ -n "$rc_force" ]; then + echo "Removing block-type swap devices" + swapctl -U -t blk + fi +} load_rc_config swap run_rc_command "$1" diff --git a/etc/rc.d/swap2 b/etc/rc.d/swap2 index 288e620abbb0..9d17925430f7 100755 --- a/etc/rc.d/swap2 +++ b/etc/rc.d/swap2 @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: swap2,v 1.4 2000/07/17 12:27:04 lukem Exp $ +# $NetBSD: swap2,v 1.5 2000/08/21 23:35:41 lukem Exp $ # # PROVIDE: nonlocalswap # REQUIRE: mountcritremote +# BEFORE: DAEMON . /etc/rc.subr diff --git a/etc/rc.d/sysctl b/etc/rc.d/sysctl index 90c4f2cf8cfd..c402146e219d 100644 --- a/etc/rc.d/sysctl +++ b/etc/rc.d/sysctl @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: sysctl,v 1.8 2000/06/13 16:29:55 itojun Exp $ +# $NetBSD: sysctl,v 1.11 2002/03/27 08:03:08 lukem Exp $ # # PROVIDE: sysctl # REQUIRE: root ipfilter ipsec +# BEFORE: DAEMON . /etc/rc.subr @@ -14,22 +15,6 @@ stop_cmd=":" sysctl_start() { - if [ -n "$defcorename" ]; then - cat <<__EOF__ -*** WARNING: /etc/rc.conf \$defcorename setting is obsolete. Please -*** set kern.defcorename in /etc/sysctl.conf -__EOF__ - sysctl -w kern.defcorename=$defcorename - fi - - if [ -n "$nfsiod_flags" ]; then - cat <<__EOF__ -*** WARNING: /etc/rc.conf \$nfsiod_flags setting is obsolete. Please -*** remove it. If it was set to other than the default of "-n 4", then -*** set vfs.nfs.iothreads in /etc/sysctl.conf -__EOF__ - fi - if [ -r /etc/sysctl.conf ]; then echo "Setting sysctl variables:" sysctl -f /etc/sysctl.conf diff --git a/etc/rc.d/sysdb b/etc/rc.d/sysdb index 29b0d3b1a5c7..f0cfbdd7c79e 100755 --- a/etc/rc.d/sysdb +++ b/etc/rc.d/sysdb @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: sysdb,v 1.6 2000/10/09 05:02:14 nisimura Exp $ +# $NetBSD: sysdb,v 1.8 2001/04/16 01:38:15 lukem Exp $ # # PROVIDE: sysdb # REQUIRE: mountcritremote +# BEFORE: DAEMON . /etc/rc.subr @@ -20,7 +21,7 @@ sysdb_start() # echo "Building databases..." booted_kernel=`sysctl -n machdep.booted_kernel 2>/dev/null` - kvm_mkdb ${booted_kernel:-/netbsd} + kvm_mkdb "${booted_kernel:-/netbsd}" dev_mkdb # Re-create /var/run/utmp, which is deleted by mountcritlocal diff --git a/etc/rc.d/syslogd b/etc/rc.d/syslogd index 2c8caeabad8f..a91da28d034f 100755 --- a/etc/rc.d/syslogd +++ b/etc/rc.d/syslogd @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: syslogd,v 1.6 2000/07/29 21:50:20 veego Exp $ +# $NetBSD: syslogd,v 1.12 2002/03/22 04:34:00 thorpej Exp $ # # PROVIDE: syslogd # REQUIRE: mountcritremote sysdb wscons +# BEFORE: SERVERS . /etc/rc.subr @@ -16,6 +17,8 @@ required_files="/etc/syslog.conf" start_precmd="syslogd_precmd" extra_commands="reload" +_sockfile="/var/run/syslogd.sockets" + syslogd_precmd() { # Transitional symlink for old binaries @@ -23,7 +26,32 @@ syslogd_precmd() if [ ! -h /dev/log ]; then ln -sf /var/run/log /dev/log fi - rm -f /var/run/log + + # Create default list of syslog sockets to watch + # + ( umask 022 ; > $_sockfile ) + + # Find /etc/rc.d scripts with "chrootdir" rcorder(8) keyword, + # and if $${app}_chrootdir is a directory, add appropriate + # syslog socket to list of sockets to watch. + # + for _lr in $(rcorder -k chrootdir /etc/rc.d/*); do + _l=${_lr##*/} + eval _ldir=\$${_l}_chrootdir + if checkyesno $_l && [ -n "$_ldir" ]; then + echo "${_ldir}/var/run/log" >> $_sockfile + fi + done + + # If other sockets have been provided, change run_rc_command()'s + # internal copy of $syslogd_flags to force use of specific + # syslogd sockets. + # + if [ -s $_sockfile ]; then + echo "/var/run/log" >> $_sockfile + rc_flags="-P $_sockfile $rc_flags" + fi + return 0 } diff --git a/etc/rc.d/timed b/etc/rc.d/timed index 097a53c0a1e5..1e12a358deda 100755 --- a/etc/rc.d/timed +++ b/etc/rc.d/timed @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: timed,v 1.3 2000/05/13 08:45:09 lukem Exp $ +# $NetBSD: timed,v 1.4 2000/09/19 13:04:39 lukem Exp $ # # PROVIDE: timed # REQUIRE: DAEMON +# BEFORE: LOGIN . /etc/rc.subr diff --git a/etc/rc.d/ttys b/etc/rc.d/ttys index 6e1285445685..59a7b3098c6e 100755 --- a/etc/rc.d/ttys +++ b/etc/rc.d/ttys @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: ttys,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# $NetBSD: ttys,v 1.3 2001/04/25 12:59:16 lukem Exp $ # # PROVIDE: tty @@ -23,9 +23,15 @@ ttyflags_start() # setup ptys # # XXX: there may be more ptys than this; maybe use - # sysctl to find out how many? + # sysctl kern.maxptys to find out how many? # - chmod 666 /dev/tty[pqrs]* + chmod 666 /dev/tty[p-uw-zP-T][0-9a-zA-Z] + + # only change ttyv* if ttyv0 is not reserved by a console. + # + if [ -c /dev/ttyv1 ]; then + chmod 666 /dev/ttyv[0-9a-zA-Z] + fi } load_rc_config $name diff --git a/etc/rc.d/virecover b/etc/rc.d/virecover index aad6295a808a..66570d034da8 100755 --- a/etc/rc.d/virecover +++ b/etc/rc.d/virecover @@ -1,29 +1,20 @@ #!/bin/sh # -# $NetBSD: virecover,v 1.3 2000/07/26 00:11:49 lukem Exp $ +# $NetBSD: virecover,v 1.5 2001/04/11 21:02:44 aymeric Exp $ # # PROVIDE: virecover # REQUIRE: mountcritremote +# BEFORE: DAEMON # # XXX: should require `mail'! . /etc/rc.subr name="virecover" -start_cmd="virecover_start" +command="/usr/libexec/${name}" stop_cmd=":" - -virecover_start() -{ - recover=`find /var/tmp/vi.recover -name 'recover.*' -type f -print` - if [ -n "$recover" ]; then - echo "Preserving editor files." - for i in $recover; do - sendmail -t < $i - done - fi -} +reload_cmd=":" load_rc_config $name run_rc_command "$1" diff --git a/etc/rc.d/wscons b/etc/rc.d/wscons index a8a7398b3705..2ff2e52da6cc 100755 --- a/etc/rc.d/wscons +++ b/etc/rc.d/wscons @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: wscons,v 1.5 2000/08/21 23:02:25 lukem Exp $ +# $NetBSD: wscons,v 1.8 2002/03/22 04:34:00 thorpej Exp $ # # PROVIDE: wscons # REQUIRE: mountcritremote +# BEFORE: LOGIN . /etc/rc.subr @@ -17,6 +18,7 @@ wscons_start() { wscfg=/usr/sbin/wsconscfg wsfld=/usr/sbin/wsfontload + wsctl=/sbin/wsconsctl config=/etc/wscons.conf usage="Usage: wsconfig [-n] [-f configfile] [-font fontpgm] [-screen screenpgm]" DOIT= @@ -55,6 +57,7 @@ wscons_start() \#*|"") continue ;; + font) name=$arg1 width=$arg2 @@ -87,6 +90,7 @@ wscons_start() cmd="$cmd -N $name $file" eval $DOIT $cmd ;; + screen) idx=$arg1 scr=$arg2 @@ -110,6 +114,7 @@ wscons_start() cmd="$cmd $idx" eval $DOIT $cmd ;; + keyboard) kbd=$arg1 cmd=$wscfg @@ -123,10 +128,39 @@ wscons_start() esac eval $DOIT $cmd ;; + + encoding) + map=$arg1 + cmd="$wsctl -w \"encoding=$map\"" + eval $DOIT $cmd + ;; + + mapfile) + mapfile=$arg1 + ( while read entry; do + case "$entry" in + \#*|"") + continue + ;; + *) + cmd="$wsctl -w \"map+=$entry\"" + cmd="$cmd >/dev/null" + eval $DOIT $cmd + ;; + esac + done ) < $mapfile + ;; + mux) cmd="$wscfg -m $arg1" eval $DOIT $cmd ;; + + setvar) + cmd="$wsctl -w $arg1" + eval $DOIT $cmd + ;; + esac done ) < $config } diff --git a/etc/rc.d/xfs b/etc/rc.d/xfs index f1b4daddb89b..58ac900ee9bb 100755 --- a/etc/rc.d/xfs +++ b/etc/rc.d/xfs @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: xfs,v 1.4 2000/09/19 13:04:39 lukem Exp $ +# $NetBSD: xfs,v 1.5 2000/11/09 00:05:31 jdolecek Exp $ # # PROVIDE: xfs # REQUIRE: mountall cleartmp +# BEFORE: LOGIN . /etc/rc.subr diff --git a/etc/rc.d/ypbind b/etc/rc.d/ypbind index 754908744f68..bc69b3d9f800 100755 --- a/etc/rc.d/ypbind +++ b/etc/rc.d/ypbind @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: ypbind,v 1.3 2000/05/13 08:45:10 lukem Exp $ +# $NetBSD: ypbind,v 1.4 2000/09/19 13:04:39 lukem Exp $ # # PROVIDE: ypbind # REQUIRE: ypserv +# BEFORE: DAEMON . /etc/rc.subr diff --git a/etc/rc.d/yppasswdd b/etc/rc.d/yppasswdd index 4b3ab7045dba..cf5e49645fdd 100755 --- a/etc/rc.d/yppasswdd +++ b/etc/rc.d/yppasswdd @@ -1,10 +1,11 @@ #!/bin/sh # -# $NetBSD: yppasswdd,v 1.4 2000/06/02 22:54:13 fvdl Exp $ +# $NetBSD: yppasswdd,v 1.5 2000/09/19 13:04:39 lukem Exp $ # # PROVIDE: yppasswdd # REQUIRE: ypserv ypbind +# BEFORE: LOGIN . /etc/rc.subr