diff options
author | obrien <obrien@FreeBSD.org> | 2001-06-16 07:16:14 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2001-06-16 07:16:14 +0000 |
commit | 04a12c6e39399ae6419ccf2d6d3c9406513efeba (patch) | |
tree | 06ace61853aeed77ccace8195154f50a0ea686fc /etc | |
parent | 4d3fc79b76a16eb2429bcf457e7e24c622d434c1 (diff) | |
parent | afad76ee76d3a58cf84a1bc6fb12c55552bc5563 (diff) | |
download | FreeBSD-src-04a12c6e39399ae6419ccf2d6d3c9406513efeba.zip FreeBSD-src-04a12c6e39399ae6419ccf2d6d3c9406513efeba.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r78344,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'etc')
79 files changed, 3122 insertions, 0 deletions
diff --git a/etc/rc.d/DAEMON b/etc/rc.d/DAEMON new file mode 100755 index 0000000..5619e56 --- /dev/null +++ b/etc/rc.d/DAEMON @@ -0,0 +1,12 @@ +#!/bin/sh +# +# $NetBSD: DAEMON,v 1.4 2000/08/21 23:39:07 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 + +# This is a dummy dependancy, to ensure that general purpose daemons +# are run _after_ the above are. diff --git a/etc/rc.d/LOGIN b/etc/rc.d/LOGIN new file mode 100755 index 0000000..39fc88b --- /dev/null +++ b/etc/rc.d/LOGIN @@ -0,0 +1,15 @@ +#!/bin/sh +# +# $NetBSD: LOGIN,v 1.3 2000/07/20 23:36:56 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 + +# This is a dummy dependancy 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 +# operational. diff --git a/etc/rc.d/Makefile b/etc/rc.d/Makefile new file mode 100755 index 0000000..9c26553 --- /dev/null +++ b/etc/rc.d/Makefile @@ -0,0 +1,20 @@ +# $NetBSD: Makefile,v 1.16 2001/01/14 15:37:22 minoura Exp $ + +.include <bsd.own.mk> + +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 +FILESDIR= /etc/rc.d +FILESMODE= ${BINMODE} + +NOPROG= noprog + +.include <bsd.prog.mk> diff --git a/etc/rc.d/NETWORK b/etc/rc.d/NETWORK new file mode 100755 index 0000000..92040d2 --- /dev/null +++ b/etc/rc.d/NETWORK @@ -0,0 +1,10 @@ +#!/bin/sh +# +# $NetBSD$ +# + +# PROVIDE: NETWORK +# REQUIRE: network dhclient + +# This is a dummy dependancy, for services which require networking +# to be operational before starting. diff --git a/etc/rc.d/SERVERS b/etc/rc.d/SERVERS new file mode 100755 index 0000000..99a9c17 --- /dev/null +++ b/etc/rc.d/SERVERS @@ -0,0 +1,10 @@ +#!/bin/sh +# +# $NetBSD: SERVERS,v 1.4 2000/09/21 10:38:04 ad Exp $ +# + +# PROVIDE: SERVERS +# REQUIRE: ipmon kdc newsyslog ppp savecore syslogd ike + +# This is a dummy dependancy, for early-start servers relying on +# some basic configuration. diff --git a/etc/rc.d/accounting b/etc/rc.d/accounting new file mode 100755 index 0000000..aecb2ad --- /dev/null +++ b/etc/rc.d/accounting @@ -0,0 +1,31 @@ +#!/bin/sh +# +# $NetBSD: accounting,v 1.2 2000/05/13 08:45:06 lukem Exp $ +# + +# PROVIDE: accounting +# REQUIRE: mountall + +. /etc/rc.subr + +name="accounting" +rcvar=$name +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 + fi +} + +accounting_stop() +{ + echo "Turning off accounting." + /usr/sbin/accton +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/amd b/etc/rc.d/amd new file mode 100755 index 0000000..a674a24 --- /dev/null +++ b/etc/rc.d/amd @@ -0,0 +1,21 @@ +#!/bin/sh +# +# $NetBSD: amd,v 1.6 2000/09/19 13:04:38 lukem Exp $ +# + +# PROVIDE: amd +# REQUIRE: rpcbind mountall ypbind + +. /etc/rc.subr + +name="amd" +rcvar=$name +command="/usr/sbin/${name}" +load_rc_config $name + +command_args='-p -a '$amd_dir' -F /etc/amd.conf >/var/run/amd.pid' +required_files="/etc/amd.conf" +required_dirs="$amd_dir" +required_vars="rpcbind" + +run_rc_command "$1" diff --git a/etc/rc.d/apmd b/etc/rc.d/apmd new file mode 100755 index 0000000..01f26d1 --- /dev/null +++ b/etc/rc.d/apmd @@ -0,0 +1,16 @@ +#!/bin/sh +# +# $NetBSD: apmd,v 1.3 2000/05/13 08:45:06 lukem Exp $ +# + +# PROVIDE: apmd +# REQUIRE: DAEMON + +. /etc/rc.subr + +name="apmd" +rcvar=$name +command="/usr/sbin/${name}" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/bootconf.sh b/etc/rc.d/bootconf.sh new file mode 100755 index 0000000..8f663ca --- /dev/null +++ b/etc/rc.d/bootconf.sh @@ -0,0 +1,69 @@ +#!/bin/sh +# +# $NetBSD: bootconf.sh,v 1.2 2000/08/21 23:34:45 lukem Exp $ +# + +# PROVIDE: bootconf +# REQUIRE: mountcritlocal + +bootconf_start() +{ + # Refer to newbtconf(8) for more information + # + + if [ ! -e /etc/etc.current ]; then + return 0 + fi + if [ -h /etc/etc.default ]; then + def=`ls -ld /etc/etc.default 2>&1` + default="${def##*-> etc.}" + else + default=current + fi + spc="" + for i in /etc/etc.* + do + name="${i##/etc/etc.}" + case $name in + current|default|\*) + continue + ;; + *) + if [ "$name" = "$default" ]; then + echo -n "${spc}[${name}]" + else + echo -n "${spc}${name}" + fi + spc=" " + ;; + esac + done + echo + master=$$ + _DUMMY=/etc/passwd + conf=${_DUMMY} + while [ ! -d /etc/etc.$conf/. ]; do + trap "conf=$default; echo; echo Using default of $conf" 14 + echo -n "Which configuration [$default] ? " + (sleep 30 && kill -ALRM $master) >/dev/null 2>&1 & + read conf + trap : 14 + if [ -z $conf ] ; then + conf=$default + fi + if [ ! -d /etc/etc.$conf/. ]; then + conf=${_DUMMY} + fi + done + rm -f /etc/etc.current + ln -s /etc/etc.$conf /etc/etc.current + if [ -f /etc/rc.conf ] ; then + . /etc/rc.conf + fi +} + +case "$1" in +*start) + bootconf_start + ;; +esac diff --git a/etc/rc.d/bootparams b/etc/rc.d/bootparams new file mode 100755 index 0000000..2f27d4f --- /dev/null +++ b/etc/rc.d/bootparams @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD: bootparams,v 1.4 2000/06/02 22:54:11 fvdl Exp $ +# + +# PROVIDE: bootparams +# REQUIRE: rpcbind DAEMON + +. /etc/rc.subr + +name="bootparamd" +rcvar=$name +command="/usr/sbin/rpc.${name}" +required_files="/etc/bootparams" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/ccd b/etc/rc.d/ccd new file mode 100755 index 0000000..57c6406 --- /dev/null +++ b/etc/rc.d/ccd @@ -0,0 +1,23 @@ +#!/bin/sh +# +# $NetBSD: ccd,v 1.2 2000/04/26 05:13:51 thorpej Exp $ +# + +# PROVIDE: disks + +. /etc/rc.subr + +name="ccd" +start_cmd="ccd_start" +stop_cmd=":" + +ccd_start() +{ + if [ -f /etc/ccd.conf ]; then + echo "Configuring CCD devices." + ccdconfig -C + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/cleartmp b/etc/rc.d/cleartmp new file mode 100755 index 0000000..943e5ca --- /dev/null +++ b/etc/rc.d/cleartmp @@ -0,0 +1,30 @@ +#!/bin/sh +# +# $NetBSD: cleartmp,v 1.2 2000/05/13 08:45:06 lukem Exp $ +# + +# PROVIDE: cleartmp +# REQUIRE: mountall + +. /etc/rc.subr + +name="cleartmp" +rcvar="clear_tmp" +start_cmd="cleartmp_start" +stop_cmd=":" + +cleartmp_start() +{ + echo "Clearing /tmp." + # + # Prune quickly with one rm, then use find to clean up + # /tmp/[lq]* (this is not needed with mfs /tmp, but + # doesn't hurt anything). + # + (cd /tmp && rm -rf [a-km-pr-zA-Z]* && + find -x . ! -name . ! -name lost+found ! -name quota.user \ + ! -name quota.group -exec rm -rf -- {} \; -type d -prune) +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/cron b/etc/rc.d/cron new file mode 100755 index 0000000..9363443 --- /dev/null +++ b/etc/rc.d/cron @@ -0,0 +1,18 @@ +#!/bin/sh +# +# $NetBSD: cron,v 1.4 2000/07/17 15:24:48 lukem Exp $ +# + +# PROVIDE: cron +# REQUIRE: LOGIN +# KEYWORD: shutdown + +. /etc/rc.subr + +name="cron" +rcvar=$name +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/dhclient b/etc/rc.d/dhclient new file mode 100755 index 0000000..453062e --- /dev/null +++ b/etc/rc.d/dhclient @@ -0,0 +1,21 @@ +#!/bin/sh +# +# $NetBSD: dhclient,v 1.6 2000/07/26 00:11:49 lukem Exp $ +# + +# PROVIDE: dhclient +# REQUIRE: network mountcritlocal +# +# Note that there no syslog logging of dhclient messages at boot because +# dhclient needs to start before services that syslog depends upon do. +# + +. /etc/rc.subr + +name="dhclient" +rcvar=$name +command="/sbin/${name}" +pidfile="/var/run/${name}.pid" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/dhcpd b/etc/rc.d/dhcpd new file mode 100755 index 0000000..1126769 --- /dev/null +++ b/etc/rc.d/dhcpd @@ -0,0 +1,18 @@ +#!/bin/sh +# +# $NetBSD: dhcpd,v 1.3 2000/05/13 08:45:06 lukem Exp $ +# + +# PROVIDE: dhcpd +# REQUIRE: DAEMON + +. /etc/rc.subr + +name="dhcpd" +rcvar=$name +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/${name}.conf /var/db/${name}.leases" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/dhcrelay b/etc/rc.d/dhcrelay new file mode 100755 index 0000000..4d76dba --- /dev/null +++ b/etc/rc.d/dhcrelay @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD: dhcrelay,v 1.3 2000/05/13 08:45:06 lukem Exp $ +# + +# PROVIDE: dhcrelay +# REQUIRE: DAEMON + +. /etc/rc.subr + +name="dhcrelay" +rcvar=$name +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/dmesg b/etc/rc.d/dmesg new file mode 100755 index 0000000..41ad00f --- /dev/null +++ b/etc/rc.d/dmesg @@ -0,0 +1,23 @@ +#!/bin/sh +# +# $NetBSD: dmesg,v 1.4 2000/07/26 00:11:49 lukem Exp $ +# + +# PROVIDE: dmesg +# REQUIRE: mountcritremote + +. /etc/rc.subr + +name="dmesg" +rcvar=$name +start_cmd="do_dmesg" +stop_cmd=":" + +do_dmesg() +{ + rm -f /var/run/dmesg.boot + dmesg $dmesg_flags > /var/run/dmesg.boot +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/fsck b/etc/rc.d/fsck new file mode 100755 index 0000000..ddd4302 --- /dev/null +++ b/etc/rc.d/fsck @@ -0,0 +1,68 @@ +#!/bin/sh +# +# $NetBSD$ +# + +# PROVIDE: fsck +# REQUIRE: localswap + +. /etc/rc.subr + +name="fsck" +start_cmd="fsck_start" +stop_cmd=":" + +stop_boot() +{ + # Terminate the process (which may include the parent /etc/rc) + # if booting directly to multiuser mode. + # + if [ "$autoboot" = yes ]; then + kill -TERM $$ + fi + exit 1 +} + +fsck_start() +{ + if [ -e /fastboot ]; then + echo "Fast boot: skipping disk checks." + elif [ "$autoboot" = yes ]; then + # During fsck ignore SIGQUIT + trap : 3 + + echo "Automatic boot in progress: starting file system checks." + fsck -p + case $? in + 0) + ;; + 2) + stop_boot + ;; + 4) + echo "Rebooting..." + reboot + echo "Reboot failed; help!" + stop_boot + ;; + 8) + echo "Automatic file system check failed; help!" + stop_boot + ;; + 12) + echo "Boot interrupted." + stop_boot + ;; + 130) + stop_boot + ;; + *) + echo "Unknown error; help!" + stop_boot + ;; + esac + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/gated b/etc/rc.d/gated new file mode 100755 index 0000000..7a11e8c --- /dev/null +++ b/etc/rc.d/gated @@ -0,0 +1,18 @@ +#!/bin/sh +# +# $NetBSD: gated,v 1.3 2000/05/13 08:45:06 lukem Exp $ +# + +# PROVIDE: gated +# REQUIRE: DAEMON + +. /etc/rc.subr + +name="gated" +rcvar=$name +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/${name}.conf" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/inetd b/etc/rc.d/inetd new file mode 100755 index 0000000..8f6249f --- /dev/null +++ b/etc/rc.d/inetd @@ -0,0 +1,20 @@ +#!/bin/sh +# +# $NetBSD: inetd,v 1.5 2000/07/17 15:24:48 lukem Exp $ +# + +# PROVIDE: inetd +# REQUIRE: DAEMON LOGIN +# KEYWORD: shutdown + +. /etc/rc.subr + +name="inetd" +rcvar=$name +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/${name}.conf" +extra_commands="reload" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/ipfilter b/etc/rc.d/ipfilter new file mode 100755 index 0000000..a2d0c20 --- /dev/null +++ b/etc/rc.d/ipfilter @@ -0,0 +1,79 @@ +#!/bin/sh +# +# $NetBSD: ipfilter,v 1.8 2000/10/01 05:58:06 lukem Exp $ +# + +# PROVIDE: ipfilter +# REQUIRE: root beforenetlkm mountcritlocal tty + +. /etc/rc.subr + +name="ipfilter" +rcvar=$name +start_precmd="ipfilter_prestart" +start_cmd="ipfilter_start" +stop_precmd="test -f /etc/ipf.conf -o -f /etc/ipf6.conf" +stop_cmd="ipfilter_stop" +reload_precmd="$stop_precmd" +reload_cmd="ipfilter_reload" +status_precmd="$stop_precmd" +status_cmd="ipfilter_status" +extra_commands="reload status" + +ipfilter_prestart() +{ + if [ ! -f /etc/ipf.conf ] && [ ! -f /etc/ipf6.conf ]; then + warn "/etc/ipf*.conf not readable; ipfilter start aborted." + # + # If booting directly to multiuser, send SIGTERM to + # the parent (/etc/rc) to abort the boot + # + if [ "$autoboot" = yes ]; then + echo "ERROR: ABORTING BOOT (sending SIGTERM to parent)!" + kill -TERM $$ + exit 1 + fi + return 1 + fi + return 0 +} + +ipfilter_start() +{ + echo "Enabling ipfilter." + /sbin/ipf -E -Fa + if [ -f /etc/ipf.conf ]; then + /sbin/ipf -f /etc/ipf.conf + fi + if [ -f /etc/ipf6.conf ]; then + /sbin/ipf -6 -f /etc/ipf6.conf + fi +} + +ipfilter_stop() +{ + echo "Disabling ipfilter." + /sbin/ipf -D +} + +ipfilter_reload() +{ + echo "Reloading ipfilter rules." + + /sbin/ipf -I -Fa + if [ -f /etc/ipf.conf ] && ! /sbin/ipf -I -f /etc/ipf.conf; then + err 1 "reload of ipf.conf failed; not swapping to new ruleset." + fi + if [ -f /etc/ipf6.conf ] && ! /sbin/ipf -I -6 -f /etc/ipf6.conf; then + err 1 "reload of ipf6.conf failed; not swapping to new ruleset." + fi + /sbin/ipf -s +} + +ipfilter_status() +{ + /sbin/ipf -V +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/ipmon b/etc/rc.d/ipmon new file mode 100755 index 0000000..6f635c5 --- /dev/null +++ b/etc/rc.d/ipmon @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD: ipmon,v 1.2 2000/05/13 08:45:07 lukem Exp $ +# + +# PROVIDE: ipmon +# REQUIRE: syslogd + +. /etc/rc.subr + +name="ipmon" +rcvar=$name +command="/usr/sbin/${name}" +command_args="&" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/ipnat b/etc/rc.d/ipnat new file mode 100755 index 0000000..1ac21c0 --- /dev/null +++ b/etc/rc.d/ipnat @@ -0,0 +1,33 @@ +#!/bin/sh +# +# $NetBSD: ipnat,v 1.5 2000/08/21 23:33:50 lukem Exp $ +# + +# PROVIDE: ipnat +# REQUIRE: ipfilter mountcritremote + +. /etc/rc.subr + +name="ipnat" +rcvar=$name +config="/etc/ipnat.conf" +start_cmd="ipnat_start" +stop_cmd="/usr/sbin/ipnat -F -C" +reload_cmd="/usr/sbin/ipnat -F -C -f ${config}" +extra_commands="reload" + +ipnat_start() +{ + if [ ! -f ${config} ]; then + return 0 + fi + if ! checkyesno ipfilter || [ ! -f /etc/ipf.conf ]; then + echo "Enabling ipfilter for NAT." + /sbin/ipf -E -Fa + fi + echo -n "Installing NAT rules ... " + /usr/sbin/ipnat -F -f ${config} +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/ipsec b/etc/rc.d/ipsec new file mode 100755 index 0000000..01313f9 --- /dev/null +++ b/etc/rc.d/ipsec @@ -0,0 +1,67 @@ +#!/bin/sh +# +# $NetBSD: ipsec,v 1.5 2000/07/21 01:16:07 lukem Exp $ +# + +# PROVIDE: ipsec +# REQUIRE: root beforenetlkm mountcritlocal tty + +# it does not really require beforenetlkm. + +. /etc/rc.subr + +name="ipsec" +rcvar=$name +start_precmd="ipsec_prestart" +start_cmd="ipsec_start" +stop_precmd="test -f /etc/ipsec.conf" +stop_cmd="ipsec_stop" +reload_cmd="ipsec_reload" +extra_commands="reload" + +ipsec_prestart() +{ + if [ ! -f /etc/ipsec.conf ]; then + warn "/etc/ipsec.conf not readable; ipsec start aborted." + # + # If booting directly to multiuser, send SIGTERM to + # the parent (/etc/rc) to abort the boot + # + if [ "$autoboot" = yes ]; then + echo "ERROR: ABORTING BOOT (sending SIGTERM to parent)!" + kill -TERM $$ + exit 1 + fi + return 1 + fi + return 0 +} + +ipsec_start() +{ + echo "Installing ipsec manual keys/policies." + /sbin/setkey -f /etc/ipsec.conf +} + +ipsec_stop() +{ + echo "Clearing ipsec manual keys/policies." + + # still not 100% sure if we would like to do this. + # it is very questionable to do this during shutdown session, since + # it can hang any of remaining IPv4/v6 session. + # + /sbin/setkey -F + /sbin/setkey -FP +} + +ipsec_reload() +{ + echo "Reloading ipsec manual keys/policies." + /sbin/setkey -F + /sbin/setkey -FP + /sbin/setkey -f /etc/ipsec.conf +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/kdc b/etc/rc.d/kdc new file mode 100755 index 0000000..0d887f3 --- /dev/null +++ b/etc/rc.d/kdc @@ -0,0 +1,18 @@ +#!/bin/sh +# +# $NetBSD: kdc,v 1.2 2000/09/19 13:04:38 lukem Exp $ +# + +# PROVIDE: kdc +# REQUIRE: NETWORK + +. /etc/rc.subr + +name="kdc" +rcvar=$name +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/krb5.conf" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/ldconfig b/etc/rc.d/ldconfig new file mode 100755 index 0000000..73cbba5 --- /dev/null +++ b/etc/rc.d/ldconfig @@ -0,0 +1,24 @@ +#!/bin/sh +# +# $NetBSD: ldconfig,v 1.2 2000/05/13 08:45:07 lukem Exp $ +# + +# PROVIDE: ldconfig +# REQUIRE: mountall + +. /etc/rc.subr + +name="ldconfig" +start_cmd="ldconfig_start" +stop_cmd=":" + +ldconfig_start() +{ + if [ -f /sbin/ldconfig ]; then + echo "Creating a.out runtime link editor directory cache." + ldconfig + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/lkm1 b/etc/rc.d/lkm1 new file mode 100755 index 0000000..8e71daf --- /dev/null +++ b/etc/rc.d/lkm1 @@ -0,0 +1,39 @@ +#!/bin/sh +# +# $NetBSD: lkm1,v 1.5 2000/09/19 13:04:38 lukem Exp $ +# + +# PROVIDE: beforenetlkm +# REQUIRE: root bootconf + +. /etc/rc.subr + +name="lkm1" +rcvar="lkm" +start_cmd="lkm1_start" +stop_cmd="lkm1_stop" + +lkm1_start() +{ +# load kernel modules specified in /etc/lkm.conf if the /usr +# filesystem is already present with "/" or can be mounted now +# + if [ -f /etc/rc.lkm ]; then + mount /usr >/dev/null 2>&1 + if [ -x /usr/bin/ld ]; then + lkmstage=BEFORENET + set start ; . /etc/rc.lkm + fi + fi +} + +lkm1_stop() +{ + if [ -f /etc/rc.lkm ] && [ -x /usr/bin/ld ]; then + lkmstage=BEFORENET + set stop ; . /etc/rc.lkm + fi +} + +load_rc_config lkm +run_rc_command "$1" diff --git a/etc/rc.d/lkm2 b/etc/rc.d/lkm2 new file mode 100755 index 0000000..b7b69b9 --- /dev/null +++ b/etc/rc.d/lkm2 @@ -0,0 +1,37 @@ +#!/bin/sh +# +# $NetBSD: lkm2,v 1.3 2000/07/15 02:30:18 lukem Exp $ +# + +# PROVIDE: beforemountlkm +# REQUIRE: syslogd + +. /etc/rc.subr + +name="lkm2" +rcvar="lkm" +start_cmd="lkm2_start" +stop_cmd="lkm2_stop" + +# load kernel modules specified in /etc/lkm.conf +# +lkm2_start() +{ + if [ -r /etc/rc.lkm ]; then + lkmstage=BEFOREMOUNT + set start ; . /etc/rc.lkm + else + warn "/etc/rc.lkm not found; LKMs not loaded." + fi +} + +lkm2_stop() +{ + if [ -r /etc/rc.lkm ]; then + lkmstage=BEFOREMOUNT + set stop ; . /etc/rc.lkm + fi +} + +load_rc_config lkm +run_rc_command "$1" diff --git a/etc/rc.d/lkm3 b/etc/rc.d/lkm3 new file mode 100755 index 0000000..a02e0dc --- /dev/null +++ b/etc/rc.d/lkm3 @@ -0,0 +1,27 @@ +#!/bin/sh +# +# $NetBSD: lkm3,v 1.4 2000/07/15 02:30:18 lukem Exp $ +# + +# PROVIDE: aftermountlkm +# REQUIRE: mountall + +. /etc/rc.subr + +name="lkm3" +rcvar="lkm" +start_cmd="do_lkm3 start" +stop_cmd="do_lkm3 stop" + +do_lkm3() +{ + # (un)load kernel modules specified in /etc/lkm.conf + # + if [ -f /etc/rc.lkm ]; then + lkmstage=AFTERMOUNT + set $1 ; . /etc/rc.lkm + fi +} + +load_rc_config lkm +run_rc_command "$1" diff --git a/etc/rc.d/local b/etc/rc.d/local new file mode 100755 index 0000000..8d6926f --- /dev/null +++ b/etc/rc.d/local @@ -0,0 +1,31 @@ +#!/bin/sh +# +# $NetBSD: local,v 1.4 2000/05/13 08:45:07 lukem Exp $ +# + +# REQUIRE: DAEMON +# PROVIDE: local +# KEYWORD: shutdown + +. /etc/rc.subr + +name="local" +start_cmd="local_start" +stop_cmd="local_stop" + +local_start() +{ + if [ -f /etc/rc.local ]; then + . /etc/rc.local + fi +} + +local_stop() +{ + if [ -f /etc/rc.shutdown.local ]; then + . /etc/rc.shutdown.local + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/lpd b/etc/rc.d/lpd new file mode 100755 index 0000000..83a543a --- /dev/null +++ b/etc/rc.d/lpd @@ -0,0 +1,18 @@ +#!/bin/sh +# +# $NetBSD: lpd,v 1.3 2000/05/13 08:45:07 lukem Exp $ +# + +# PROVIDE: lpd +# REQUIRE: DAEMON + +. /etc/rc.subr + +name="lpd" +rcvar=$name +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/printcap" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/mopd b/etc/rc.d/mopd new file mode 100755 index 0000000..888c4d6 --- /dev/null +++ b/etc/rc.d/mopd @@ -0,0 +1,16 @@ +#!/bin/sh +# +# $NetBSD: mopd,v 1.3 2000/05/13 08:45:07 lukem Exp $ +# + +# PROVIDE: mopd +# REQUIRE: DAEMON + +. /etc/rc.subr + +name="mopd" +rcvar=$name +command="/usr/sbin/${name}" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/motd b/etc/rc.d/motd new file mode 100755 index 0000000..f000364 --- /dev/null +++ b/etc/rc.d/motd @@ -0,0 +1,34 @@ +#!/bin/sh +# +# $NetBSD: motd,v 1.5 2000/09/19 13:04:38 lukem Exp $ +# + +# PROVIDE: motd +# REQUIRE: mountcritremote + +. /etc/rc.subr + +name="motd" +rcvar="update_motd" +start_cmd="motd_start" +stop_cmd=":" + +motd_start() +{ + # Update kernel info in /etc/motd + # Must be done *before* interactive logins are possible + # to prevent possible race conditions. + # + echo "Updating motd." + if [ ! -f /etc/motd ]; then + install -c -o root -g wheel -m 664 /dev/null /etc/motd + fi + 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 +run_rc_command "$1" diff --git a/etc/rc.d/mountall b/etc/rc.d/mountall new file mode 100755 index 0000000..2fd80eb --- /dev/null +++ b/etc/rc.d/mountall @@ -0,0 +1,16 @@ +#!/bin/sh +# +# $NetBSD: mountall,v 1.2 2000/04/27 21:00:50 veego Exp $ +# + +# PROVIDE: mountall +# REQUIRE: beforemountlkm + +. /etc/rc.subr + +name="mountall" +start_cmd="echo 'Mounting all filesystems...'; mount -a" +stop_cmd="echo 'Unmounting all filesystems...'; umount -a" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/mountcritlocal b/etc/rc.d/mountcritlocal new file mode 100755 index 0000000..38b75f4 --- /dev/null +++ b/etc/rc.d/mountcritlocal @@ -0,0 +1,30 @@ +#!/bin/sh +# +# $NetBSD: mountcritlocal,v 1.3 2000/07/26 00:11:49 lukem Exp $ +# + +# PROVIDE: mountcritlocal +# REQUIRE: root + +. /etc/rc.subr + +name="mountcritlocal" +start_cmd="mountcritlocal_start" +stop_cmd=":" + +mountcritlocal_start() +{ + # mount critical local filesystems + # (as specified in $critical_filesystems_beforenet) + # + mount_critical_filesystems local + + # 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.* /var/spool/uucp/STST/* + (cd /var/run && rm -rf -- *) +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/mountcritremote b/etc/rc.d/mountcritremote new file mode 100755 index 0000000..6479ea1 --- /dev/null +++ b/etc/rc.d/mountcritremote @@ -0,0 +1,19 @@ +#!/bin/sh +# +# $NetBSD: mountcritremote,v 1.2 2000/05/13 08:45:07 lukem Exp $ +# + +# PROVIDE: mountcritremote +# REQUIRE: NETWORK root mountcritlocal + +. /etc/rc.subr + +# mount critical remote filesystems +# (as specified in $critical_filesystems) +# +name="mountcritremote" +start_cmd="mount_critical_filesystems remote" +stop_cmd=":" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/mountd b/etc/rc.d/mountd new file mode 100755 index 0000000..d1a64bf --- /dev/null +++ b/etc/rc.d/mountd @@ -0,0 +1,26 @@ +#!/bin/sh +# +# $NetBSD: mountd,v 1.6 2000/06/02 22:54:11 fvdl Exp $ +# + +# PROVIDE: mountd +# REQUIRE: NETWORK mountall beforemountlkm rpcbind quota + +. /etc/rc.subr + +name="mountd" +rcvar="nfs_server" +command="/usr/sbin/${name}" +required_files="/etc/exports" +start_precmd="mountd_precmd" +extra_commands="reload" + +mountd_precmd() +{ + rm -f /var/db/mountdtab + echo -n > /var/db/mountdtab + return 0 +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/mrouted b/etc/rc.d/mrouted new file mode 100755 index 0000000..8239384 --- /dev/null +++ b/etc/rc.d/mrouted @@ -0,0 +1,19 @@ +#!/bin/sh +# +# $NetBSD: mrouted,v 1.4 2000/05/13 08:45:07 lukem Exp $ +# + +# PROVIDE: mrouted +# REQUIRE: DAEMON + +. /etc/rc.subr + +name="mrouted" +rcvar=$name +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/${name}.conf" +extra_commands="reload" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/named b/etc/rc.d/named new file mode 100755 index 0000000..b311822 --- /dev/null +++ b/etc/rc.d/named @@ -0,0 +1,19 @@ +#!/bin/sh +# +# $NetBSD: named,v 1.5 2000/05/13 08:45:07 lukem Exp $ +# + +# PROVIDE: named +# REQUIRE: SERVERS + +. /etc/rc.subr + +name="named" +rcvar=$name +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" + +extra_commands="reload" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/network b/etc/rc.d/network new file mode 100755 index 0000000..c9856b6 --- /dev/null +++ b/etc/rc.d/network @@ -0,0 +1,387 @@ +#!/bin/sh +# +# $NetBSD: network,v 1.29 2001/01/11 17:56:16 itojun Exp $ +# + +# PROVIDE: network +# REQUIRE: ipfilter ipsec mountcritlocal root tty sysctl + +. /etc/rc.subr + +name="network" +start_cmd="network_start" +stop_cmd="network_stop" + +network_start() +{ + # set hostname, turn on network + # + echo "Starting network." + + # If $hostname is set, use it for my Internet name, + # otherwise use /etc/myname + # + if [ -z "$hostname" ] && [ -f /etc/myname ]; then + hostname=`cat /etc/myname` + fi + if [ -n "$hostname" ]; then + echo "Hostname: $hostname" + hostname $hostname + else + # Don't warn about it if we're going to run + # DHCP later, as we will probably get the + # hostname at that time. + # + if ! checkyesno dhclient && [ -z "`hostname`" ]; then + warn "\$hostname not set." + fi + fi + + # Check $domainname first, then /etc/defaultdomain, + # for NIS/YP domain name + # + if [ -z "$domainname" ] && [ -f /etc/defaultdomain ]; then + domainname=`cat /etc/defaultdomain` + fi + if [ -n "$domainname" ]; then + echo "NIS domainname: $domainname" + domainname $domainname + fi + + # Flush all routes just to make sure it is clean + if checkyesno flushroutes; then + route -n flush + fi + + # Set the address for the first loopback interface, so that the + # auto-route from a newly configured interface's address to lo0 + # works correctly. + # + # NOTE: obscure networking problems may 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. + # + route add -inet 127.0.0.0 -netmask 0xff000000 127.0.0.1 -reject + + # IPv6 routing setups, and host/router mode selection. + # + if ifconfig lo0 inet6 >/dev/null 2>&1; then + # We have IPv6 support in kernel. + + # disallow link-local unicast dest without outgoing scope + # identifiers. + # + route add -inet6 fe80:: -prefixlen 10 ::1 -reject + + # disallow site-local unicast dest without outgoing scope + # identifiers. + # If you configure site-locals without scope id (it is + # permissible config for routers that are not on scope + # boundary), you may want to comment the following one out. + # + if ! checkyesno ip6sitelocal; then + route 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 + + # 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 + + # 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 + + # Completely disallow packets to IPv4 compatible prefix. + # This may conflict with RFC1933 under following circumstances: + # (1) An IPv6-only KAME node tries to originate packets to IPv4 + # comatible destination. The KAME node has no IPv4 + # compatible support. Under RFC1933, it should transmit + # native IPv6 packets toward IPv4 compatible destination, + # hoping it would reach a router that forwards the packet + # toward auto-tunnel interface. + # (2) An IPv6-only node originates a packet to IPv4 compatible + # destination. A KAME node is acting as an IPv6 router, and + # asked to forward it. + # 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 + + 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 + + case $ip6mode in + router) + echo 'IPv6 mode: router' + sysctl -w net.inet6.ip6.forwarding=1 >/dev/null + ;; + + autohost) + echo 'IPv6 mode: autoconfigured host' + sysctl -w net.inet6.ip6.accept_rtadv=1 >/dev/null + ;; + + host) + echo 'IPv6 mode: host' + ;; + + *) echo 'WARNING: invalid value in ip6mode' + ;; + + esac + fi + + # Configure all of the network interfaces listed in $net_interfaces; + # if $auto_ifconfig is YES, grab all interfaces from ifconfig. + # In the following, "xxN" stands in for interface names, like "le0". + # For any interfaces that has an $ifconfig_xxN variable associated, + # 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" + # invocation. + # + # In order to configure an interface reasonably, you at the very least + # need to specify "[addr_family] [hostname]" (e.g "inet my.domain.org"), + # and probably a netmask (as in "netmask 0xffffffe0"). You will + # frequently need to specify a media type, as in "media UTP", for + # interface cards with multiple media connections that do not + # autoconfigure. See the ifconfig manual page for details. + # + # Note that /etc/ifconfig.xxN takes multiple lines. The following + # configuration is possible: + # inet 10.1.1.1 netmask 0xffffff00 + # inet 10.1.1.2 netmask 0xffffff00 alias + # inet6 fec0::1 prefixlen 64 alias + # + # You can put shell script fragment into /etc/ifconfig.xxN by + # starting a line with "!". Refer to ifconfig.if(5) for details. + # + if [ "$net_interfaces" != NO ]; then + if checkyesno auto_ifconfig; then + tmp=`ifconfig -l` + for cloner in `ifconfig -C 2>/dev/null`; do + for int in /etc/ifconfig.${cloner}[0-9]*; do + [ ! -f $int ] && break + tmp="$tmp ${int##*.}" + done + done + else + tmp="$net_interfaces" + fi + echo -n 'Configuring network interfaces:' + for int in $tmp; do + eval args=\$ifconfig_$int + if [ -n "$args" ]; then + echo -n " $int" + ifconfig $int $args + elif [ -f /etc/ifconfig.$int ]; then + echo -n " $int" + while read args; do + [ -z "$args" ] && continue + case "$args" in + "#"*) + ;; + "!"*) + eval ${args#*!} + ;; + *) + ifconfig $int $args + ;; + esac + done < /etc/ifconfig.$int + else + if ! checkyesno auto_ifconfig; then + echo + warn \ + "/etc/ifconfig.$int missing and ifconfig_$int not set;" + warn "interface $int not configured." + fi + continue + fi + configured_interfaces="$configured_interfaces $int" + done + echo "." + fi + + # Check $defaultroute, then /etc/mygate, for the name of my gateway + # host. That name must be in /etc/hosts. + # + if [ -z "$defaultroute" ] && [ -f /etc/mygate ]; then + defaultroute=`cat /etc/mygate` + fi + if [ -n "$defaultroute" ]; then + route add default $defaultroute + fi + + # Check if each configured interface xxN has an $ifaliases_xxN variable + # associated, then configure additional IP addresses for that interface. + # The variable contains a list of "address netmask" pairs, with + # "netmask" set to "-" if the interface default netmask is to be used. + # + # Note that $ifaliases_xxN works only with certain configurations and + # considered not recommended. Use /etc/ifconfig.xxN if possible. + # + # + if [ -n "$configured_interfaces" ]; then + echo "Adding interface aliases:" + done_aliases_message=yes + fi + for int in $configured_interfaces; do + eval args=\$ifaliases_$int + if [ -n "$args" ]; then + set -- $args + while [ $# -ge 2 ]; do + addr=$1 ; net=$2 ; shift 2 + if [ "$net" = "-" ]; then + # for compatibility only, obsolete + ifconfig $int inet alias $addr + else + ifconfig $int inet alias $addr \ + netmask $net + fi + # Use loopback, not the wire + route add $addr 127.0.0.1 + done + fi + done + + # /etc/ifaliases, if it exists, contains the names of additional IP + # addresses for each interface. It is formatted as a series of lines + # that contain + # address interface netmask + # + # Note that /etc/ifaliases works only with certain cases only and its + # use is not recommended. Use /etc/ifconfig.xxN instead. + # + # + if [ -f /etc/ifaliases ]; then + if [ "$done_aliases_message" != yes ]; then + echo "Adding interface aliases:" + fi + while read addr int net; do + if [ -z "$net" ]; then + # for compatibility only, obsolete + ifconfig $int inet alias $addr + 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 + + # IPv6 interface autoconfiguration. + # + if ifconfig lo0 inet6 >/dev/null 2>&1; then + # wait till DAD is completed. always invoke it in case + # if are configured manually by ifconfig + # + dadcount=`sysctl -n net.inet6.ip6.dad_count 2>/dev/null` + sleep $dadcount + sleep 1 + + if checkyesno rtsol; then + if [ "$ip6mode" = "autohost" ]; then + echo 'Sending router solicitation...' + rtsol $rtsol_flags + else + echo + warn \ + "ip6mode must be set to 'autohost' to use rtsol." + fi + + # wait till DAD is completed, for global addresses + # configured by router advert message. + # + sleep $dadcount + sleep 1 + fi + fi + + # XXX this must die + if [ -s /etc/netstart.local ]; then + sh /etc/netstart.local start + fi +} + +network_stop() +{ + echo "Stopping network." + + # XXX this must die + if [ -s /etc/netstart.local ]; then + sh /etc/netstart.local stop + fi + + echo "Deleting aliases." + if [ -f /etc/ifaliases ]; then + while read addr int net; do + ifconfig $int inet delete $addr + done < /etc/ifaliases + fi + + for int in `ifconfig -lu`; do + eval args=\$ifaliases_$int + if [ -n "$args" ]; then + set -- $args + while [ $# -ge 2 ]; do + addr=$1 ; net=$2 ; shift 2 + ifconfig $int inet delete $addr + done + fi + done + + # down interfaces + # + echo -n 'Downing network interfaces:' + if [ "$net_interfaces" != NO ]; then + if checkyesno auto_ifconfig; then + tmp=`ifconfig -l` + else + tmp="$net_interfaces" + fi + for int in $tmp; do + eval args=\$ifconfig_$int + if [ -n "$args" ] || [ -f /etc/ifconfig.$int ]; then + echo -n " $int" + ifconfig $int down + fi + done + echo "." + fi + + # flush routes + # + route -n flush + +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/newsyslog b/etc/rc.d/newsyslog new file mode 100755 index 0000000..a842e40 --- /dev/null +++ b/etc/rc.d/newsyslog @@ -0,0 +1,26 @@ +#!/bin/sh +# +# $NetBSD$ +# + +# PROVIDE: newsyslog +# REQUIRE: mountcritremote sysdb +# BEFORE: syslogd + +. /etc/rc.subr + +name="newsyslog" +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 + echo " done." +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/nfsd b/etc/rc.d/nfsd new file mode 100755 index 0000000..a0d3aa1 --- /dev/null +++ b/etc/rc.d/nfsd @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD: nfsd,v 1.2 2000/05/13 08:45:07 lukem Exp $ +# + +# PROVIDE: nfsd +# REQUIRE: mountd + +. /etc/rc.subr + +name="nfsd" +rcvar="nfs_server" +command="/usr/sbin/${name}" +required_vars="rpcbind" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/nfslocking b/etc/rc.d/nfslocking new file mode 100755 index 0000000..bddec82 --- /dev/null +++ b/etc/rc.d/nfslocking @@ -0,0 +1,27 @@ +#!/bin/sh +# +# $NetBSD: nfslocking,v 1.3 2000/05/13 08:45:07 lukem Exp $ +# + +# PROVIDE: nfslocking +# REQUIRE: nfsd + +. /etc/rc.subr + +arg=$1 + +start_precmd='checkyesno nfs_server || checkyesno nfs_client' +stop_precmd=$start_precmd +status_precmd=$start_precmd + +name="statd" +rcvar=$name +command="/usr/sbin/rpc.${name}" +load_rc_config $name +run_rc_command "$arg" + +name="lockd" +rcvar=$name +command="/usr/sbin/rpc.${name}" +load_rc_config $name +run_rc_command "$arg" diff --git a/etc/rc.d/ntpd b/etc/rc.d/ntpd new file mode 100755 index 0000000..b09c4d1 --- /dev/null +++ b/etc/rc.d/ntpd @@ -0,0 +1,18 @@ +#!/bin/sh +# +# $NetBSD: ntpd,v 1.2 2000/05/13 08:45:07 lukem Exp $ +# + +# PROVIDE: ntpd +# REQUIRE: DAEMON + +. /etc/rc.subr + +name="ntpd" +rcvar=$name +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/ntp.conf" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/ntpdate b/etc/rc.d/ntpdate new file mode 100755 index 0000000..d0a8a18 --- /dev/null +++ b/etc/rc.d/ntpdate @@ -0,0 +1,31 @@ +#!/bin/sh +# +# $NetBSD: ntpdate,v 1.5 2000/08/21 14:48:39 abs Exp $ +# + +# PROVIDE: ntpdate +# REQUIRE: NETWORK syslogd + +. /etc/rc.subr + +name="ntpdate" +rcvar=$name +start_cmd="ntpdate_start" +stop_cmd=":" + +ntpdate_start() +{ + if [ -z "$ntpdate_hosts" ]; then + ntpdate_hosts=`awk ' + /^server[ \t]*127.127/ {next} + /^(server|peer)/ {print $2} + ' </etc/ntp.conf` + fi + if [ -n "$ntpdate_hosts" ]; then + echo "Setting date via ntp." + ntpdate $ntpdate_flags $ntpdate_hosts + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/poffd b/etc/rc.d/poffd new file mode 100644 index 0000000..12422c4 --- /dev/null +++ b/etc/rc.d/poffd @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD$ +# + +# PROVIDE: poffd +# REQUIRE: DAEMON + +. /etc/rc.subr + +name="poffd" +rcvar=$name +command="/usr/sbin/${name}" +start_precmd="test -c /dev/pow0" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/postfix b/etc/rc.d/postfix new file mode 100755 index 0000000..b453464 --- /dev/null +++ b/etc/rc.d/postfix @@ -0,0 +1,24 @@ +#!/bin/sh +# +# $NetBSD: postfix,v 1.4 2000/05/13 08:45:08 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 + +. /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" +extra_commands="reload" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/pwcheck b/etc/rc.d/pwcheck new file mode 100755 index 0000000..80949e9 --- /dev/null +++ b/etc/rc.d/pwcheck @@ -0,0 +1,26 @@ +#!/bin/sh +# +# $NetBSD: pwcheck,v 1.2 2000/05/13 08:45:08 lukem Exp $ +# + +# PROVIDE: pwcheck +# REQUIRE: mountcritremote syslogd + +. /etc/rc.subr + +name="pwcheck" +start_cmd="pwcheck_start" +stop_cmd=":" + +pwcheck_start() +{ + # check the password temp/lock file + # + if [ -f /etc/ptmp ]; then + logger -s -p auth.err \ + "password file may be incorrect -- /etc/ptmp exists" + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/quota b/etc/rc.d/quota new file mode 100755 index 0000000..8f63255 --- /dev/null +++ b/etc/rc.d/quota @@ -0,0 +1,24 @@ +#!/bin/sh +# +# $NetBSD: quota,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: quota +# REQUIRE: mountall + +. /etc/rc.subr + +name="quota" +start_cmd="quota_start" +stop_cmd="/usr/sbin/quotaoff -a" + +quota_start() +{ + echo -n "Checking quotas:" + /usr/sbin/quotacheck -a + echo " done." + /usr/sbin/quotaon -a +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/racoon b/etc/rc.d/racoon new file mode 100755 index 0000000..ebc0627 --- /dev/null +++ b/etc/rc.d/racoon @@ -0,0 +1,18 @@ +#!/bin/sh +# +# $NetBSD$ +# + +# PROVIDE: ike +# REQUIRE: kdc ppp + +. /etc/rc.subr + +name="racoon" +rcvar=$name +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/racoon/racoon.conf" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/raidframe b/etc/rc.d/raidframe new file mode 100755 index 0000000..640ad6f --- /dev/null +++ b/etc/rc.d/raidframe @@ -0,0 +1,43 @@ +#!/bin/sh +# +# $NetBSD: raidframe,v 1.4 2000/05/16 16:54:33 oster Exp $ +# + +# PROVIDE: disks + +. /etc/rc.subr + +name="raidframe" +start_cmd="raidframe_start" +stop_cmd=":" + +raidframe_start() +{ + # Configure 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 + [ ! -f $cfg ] && continue + dev=${cfg##*/} + dev=${dev%%.conf} + 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 + # + ( + 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 + done + ) & +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/rarpd b/etc/rc.d/rarpd new file mode 100755 index 0000000..b0e4212 --- /dev/null +++ b/etc/rc.d/rarpd @@ -0,0 +1,18 @@ +#!/bin/sh +# +# $NetBSD: rarpd,v 1.3 2000/05/13 08:45:09 lukem Exp $ +# + +# PROVIDE: rarpd +# REQUIRE: DAEMON + +. /etc/rc.subr + +name="rarpd" +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/rbootd b/etc/rc.d/rbootd new file mode 100755 index 0000000..ba64fdf --- /dev/null +++ b/etc/rc.d/rbootd @@ -0,0 +1,19 @@ +#!/bin/sh +# +# $NetBSD: rbootd,v 1.4 2000/05/13 08:45:09 lukem Exp $ +# + +# PROVIDE: rbootd +# REQUIRE: DAEMON + +. /etc/rc.subr + +name="rbootd" +rcvar=$name +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/${name}.conf" +extra_commands="reload" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/root b/etc/rc.d/root new file mode 100755 index 0000000..8a7e3b0 --- /dev/null +++ b/etc/rc.d/root @@ -0,0 +1,23 @@ +#!/bin/sh +# +# $NetBSD: root,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: root +# REQUIRE: fsck + +. /etc/rc.subr + +name="root" +start_cmd="root_start" +stop_cmd=":" + +root_start() +{ + umount -a >/dev/null 2>&1 + mount / + rm -f /fastboot +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/route6d b/etc/rc.d/route6d new file mode 100755 index 0000000..0edfcb3 --- /dev/null +++ b/etc/rc.d/route6d @@ -0,0 +1,16 @@ +#!/bin/sh +# +# $NetBSD: route6d,v 1.3 2000/05/13 08:45:09 lukem Exp $ +# + +# PROVIDE: route6d +# REQUIRE: DAEMON + +. /etc/rc.subr + +name="route6d" +rcvar=$name +command="/usr/sbin/${name}" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/routed b/etc/rc.d/routed new file mode 100755 index 0000000..c9ae523 --- /dev/null +++ b/etc/rc.d/routed @@ -0,0 +1,25 @@ +#!/bin/sh +# +# $NetBSD: routed,v 1.4 2000/05/13 08:45:09 lukem Exp $ +# + +# PROVIDE: routed +# REQUIRE: DAEMON gated + +. /etc/rc.subr + +name="routed" +rcvar=$name +command="/sbin/${name}" +start_precmd="routed_precmd" + +routed_precmd() +{ + if checkyesno gated && checkyesno routed; then + warn "gated and routed both requested to be run: only running gated." + return 1 + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/rpcbind b/etc/rc.d/rpcbind new file mode 100755 index 0000000..1715975 --- /dev/null +++ b/etc/rc.d/rpcbind @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD: rpcbind,v 1.4 2000/07/26 00:11:49 lukem Exp $ +# + +# PROVIDE: rpcbind +# REQUIRE: NETWORK ntpdate syslogd named ppp + +. /etc/rc.subr + +name="rpcbind" +rcvar=$name +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/rtadvd b/etc/rc.d/rtadvd new file mode 100755 index 0000000..7347035 --- /dev/null +++ b/etc/rc.d/rtadvd @@ -0,0 +1,26 @@ +#!/bin/sh +# +# $NetBSD: rtadvd,v 1.3 2000/05/13 08:45:09 lukem Exp $ +# + +# PROVIDE: rtadvd +# REQUIRE: DAEMON + +. /etc/rc.subr + +name="rtadvd" +rcvar=$name +command="/usr/sbin/${name}" +start_precmd="rtadvd_precmd" + +rtadvd_precmd() +{ + if [ "$ip6mode" != "router" ]; then + warn \ + "${name} cannot be used on IPv6 host, only on an IPv6 router." + return 1 + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/rtsold b/etc/rc.d/rtsold new file mode 100755 index 0000000..840ab2a --- /dev/null +++ b/etc/rc.d/rtsold @@ -0,0 +1,25 @@ +#!/bin/sh +# +# $NetBSD: rtsold,v 1.3 2000/05/13 08:45:09 lukem Exp $ +# + +# PROVIDE: rtsold +# REQUIRE: DAEMON + +. /etc/rc.subr + +name="rtsold" +rcvar=$name +command="/usr/sbin/${name}" +start_precmd="rtsold_precmd" + +rtsold_precmd() +{ + if [ "$ip6mode" != "autohost" ]; then + warn "\$ip6mode must be set to 'autohost' to use ${name}." + return 1 + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/rwho b/etc/rc.d/rwho new file mode 100755 index 0000000..e628171 --- /dev/null +++ b/etc/rc.d/rwho @@ -0,0 +1,16 @@ +#!/bin/sh +# +# $NetBSD: rwho,v 1.3 2000/05/13 08:45:09 lukem Exp $ +# + +# PROVIDE: rwho +# REQUIRE: DAEMON + +. /etc/rc.subr + +name="rwhod" +rcvar=$name +command="/usr/sbin/${name}" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/savecore b/etc/rc.d/savecore new file mode 100755 index 0000000..5b6e115 --- /dev/null +++ b/etc/rc.d/savecore @@ -0,0 +1,30 @@ +#!/bin/sh +# +# $NetBSD: savecore,v 1.2 2000/05/13 08:45:09 lukem Exp $ +# + +# PROVIDE: savecore +# REQUIRE: syslogd + +. /etc/rc.subr + +name="savecore" +rcvar=$name +start_cmd="savecore_start" +stop_cmd=":" + +savecore_start() +{ + # /var/crash should be a directory or a symbolic link + # to the crash directory if core dumps are to be saved. + # + if [ -d /var/crash/. ]; then + echo "Checking for core dump..." + savecore $savecore_flags /var/crash + else + warn "No /var/crash directory; savecore not run." + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/screenblank b/etc/rc.d/screenblank new file mode 100755 index 0000000..6ac8f5e --- /dev/null +++ b/etc/rc.d/screenblank @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD: screenblank,v 1.3 2000/05/13 08:45:09 lukem Exp $ +# + +# PROVIDE: screenblank +# REQUIRE: DAEMON + +. /etc/rc.subr + +name="screenblank" +rcvar=$name +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/securelevel b/etc/rc.d/securelevel new file mode 100755 index 0000000..a683a74 --- /dev/null +++ b/etc/rc.d/securelevel @@ -0,0 +1,33 @@ +#!/bin/sh +# +# $NetBSD: securelevel,v 1.1 2000/08/21 23:31:24 lukem Exp $ +# + +# PROVIDE: securelevel +# REQUIRE: aftermountlkm ipnat mountd + +. /etc/rc.subr + +name="securelevel" +start_cmd="securelevel_start" +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 [ -n "$securelevel" ]; then + echo -n "Setting securelevel: " + sysctl -w kern.securelevel=$securelevel + else + securelevel=`sysctl -n kern.securelevel` + if [ x"$securelevel" = x0 ]; then + echo -n "Setting securelevel: " + sysctl -w kern.securelevel=1 + fi + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/sendmail b/etc/rc.d/sendmail new file mode 100755 index 0000000..61a0b6f --- /dev/null +++ b/etc/rc.d/sendmail @@ -0,0 +1,60 @@ +#!/bin/sh +# +# $NetBSD: sendmail,v 1.12 2000/10/09 06:11:38 nisimura 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 + +. /etc/rc.subr + +name="sendmail" +rcvar=$name +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/mail/${name}.cf" +start_precmd="sendmail_precmd" + +sendmail_precmd() +{ + # Die if there's pre-8.10 custom configuration file. This check is + # mandatory for smooth upgrade. See NetBSD PR 10100 for details. + # + if checkyesno sendmail && [ -f "/etc/${name}.cf" ]; then + if ! cmp -s "/etc/mail/${name}.cf" "/etc/${name}.cf"; then + warn \ + "${name} was not started; you have multiple copies of sendmail.cf." + return 1 + fi + fi + + # check modifications on /etc/mail/aliases + if [ -f "/etc/mail/aliases.db" ]; then + if [ "/etc/mail/aliases" -nt "/etc/mail/aliases.db" ]; then + echo \ + "${name}: /etc/mail/aliases newer than /etc/mail/aliases.db, regenerating" + /usr/bin/newaliases + fi + else + echo \ + "${name}: /etc/mail/aliases.db not present, generating" + /usr/bin/newaliases + fi + + # 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 + echo \ + "${name}: /etc/mail/$f newer than /etc/mail/$f.db, regenerating" + /usr/sbin/makemap hash /etc/mail/$f < /etc/mail/$f + fi + done +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/sshd b/etc/rc.d/sshd new file mode 100755 index 0000000..e31a028 --- /dev/null +++ b/etc/rc.d/sshd @@ -0,0 +1,48 @@ +#!/bin/sh +# +# $NetBSD: sshd,v 1.7 2000/08/10 22:49:43 lukem Exp $ +# + +# PROVIDE: sshd +# REQUIRE: LOGIN + +. /etc/rc.subr + +name="sshd" +rcvar=$name +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/${name}.conf" +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" + else + umask 022 + /usr/bin/ssh-keygen -b 1024 -f /etc/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" + else + umask 022 + /usr/bin/ssh-keygen -d -f /etc/ssh_host_dsa_key -N '' + fi +} + +sshd_precmd() +{ + if [ ! -f /etc/ssh_host_key -o ! -f /etc/ssh_host_dsa_key ]; then + /etc/rc.d/sshd keygen + fi +} + +keygen_cmd=sshd_keygen +start_precmd=sshd_precmd + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/swap1 b/etc/rc.d/swap1 new file mode 100755 index 0000000..0582498 --- /dev/null +++ b/etc/rc.d/swap1 @@ -0,0 +1,23 @@ +#!/bin/sh +# +# $NetBSD: swap1,v 1.4 2000/05/13 08:45:09 lukem Exp $ +# + +# PROVIDE: localswap +# REQUIRE: disks + +. /etc/rc.subr + +name="swap1" + +# Add all block-type swap devices; these might be necessary +# during disk checks. +# +start_cmd='swapctl -A -t blk' + +# Remove all block-type swap devices +# +stop_cmd="swapctl -U -t blk" + +load_rc_config swap +run_rc_command "$1" diff --git a/etc/rc.d/swap2 b/etc/rc.d/swap2 new file mode 100755 index 0000000..288e620 --- /dev/null +++ b/etc/rc.d/swap2 @@ -0,0 +1,35 @@ +#!/bin/sh +# +# $NetBSD: swap2,v 1.4 2000/07/17 12:27:04 lukem Exp $ +# + +# PROVIDE: nonlocalswap +# REQUIRE: mountcritremote + +. /etc/rc.subr + +name="swap2" +start_cmd="swap2_start" + +swap2_start() +{ + # "Critical" file systems are now mounted. Go ahead and swap + # to files now, since they will be residing in the critical file + # systems (or, at least, they should be...). + # Check for no swap, and warn about it unless that is desired. + # + swapctl -A -t noblk; + if ! checkyesno no_swap; then + if swapctl -s | grep "no swap devices configured" > /dev/null; + then + warn "No swap space configured!" + fi + fi +} + +# Remove all non-block-type swap devices +# +stop_cmd="swapctl -U -t noblk" + +load_rc_config swap +run_rc_command "$1" diff --git a/etc/rc.d/sysdb b/etc/rc.d/sysdb new file mode 100755 index 0000000..29b0d3b --- /dev/null +++ b/etc/rc.d/sysdb @@ -0,0 +1,34 @@ +#!/bin/sh +# +# $NetBSD: sysdb,v 1.6 2000/10/09 05:02:14 nisimura Exp $ +# + +# PROVIDE: sysdb +# REQUIRE: mountcritremote + +. /etc/rc.subr + +name="sysdb" +start_cmd="sysdb_start" +stop_cmd=":" + +sysdb_start() +{ + # Build ps databases. If this kernel supports + # machdep.booted_kernel, use that to build the KVM db so dmesg + # will run work when we boot /netbsd.new, etc. + # + echo "Building databases..." + booted_kernel=`sysctl -n machdep.booted_kernel 2>/dev/null` + kvm_mkdb ${booted_kernel:-/netbsd} + dev_mkdb + + # Re-create /var/run/utmp, which is deleted by mountcritlocal + # but can't be recreated by it because install and chown may + # not be available then (possibly no /usr). + # + install -c -m 664 -g utmp /dev/null /var/run/utmp +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/syslogd b/etc/rc.d/syslogd new file mode 100755 index 0000000..2c8caea --- /dev/null +++ b/etc/rc.d/syslogd @@ -0,0 +1,31 @@ +#!/bin/sh +# +# $NetBSD: syslogd,v 1.6 2000/07/29 21:50:20 veego Exp $ +# + +# PROVIDE: syslogd +# REQUIRE: mountcritremote sysdb wscons + +. /etc/rc.subr + +name="syslogd" +rcvar=$name +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/syslog.conf" +start_precmd="syslogd_precmd" +extra_commands="reload" + +syslogd_precmd() +{ + # Transitional symlink for old binaries + # + if [ ! -h /dev/log ]; then + ln -sf /var/run/log /dev/log + fi + rm -f /var/run/log + return 0 +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/timed b/etc/rc.d/timed new file mode 100755 index 0000000..097a53c0 --- /dev/null +++ b/etc/rc.d/timed @@ -0,0 +1,16 @@ +#!/bin/sh +# +# $NetBSD: timed,v 1.3 2000/05/13 08:45:09 lukem Exp $ +# + +# PROVIDE: timed +# REQUIRE: DAEMON + +. /etc/rc.subr + +name="timed" +rcvar=$name +command="/usr/sbin/${name}" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/ttys b/etc/rc.d/ttys new file mode 100755 index 0000000..6e12854 --- /dev/null +++ b/etc/rc.d/ttys @@ -0,0 +1,32 @@ +#!/bin/sh +# +# $NetBSD: ttys,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: tty +# REQUIRE: root + +. /etc/rc.subr + +name="ttyflags" +start_cmd="ttyflags_start" +stop_cmd=":" + +ttyflags_start() +{ + # set flags on ttys. + # (do early, in case they use tty for SLIP in network) + # + echo "Setting tty flags." + ttyflags -a + + # setup ptys + # + # XXX: there may be more ptys than this; maybe use + # sysctl to find out how many? + # + chmod 666 /dev/tty[pqrs]* +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/virecover b/etc/rc.d/virecover new file mode 100755 index 0000000..aad6295 --- /dev/null +++ b/etc/rc.d/virecover @@ -0,0 +1,29 @@ +#!/bin/sh +# +# $NetBSD: virecover,v 1.3 2000/07/26 00:11:49 lukem Exp $ +# + +# PROVIDE: virecover +# REQUIRE: mountcritremote +# +# XXX: should require `mail'! + +. /etc/rc.subr + +name="virecover" +start_cmd="virecover_start" +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 +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/wscons b/etc/rc.d/wscons new file mode 100755 index 0000000..a8a7398 --- /dev/null +++ b/etc/rc.d/wscons @@ -0,0 +1,135 @@ +#!/bin/sh +# +# $NetBSD: wscons,v 1.5 2000/08/21 23:02:25 lukem Exp $ +# + +# PROVIDE: wscons +# REQUIRE: mountcritremote + +. /etc/rc.subr + +name="wscons" +rcvar=$name +start_cmd="wscons_start" +stop_cmd=":" + +wscons_start() +{ + wscfg=/usr/sbin/wsconscfg + wsfld=/usr/sbin/wsfontload + config=/etc/wscons.conf + usage="Usage: wsconfig [-n] [-f configfile] [-font fontpgm] [-screen screenpgm]" + DOIT= + + while [ $# -gt 0 ]; do + case $1 in + -n) + DOIT=echo + ;; + -f) + config=$2 + shift + ;; + -font) + wsfld=$2 + shift + ;; + -screen) + wscfg=$2 + shift + ;; + *) + echo $usage + exit 1 + ;; + esac + shift + done + + + # args mean: + # screen idx scr emul + # font name width height enc file + ( while read type arg1 arg2 arg3 arg4 arg5; do + case "$type" in + \#*|"") + continue + ;; + font) + name=$arg1 + width=$arg2 + height=$arg3 + enc=$arg4 + file=$arg5 + cmd=$wsfld + + case $width in + -) + ;; + *) + cmd="$cmd -w $width" + ;; + esac + case $height in + -) + ;; + *) + cmd="$cmd -h $height" + ;; + esac + case $enc in + -) + ;; + *) + cmd="$cmd -e $enc" + ;; + esac + cmd="$cmd -N $name $file" + eval $DOIT $cmd + ;; + screen) + idx=$arg1 + scr=$arg2 + emul=$arg3 + cmd=$wscfg + + case $scr in + -) + ;; + *) + cmd="$cmd -t $scr" + ;; + esac + case $emul in + -) + ;; + *) + cmd="$cmd -e $emul" + ;; + esac + cmd="$cmd $idx" + eval $DOIT $cmd + ;; + keyboard) + kbd=$arg1 + cmd=$wscfg + case $kbd in + -|auto) + cmd="$cmd -k" + ;; + *) + cmd="$cmd -k $kbd" + ;; + esac + eval $DOIT $cmd + ;; + mux) + cmd="$wscfg -m $arg1" + eval $DOIT $cmd + ;; + esac + done ) < $config +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/xdm b/etc/rc.d/xdm new file mode 100755 index 0000000..a5c6b76 --- /dev/null +++ b/etc/rc.d/xdm @@ -0,0 +1,20 @@ +#!/bin/sh +# +# $NetBSD: xdm,v 1.5 2000/07/17 15:24:48 lukem Exp $ +# + +# PROVIDE: xdm +# REQUIRE: DAEMON LOGIN wscons +# KEYWORD: shutdown + +. /etc/rc.subr + +name="xdm" +rcvar=$name +command="/usr/X11R6/bin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/usr/X11R6/lib/X11/xdm/xdm-config" +extra_commands="reload" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/xfs b/etc/rc.d/xfs new file mode 100755 index 0000000..f1b4dad --- /dev/null +++ b/etc/rc.d/xfs @@ -0,0 +1,19 @@ +#!/bin/sh +# +# $NetBSD: xfs,v 1.4 2000/09/19 13:04:39 lukem Exp $ +# + +# PROVIDE: xfs +# REQUIRE: mountall cleartmp + +. /etc/rc.subr + +name="xfs" +rcvar=$name +command="/usr/X11R6/bin/${name}" +command_args="& sleep 2" +required_files="/usr/X11R6/lib/X11/fs/config" +extra_commands="reload" + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/ypbind b/etc/rc.d/ypbind new file mode 100755 index 0000000..7549087 --- /dev/null +++ b/etc/rc.d/ypbind @@ -0,0 +1,26 @@ +#!/bin/sh +# +# $NetBSD: ypbind,v 1.3 2000/05/13 08:45:10 lukem Exp $ +# + +# PROVIDE: ypbind +# REQUIRE: ypserv + +. /etc/rc.subr + +name="ypbind" +rcvar=$name +command="/usr/sbin/${name}" +start_precmd="ypbind_precmd" + +ypbind_precmd() +{ + _domain=`domainname` + if [ -z "$_domain" ]; then + warn "domainname(1) is not set." + return 1 + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/yppasswdd b/etc/rc.d/yppasswdd new file mode 100755 index 0000000..4b3ab70 --- /dev/null +++ b/etc/rc.d/yppasswdd @@ -0,0 +1,27 @@ +#!/bin/sh +# +# $NetBSD: yppasswdd,v 1.4 2000/06/02 22:54:13 fvdl Exp $ +# + +# PROVIDE: yppasswdd +# REQUIRE: ypserv ypbind + +. /etc/rc.subr + +name="yppasswdd" +rcvar=$name +command="/usr/sbin/rpc.${name}" +required_vars="rpcbind ypserv" +start_precmd="yppasswdd_precmd" + +yppasswdd_precmd() +{ + _domain=`domainname` + if [ -z "$_domain" ]; then + warn "domainname(1) is not set." + return 1 + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.d/ypserv b/etc/rc.d/ypserv new file mode 100755 index 0000000..69fdd20 --- /dev/null +++ b/etc/rc.d/ypserv @@ -0,0 +1,32 @@ +#!/bin/sh +# +# $NetBSD: ypserv,v 1.4 2000/06/02 22:54:13 fvdl Exp $ +# + +# PROVIDE: ypserv +# REQUIRE: rpcbind + +. /etc/rc.subr + +name="ypserv" +rcvar=$name +command="/usr/sbin/${name}" +required_vars="rpcbind" +start_precmd="ypserv_precmd" + +ypserv_precmd() +{ + _domain=`domainname` + if [ -z "$_domain" ]; then + warn "domainname(1) is not set." + return 1 + fi + + if [ ! -d /var/yp/$_domain/. ]; then + warn "/var/yp/$_domain is not a directory." + return 1 + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/etc/rc.subr b/etc/rc.subr new file mode 100644 index 0000000..5292a32 --- /dev/null +++ b/etc/rc.subr @@ -0,0 +1,586 @@ +# $NetBSD: rc.subr,v 1.28 2000/11/06 00:08:30 lukem Exp $ +# +# Copyright (c) 1997-2000 The NetBSD Foundation, Inc. +# All rights reserved. +# +# This code is derived from software contributed to The NetBSD Foundation +# by Luke Mewburn. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed by the NetBSD +# Foundation, Inc. and its contributors. +# 4. Neither the name of The NetBSD Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# rc.subr +# functions used by various rc scripts +# + +# +# functions +# --------- + +# +# checkyesno var +# Test $1 variable, and warn if not set to YES or NO. +# Return 0 if it's "yes" (et al), nonzero otherwise. +# +checkyesno() +{ + eval _value=\$${1} + case $_value in + + # "yes", "true", "on", or "1" + [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) + return 0 + ;; + + # "no", "false", "off", or "0" + [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) + return 1 + ;; + *) + warn "\$${1} is not set properly." + return 1 + ;; + esac +} + +# +# mount_critical_filesystems +# Go through the list of critical filesystems, checking each one +# to see if it is mounted, and if it is not, mounting it. +# +mount_critical_filesystems() +{ + if [ $1 = local ]; then + _fslist=$critical_filesystems_beforenet + else + _fslist=$critical_filesystems + fi + for _fs in $_fslist; do + mount | ( + _ismounted=no + while read what _on on _type type; do + if [ $on = $_fs ]; then + _ismounted=yes + fi + done + if [ $_ismounted = no ]; then + mount $_fs >/dev/null 2>&1 + fi + ) + done +} + +# +# check_pidfile pidfile procname +# Parses the first line of pidfile for a pid, and ensures +# that the process is running and matches procname. +# Prints the matching pid upon success, nothing otherwise. +# +check_pidfile() +{ + _pidfile=$1 + _procname=$2 + if [ -z "$_pidfile" -o -z "$_procname" ]; then + err 3 'USAGE: check_pidfile pidfile procname' + fi + if [ ! -f $_pidfile ]; then + return + fi + read _pid _junk < $_pidfile + if [ -z "$_pid" ]; then + return + fi + _procnamebn=${_procname##*/} + ps -p $_pid -o 'pid,command' | while read _npid _arg0 _argv; do + if [ "$_npid" = "PID" ]; then + continue + fi + if [ "$_arg0" = "$_procname" \ + -o "$_arg0" = "$_procnamebn" \ + -o "$_arg0" = "${_procnamebn}:" \ + -o "$_arg0" = "(${_procnamebn})" ]; then + echo $_npid + return + fi + done +} + +# +# check_process procname +# Ensures that a process (or processes) named procname is running. +# Prints a list of matching pids. +# +check_process() +{ + _procname=$1 + if [ -z "$_procname" ]; then + err 3 'USAGE: check_process procname' + fi + _procnamebn=${_procname##*/} + _pref= + ps -ax -o 'pid,command' | while read _npid _arg0 _argv; do + if [ "$_npid" = "PID" ]; then + continue + fi + if [ "$_arg0" = "$_procname" \ + -o "$_arg0" = "$_procnamebn" \ + -o "$_arg0" = "${_procnamebn}:" \ + -o "$_arg0" = "(${_procnamebn})" ]; then + echo -n "$_pref$_npid" + _pref=" " + fi + done +} + +# +# run_rc_command arg +# Search for arg in the list of supported commands, which is: +# "start stop restart rcvar status ${extra_commands}" +# If there's a match, run ${arg}_cmd or the default command (see below). +# +# If arg has a given prefix, then change the operation as follows: +# prefix operation +# ------ --------- +# fast Skip the pid check. +# force Set ${rcvar} to YES. +# +# The following globals are used: +# +# name needed function +# ---- ------ -------- +# name y Name of script. +# +# command n Full path to command. +# Not needed if ${arg}_cmd is set for +# each keyword. +# +# command_args n Optional args/shell directives for command. +# +# extra_commands n List of extra commands supported. +# +# pidfile n If set, use check_pidfile $pidfile, else if +# $command is set, use check_process $command. +# +# rcvar n This is checked with checkyesno to determine +# if the action should be run. +# +# ${name}_chroot n Directory to chroot to before running ${command} +# +# ${name}_chdir n Directory to cd to before running ${command} +# (if not using ${name}_chroot). +# +# ${name}_flags n Arguments to call ${command} with. +# NOTE: $flags from the parent environment +# can be used to override this. +# +# ${name}_nice n Nice level to run ${command} at. +# +# ${name}_user n User to run ${command} as, using su(1) if not +# using ${name}_chroot. +# +# ${name}_group n Group to run chrooted ${command} as. +# +# ${name}_groups n Supplementary group list to run chrooted +# ${command} with. +# +# ${_arg}_cmd n If set, use this as the action when invoked; +# $_arg is available to the action to use. +# Otherwise, use default command (see below) +# +# ${_arg}_precmd n If set, run just before performing the main +# action in the default command (i.e, after +# checking for required bits and process +# (non)existance). +# If this completes with a non-zero exit code, +# don't run ${_arg}_cmd. +# +# required_dirs n If set, check for the existence of the given +# directories before running the default +# (re)start command. +# +# required_files n If set, check for the readability of the given +# files before running the default (re)start +# command. +# +# required_vars n If set, perform checkyesno on each of the +# listed variables before running the default +# (re)start command. +# +# Default commands for a given arg: +# +# arg default +# --- ------- +# status Show if ${command} is running, etc. +# +# start if !running && checkyesno ${rcvar} +# ${command} +# +# stop if ${pidfile} +# kill $sig_stop `check_pidfile $pidfile` +# else +# kill $sig_stop `check_process $command` +# $sig_stop defaults to TERM. +# +# reload As stop, except use $sig_reload instead. +# $sig_reload defaults to HUP. +# +# restart Run `stop' then `start'. +# +# +run_rc_command() +{ + _arg=$1 + if [ -z "$name" ]; then + err 3 '$name is not set.' + fi + + case "$_arg" in + fast*) # "fast" prefix; don't check pid + _arg=${_arg#fast} + _rc_fast_run=YES + ;; + force*) # "force prefix; always start + _arg=${_arg#force} + _rc_force_run=YES + if [ -n "${rcvar}" ]; then + eval ${rcvar}=YES + fi + ;; + esac + + _keywords="start stop restart rcvar $extra_commands" + _pid= + _pidcmd= + # setup pid check command if not fast + if [ -z "$_rc_fast_run" ]; then + if [ -n "$pidfile" ]; then + _pidcmd='_pid=`check_pidfile '$pidfile' '$command'`' + elif [ -n "$command" ]; then + _pidcmd='_pid=`check_process '$command'`' + fi + if [ -n "$_pidcmd" ]; then + _keywords="${_keywords} status" + fi + fi + + if [ -z "$_arg" ]; then + rc_usage "$_keywords" + fi + + if [ -n "$flags" ]; then # allow override from environment + _flags=$flags + else + eval _flags=\$${name}_flags + fi + eval _chdir=\$${name}_chdir + eval _chroot=\$${name}_chroot + eval _nice=\$${name}_nice + eval _user=\$${name}_user + eval _group=\$${name}_group + eval _groups=\$${name}_groups + + # if ${rcvar} is set, and $1 is not + # "rcvar" or "status", then run + # checkyesno ${rcvar} + # and return if that failed + # + if [ -n "${rcvar}" -a "$_arg" != "rcvar" -a "$_arg" != "status" ]; then + if ! checkyesno ${rcvar}; then + return 0 + fi + fi + + eval $_pidcmd # determine the pid if necessary + + for _elem in $_keywords; do + if [ "$_elem" != "$_arg" ]; then + continue + fi + + # if there's a custom ${XXX_cmd}, + # run that instead of the default + # + eval _cmd=\$${_arg}_cmd + eval _precmd=\$${_arg}_precmd + if [ -n "$_cmd" ]; then + # if the precmd failed and force + # isn't set, exit + # + if ! eval $_precmd && [ -z "$_rc_force_run" ]; then + return 1 + fi + + eval $_cmd + return 0 + fi + + case "$_arg" in # default operations... + + status) + if [ -n "$_pid" ]; then + echo "${name} is running as pid $_pid." + else + echo "${name} is not running." + return 1 + fi + ;; + + start) + if [ -n "$_pid" ]; then + echo "${name} already running? (pid=$_pid)." + exit 1 + fi + + if [ ! -x $command ]; then + return 0 + fi + + # check for required variables, + # directories, and files + # + for _f in $required_vars; do + if ! checkyesno $_f; then + warn "\$${_f} is not set." + if [ -z "$_rc_force_run" ]; then + return 1 + fi + fi + done + for _f in $required_dirs; do + if [ ! -d "${_f}/." ]; then + warn "${_f} is not a directory." + if [ -z "$_rc_force_run" ]; then + return 1 + fi + fi + done + for _f in $required_files; do + if [ ! -r "${_f}" ]; then + warn "${_f} is not readable." + if [ -z "$_rc_force_run" ]; then + return 1 + fi + fi + done + + # if the precmd failed and force + # isn't set, exit + # + if ! eval $_precmd && [ -z "$_rc_force_run" ]; then + return 1 + fi + + + # setup the command to run, and run it + # + echo "Starting ${name}." + if [ -n "$_chroot" ]; then + _doit="\ +${_nice:+nice -n $_nice }\ +chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\ +$_chroot $command $_flags $command_args" + else + _doit="\ +${_user:+su -m $_user -c 'sh -c \"}\ +${_chdir:+cd $_chdir; }\ +${_nice:+nice -n $_nice }\ +$command $_flags $command_args\ +${_user:+\"'}" + fi + eval $_doit + ;; + + stop) + if [ -z "$_pid" ]; then + if [ -n "$pidfile" ]; then + echo \ + "${name} not running? (check $pidfile)." + else + echo "${name} not running?" + fi + exit 1 + fi + + if ! eval $_precmd && [ -z "$_rc_force_run" ]; then + return 1 + fi + echo "Stopping ${name}." + _doit=\ +"${_user:+su -m $_user -c '}kill -${sig_stop:-TERM} $_pid${_user:+'}" + eval $_doit + ;; + + reload) + if [ -z "$_pid" ]; then + if [ -n "$pidfile" ]; then + echo \ + "${name} not running? (check $pidfile)." + else + echo "${name} not running?" + fi + exit 1 + fi + echo "Reloading ${name} config files." + if ! eval $_precmd && [ -z "$_rc_force_run" ]; then + return 1 + fi + _doit=\ +"${_user:+su -m $_user -c '}kill -${sig_reload:-HUP} $_pid${_user:+'}" + eval $_doit + ;; + + restart) + if ! eval $_precmd && [ -z "$_rc_force_run" ]; then + return 1 + fi + # prevent restart being called more + # than once by any given script + # + if [ -n "$_rc_restart_done" ]; then + return 0 + fi + _rc_restart_done=YES + ( $0 ${_rc_force_run:+force}stop ) + sleep 1 + $0 ${_rc_force_run:+force}start + + ;; + + rcvar) + echo "# $name" + if [ -n "$rcvar" ]; then + if checkyesno ${rcvar}; then + echo "\$${rcvar}=YES" + else + echo "\$${rcvar}=NO" + fi + fi + ;; + + *) + rc_usage "$_keywords" + ;; + + esac + return 0 + done + + echo 1>&2 "$0: unknown directive '$_arg'." + rc_usage "$_keywords" + exit 1 +} + +# +# run_rc_script file arg +# Start the script `file' with `arg', and correctly handle the +# return value from the script. If `file' ends with `.sh', it's +# sourced into the current environment. Otherwise it's run as +# a child process. +# +# Note: because `.sh' files are sourced into the current environment +# run_rc_command shouldn't be used because its difficult to ensure +# that the global variable state before and after the sourcing of +# the .sh file won't adversely affect other scripts. +# +run_rc_script() +{ + _file=$1 + _arg=$2 + if [ -z "$_file" -o -z "$_arg" ]; then + err 3 'USAGE: run_rc_script file arg' + fi + + case "$_file" in + *.sh) # run in current shell + set $_arg ; . $_file + ;; + *) # run in subshell + ( set $_arg ; . $_file ) + ;; + esac +} + +# +# load_rc_config +# Source in the configuration file for a given command. +# +load_rc_config() +{ + _command=$1 + if [ -z "$_command" ]; then + err 3 'USAGE: load_rc_config command' + fi + + . /etc/rc.conf + if [ -f /etc/rc.conf.d/"$_command" ]; then + . /etc/rc.conf.d/"$_command" + fi +} + + +# +# rc_usage commands +# Print a usage string for $0, with `commands' being a list of +# valid commands. +# +rc_usage() +{ + echo -n 1>&2 "Usage: $0 [fast|force](" + + _sep= + for _elem in $*; do + echo -n 1>&2 "$_sep$_elem" + _sep="|" + done + echo 1>&2 ")" + exit 1 +} + +# +# err exitval message +# Display message to stderr and log to the syslog, and exit with exitval. +# +err() +{ + exitval=$1 + shift + + logger "$0: ERROR: $*" + echo 1>&2 "$0: ERROR: $*" + exit $exitval +} + +# +# warn message +# Display message to stderr and log to the syslog. +# +warn() +{ + logger "$0: WARNING: $*" + echo 1>&2 "$0: WARNING: $*" +} |