diff --git a/etc/rc.d/Makefile b/etc/rc.d/Makefile new file mode 100755 index 000000000000..71f462ee981b --- /dev/null +++ b/etc/rc.d/Makefile @@ -0,0 +1,17 @@ +# $NetBSD: Makefile,v 1.1.1.1 2000/03/10 11:53:23 lukem Exp $ + +FILES= accounting amd apmd bootparams bootconf.sh ccd cleartmp cron daemon \ + dhclient dhcpd dhcrelay dmesg fsck.sh gated inetd ipfilter ipmon ipnat \ + kerberos ldconfig lkm1 lkm2 lkm3 local login lpd mopd motd \ + mountall mountcritlocal mountcritremote mountd mrouted named network \ + nfsd nfsiod nfslocking ntpdate portmap ppp pwcheck quota raidframe \ + rarpd rbootd root route6d routed rtadvd rtsold rwho savecore \ + screenblank sendmail servers sshd swap1 swap2 sysdb sysctl syslogd \ + systemfs timed ttys virecover wscons xdm xfs xntpd ypbind yppasswdd \ + ypserv +FILESDIR= /etc/rc.d +FILESMODE= ${BINMODE} + +NOPROG= noprog + +.include diff --git a/etc/rc.d/accounting b/etc/rc.d/accounting new file mode 100755 index 000000000000..bd169cfb3fcb --- /dev/null +++ b/etc/rc.d/accounting @@ -0,0 +1,32 @@ +#!/bin/sh +# +# $NetBSD: accounting,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: accounting +# REQUIRE: mountall + +. /etc/rc.subr +. /etc/rc.conf + +name="accounting" +start_precmd="checkyesno accounting" +start_cmd="accounting_start" +stop_precmd=$start_precmd +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 +} + +run_rc_command "$1" diff --git a/etc/rc.d/amd b/etc/rc.d/amd new file mode 100755 index 000000000000..e4b9c0e534f5 --- /dev/null +++ b/etc/rc.d/amd @@ -0,0 +1,19 @@ +#!/bin/sh +# +# $NetBSD: amd,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: amd +# REQUIRE: nfsiod portmap mountall ypbind + +. /etc/rc.subr +. /etc/rc.conf + +name="amd" +command="/usr/sbin/${name}" +command_args='-p -a '$amd_dir' `sed s/#.*$// <'$amd_master'` >/var/run/amd.pid' +required_files="$amd_master" +required_dirs="$amd_dir" +required_vars="portmap" + +run_rc_command "$1" diff --git a/etc/rc.d/apmd b/etc/rc.d/apmd new file mode 100755 index 000000000000..a80300cf95a9 --- /dev/null +++ b/etc/rc.d/apmd @@ -0,0 +1,15 @@ +#!/bin/sh +# +# $NetBSD: apmd,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: apmd +# REQUIRE: daemon + +. /etc/rc.subr +. /etc/rc.conf + +name="apmd" +command="/usr/sbin/${name}" + +run_rc_command "$1" diff --git a/etc/rc.d/bootconf.sh b/etc/rc.d/bootconf.sh new file mode 100755 index 000000000000..9464cf7e5571 --- /dev/null +++ b/etc/rc.d/bootconf.sh @@ -0,0 +1,63 @@ +#!/bin/sh +# +# $NetBSD: bootconf.sh,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: bootconf +# REQUIRE: mountcritlocal +# BEFORE: beforenetlkm + +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=`expr "$def" : '.*-> etc\.\(.*\)' 2>&1` + else + default=current + fi + spc="" + conflist=`cd /etc; ls -1d etc.* 2>&1 | egrep -v "current|default"` + for i in $conflist; do + name=${i#etc.} + if [ "$name" = "$default" ]; then + echo -n "${spc}[${name}]" + else + echo -n "${spc}${name}" + fi + spc=" " + 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 000000000000..f5b1296d5a23 --- /dev/null +++ b/etc/rc.d/bootparams @@ -0,0 +1,16 @@ +#!/bin/sh +# +# $NetBSD: bootparams,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: bootparams +# REQUIRE: portmap daemon + +. /etc/rc.subr +. /etc/rc.conf + +name="bootparamd" +command="/usr/sbin/rpc.${name}" +required_files="/etc/bootparams" + +run_rc_command "$1" diff --git a/etc/rc.d/ccd b/etc/rc.d/ccd new file mode 100755 index 000000000000..a96684a8da0d --- /dev/null +++ b/etc/rc.d/ccd @@ -0,0 +1,23 @@ +#!/bin/sh +# +# $NetBSD: ccd,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: ccd + +. /etc/rc.subr +. /etc/rc.conf + +name="ccd" +start_cmd="ccd_start" +stop_cmd=":" + +ccd_start() +{ + if [ -f /etc/ccd.conf ]; then + echo "Configuring CCD devices." + ccdconfig -C + fi +} + +run_rc_command "$1" diff --git a/etc/rc.d/cleartmp b/etc/rc.d/cleartmp new file mode 100755 index 000000000000..c1c4ba5211eb --- /dev/null +++ b/etc/rc.d/cleartmp @@ -0,0 +1,30 @@ +#!/bin/sh +# +# $NetBSD: cleartmp,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: cleartmp +# REQUIRE: mountall + +. /etc/rc.subr +. /etc/rc.conf + +name="cleartmp" +start_cmd="cleartmp_start" +start_precmd="checkyesno clear_tmp" +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) +} + +run_rc_command "$1" diff --git a/etc/rc.d/cron b/etc/rc.d/cron new file mode 100755 index 000000000000..c94076bb0f60 --- /dev/null +++ b/etc/rc.d/cron @@ -0,0 +1,16 @@ +#!/bin/sh +# +# $NetBSD: cron,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: cron +# REQUIRE: login + +. /etc/rc.subr +. /etc/rc.conf + +name="cron" +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" + +run_rc_command "$1" diff --git a/etc/rc.d/daemon b/etc/rc.d/daemon new file mode 100644 index 000000000000..4c8701564d08 --- /dev/null +++ b/etc/rc.d/daemon @@ -0,0 +1,12 @@ +#!/bin/sh +# +# $NetBSD: daemon,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: daemon +# REQUIRE: named sysctl cleartmp ldconfig accounting amd virecover ypbind +# REQUIRE: ipnat ipmon savecore pwcheck quota databases network dmesg +# REQUIRE: aftermountlkm nfslocking + +# This is a dummy dependancy, to ensure that daemons are run +# _after_ the above are. diff --git a/etc/rc.d/dhclient b/etc/rc.d/dhclient new file mode 100755 index 000000000000..e1fc02d971c7 --- /dev/null +++ b/etc/rc.d/dhclient @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD: dhclient,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: dhclient +# REQUIRE: systemfs syslogd + +. /etc/rc.subr +. /etc/rc.conf + +name="dhclient" +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/${name}.conf /var/db/${name}.leases" + +run_rc_command "$1" diff --git a/etc/rc.d/dhcpd b/etc/rc.d/dhcpd new file mode 100755 index 000000000000..3058971f11c6 --- /dev/null +++ b/etc/rc.d/dhcpd @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD: dhcpd,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: dhcpd +# REQUIRE: daemon + +. /etc/rc.subr +. /etc/rc.conf + +name="dhcpd" +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/${name}.conf /var/db/${name}.leases" + +run_rc_command "$1" diff --git a/etc/rc.d/dhcrelay b/etc/rc.d/dhcrelay new file mode 100755 index 000000000000..65ce17f38609 --- /dev/null +++ b/etc/rc.d/dhcrelay @@ -0,0 +1,16 @@ +#!/bin/sh +# +# $NetBSD: dhcrelay,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: dhcrelay +# REQUIRE: daemon + +. /etc/rc.subr +. /etc/rc.conf + +name="dhcrelay" +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" + +run_rc_command "$1" diff --git a/etc/rc.d/dmesg b/etc/rc.d/dmesg new file mode 100755 index 000000000000..ee44958799af --- /dev/null +++ b/etc/rc.d/dmesg @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD: dmesg,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: dmesg +# REQUIRE: systemfs + +. /etc/rc.subr +. /etc/rc.conf + +name="dmesg" +start_precmd="checkyesno dmesg" +start_cmd="dmesg $dmesg_flags > /var/run/dmesg.boot" +stop_cmd=":" + +run_rc_command "$1" diff --git a/etc/rc.d/fsck.sh b/etc/rc.d/fsck.sh new file mode 100644 index 000000000000..daaa0ae0bf6e --- /dev/null +++ b/etc/rc.d/fsck.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# +# $NetBSD: fsck.sh,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: fsck +# REQUIRE: localswap ccd raidframe + +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) + exit 1 + ;; + 4) + echo "Rebooting..." + reboot + echo "Reboot failed; help!" + exit 1 + ;; + 8) + echo "Automatic file system check failed; help!" + exit 1 + ;; + 12) + echo "Boot interrupted." + exit 1 + ;; + 130) + exit 1 + ;; + *) + echo "Unknown error; help!" + exit 1 + ;; + esac + + # Reset SIGQUIT handler. + trap "echo 'Boot interrupted.'; exit 1" 3 + fi +} + +case "$1" in +*start) + fsck_start + ;; +esac diff --git a/etc/rc.d/gated b/etc/rc.d/gated new file mode 100644 index 000000000000..d24230c51dcb --- /dev/null +++ b/etc/rc.d/gated @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD: gated,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: gated +# REQUIRE: daemon + +. /etc/rc.subr +. /etc/rc.conf + +name="gated" +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/${name}.conf" + +run_rc_command "$1" diff --git a/etc/rc.d/inetd b/etc/rc.d/inetd new file mode 100755 index 000000000000..e9bd6703d1bb --- /dev/null +++ b/etc/rc.d/inetd @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD: inetd,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: inetd +# REQUIRE: daemon login + +. /etc/rc.subr +. /etc/rc.conf + +name="inetd" +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/${name}.conf" + +run_rc_command "$1" "reload" diff --git a/etc/rc.d/ipfilter b/etc/rc.d/ipfilter new file mode 100755 index 000000000000..604a4bd3f41f --- /dev/null +++ b/etc/rc.d/ipfilter @@ -0,0 +1,52 @@ +#!/bin/sh +# +# $NetBSD: ipfilter,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: ipfilter +# REQUIRE: root beforenetlkm mountcritlocal tty + +. /etc/rc.subr +. /etc/rc.conf + +name="ipfilter" +start_cmd="ipfilter_start" +stop_precmd="checkyesno ipfilter && [ -f /etc/ipf.conf ]" +stop_cmd="ipfilter_stop" +reload_precmd="$stop_precmd" +reload_cmd="ipfilter_reload" + +ipfilter_start() +{ + if [ ! checkyesno ipfilter ]; then + return 0 + fi + + # if /etc/ipf.conf isn't readable, abort the boot rather + # than risk a security problem + # + if [ ! -f /etc/ipf.conf ]; then + err 1 "/etc/ipf.conf not readable; ipfilter start aborted." + fi + echo "Enabling ipfilter." + /sbin/ipf -E -Fa -f /etc/ipf.conf +} + +ipfilter_stop() +{ + echo "Disabling ipfilter." + /sbin/ipf -D +} + +ipfilter_reload() +{ + echo "Reloading ipfilter rules." + /sbin/ipf -I -Fa -f /etc/ipf.conf + if [ $? -eq 0 ]; then + /sbin/ipf -s + else + warn "Reload failed; not swapping to new ruleset." + fi +} + +run_rc_command "$1" "reload" diff --git a/etc/rc.d/ipmon b/etc/rc.d/ipmon new file mode 100755 index 000000000000..7d52e82022a7 --- /dev/null +++ b/etc/rc.d/ipmon @@ -0,0 +1,16 @@ +#!/bin/sh +# +# $NetBSD: ipmon,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: ipmon +# REQUIRE: syslogd + +. /etc/rc.subr +. /etc/rc.conf + +name="ipmon" +command="/usr/sbin/${name}" +command_args="&" + +run_rc_command "$1" diff --git a/etc/rc.d/ipnat b/etc/rc.d/ipnat new file mode 100755 index 000000000000..3314c055a148 --- /dev/null +++ b/etc/rc.d/ipnat @@ -0,0 +1,37 @@ +#!/bin/sh +# +# $NetBSD: ipnat,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: ipnat +# REQUIRE: ipfilter + +. /etc/rc.subr +. /etc/rc.conf + +name="ipnat" +config="/etc/ipnat.conf" + +start_precmd="checkyesno ipnat" +start_cmd="ipnat_start" + +stop_precmd=$start_precmd +stop_cmd="/usr/sbin/ipnat -F -C" + +reload_precmd=$start_precmd +reload_cmd="/usr/sbin/ipnat -F -C -f ${config}" + +ipnat_start() +{ + if [ ! -f ${config} ]; then + return 0 + fi + echo "Installing NAT rules ..." + if ! checkyesno ipfilter || [ ! -f /etc/ipf.conf ]; then + echo " (enabling ipfilter)" + /sbin/ipf -E -Fa + fi + /usr/sbin/ipnat -F -f ${config} +} + +run_rc_command "$1" "reload" diff --git a/etc/rc.d/kerberos b/etc/rc.d/kerberos new file mode 100644 index 000000000000..a42dcf83bac9 --- /dev/null +++ b/etc/rc.d/kerberos @@ -0,0 +1,24 @@ +#!/bin/sh +# +# $NetBSD: kerberos,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: kerberos +# REQUIRE: daemon login + +. /etc/rc.subr +. /etc/rc.conf + +name="kerberos" +command="/usr/sbin/${name}" +command_args=">> /var/log/${name}.log &" + +run_rc_command "$1" + + +name="kadmind" +rcvar="kerberos" +command="/usr/sbin/${name}" +command_args="-n >> /var/log/${name}.log &" + +run_rc_command "$1" diff --git a/etc/rc.d/ldconfig b/etc/rc.d/ldconfig new file mode 100755 index 000000000000..144049329e0a --- /dev/null +++ b/etc/rc.d/ldconfig @@ -0,0 +1,24 @@ +#!/bin/sh +# +# $NetBSD: ldconfig,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: ldconfig +# REQUIRE: mountall + +. /etc/rc.subr +. /etc/rc.conf + +name="ldconfig" +start_cmd="ldconfig_start" +stop_cmd=":" + +ldconfig_start() +{ + if [ -f /sbin/ldconfig ]; then + echo "Creating runtime link editor directory cache." + ldconfig + fi +} + +run_rc_command "$1" diff --git a/etc/rc.d/lkm1 b/etc/rc.d/lkm1 new file mode 100755 index 000000000000..9ad578861368 --- /dev/null +++ b/etc/rc.d/lkm1 @@ -0,0 +1,38 @@ +#!/bin/sh +# +# $NetBSD: lkm1,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: beforenetlkm +# REQUIRE: root + +. /etc/rc.subr +. /etc/rc.conf + +name="lkm1" +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 checkyesno lkm && [ -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 checkyesno lkm && [ -f /etc/rc.lkm -a -x /usr/bin/ld ]; then + lkmstage=BEFORENET + set stop ; . /etc/rc.lkm + fi +} + +run_rc_command "$1" diff --git a/etc/rc.d/lkm2 b/etc/rc.d/lkm2 new file mode 100755 index 000000000000..0197f2640726 --- /dev/null +++ b/etc/rc.d/lkm2 @@ -0,0 +1,38 @@ +#!/bin/sh +# +# $NetBSD: lkm2,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: beforemountlkm +# REQUIRE: syslogd + +. /etc/rc.subr +. /etc/rc.conf + +name="lkm2" +start_precmd="checkyesno lkm" +start_cmd="lkm2_start" +stop_precmd="$start_precmd" +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 +} + +run_rc_command "$1" diff --git a/etc/rc.d/lkm3 b/etc/rc.d/lkm3 new file mode 100755 index 000000000000..88c36e8a9566 --- /dev/null +++ b/etc/rc.d/lkm3 @@ -0,0 +1,26 @@ +#!/bin/sh +# +# $NetBSD: lkm3,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: aftermountlkm +# REQUIRE: mountall + +. /etc/rc.subr +. /etc/rc.conf + +name="lkm3" +start_cmd="do_lkm3 start" +stop_cmd="do_lkm3 stop" + +do_lkm3() +{ + # (un)load kernel modules specified in /etc/lkm.conf + # + if checkyesno lkm && [ -f /etc/rc.lkm ]; then + lkmstage=AFTERMOUNT + set $1 ; . /etc/rc.lkm + fi +} + +run_rc_command "$1" diff --git a/etc/rc.d/local b/etc/rc.d/local new file mode 100755 index 000000000000..1a00f20daef6 --- /dev/null +++ b/etc/rc.d/local @@ -0,0 +1,24 @@ +#!/bin/sh +# +# $NetBSD: local,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# REQUIRE: daemon +# PROVIDE: local +# BEFORE: login + +. /etc/rc.subr +. /etc/rc.conf + +name="local" +start_cmd="do_local start" +stop_cmd="do_local stop" + +do_local() +{ + if [ -f /etc/rc.local ]; then + set $1 ; . /etc/rc.local + fi +} + +run_rc_command "$1" diff --git a/etc/rc.d/login b/etc/rc.d/login new file mode 100644 index 000000000000..bb338bab50e2 --- /dev/null +++ b/etc/rc.d/login @@ -0,0 +1,15 @@ +#!/bin/sh +# +# $NetBSD: login,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: login +# REQUIRE: gated routed mrouted timed xntpd dhcpd dhcrelay rwho lpd bootparams +# REQUIRE: xfs rarpd rbootd mopd apmd screenblank motd local +# REQUIRE: route6d rtadvd rtsold wscons yppasswdd + + +# This is a dummy to ensure that xdm, inetd, cron and kerberos are +# started after everything else, incase the user has increased the +# system security level, and because we want to delay user logins +# until the system is (almost) fully operational. diff --git a/etc/rc.d/lpd b/etc/rc.d/lpd new file mode 100755 index 000000000000..848834b22445 --- /dev/null +++ b/etc/rc.d/lpd @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD: lpd,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: lpd +# REQUIRE: daemon + +. /etc/rc.subr +. /etc/rc.conf + +name="lpd" +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/printcap" + +run_rc_command "$1" diff --git a/etc/rc.d/mopd b/etc/rc.d/mopd new file mode 100755 index 000000000000..4be25e4dde16 --- /dev/null +++ b/etc/rc.d/mopd @@ -0,0 +1,15 @@ +#!/bin/sh +# +# $NetBSD: mopd,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: mopd +# REQUIRE: daemon + +. /etc/rc.subr +. /etc/rc.conf + +name="mopd" +command="/usr/sbin/${name}" + +run_rc_command "$1" diff --git a/etc/rc.d/motd b/etc/rc.d/motd new file mode 100755 index 000000000000..1878f21a7c68 --- /dev/null +++ b/etc/rc.d/motd @@ -0,0 +1,36 @@ +#!/bin/sh +# +# $NetBSD: motd,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: motd +# REQUIRE: systemfs + +. /etc/rc.subr +. /etc/rc.conf + +name="motd" +start_precmd="checkyesno 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 + rm -f $T + sysctl -n kern.version | sed 1q > $T + echo "" >> $T + sed '1,/^$/d' < /etc/motd >> $T + cmp -s $T /etc/motd || cp $T /etc/motd + rm -f $T +} + +run_rc_command "$1" diff --git a/etc/rc.d/mountall b/etc/rc.d/mountall new file mode 100755 index 000000000000..c683d97e5999 --- /dev/null +++ b/etc/rc.d/mountall @@ -0,0 +1,16 @@ +#!/bin/sh +# +# $NetBSD: mountall,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: mountall +# REQUIRE: beforemountlkm + +. /etc/rc.subr +. /etc/rc.conf + +name="mountall" +start_cmd="echo 'Mounting all filesystems...'; mount -a" +stop_cmd=":" + +run_rc_command "$1" diff --git a/etc/rc.d/mountcritlocal b/etc/rc.d/mountcritlocal new file mode 100755 index 000000000000..54130eb6733f --- /dev/null +++ b/etc/rc.d/mountcritlocal @@ -0,0 +1,16 @@ +#!/bin/sh +# +# $NetBSD: mountcritlocal,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: mountcritlocal +# REQUIRE: root + +. /etc/rc.subr +. /etc/rc.conf + +name="mountcritlocal" +start_cmd="mount_critical_filesystems local" +stop_cmd=":" + +run_rc_command "$1" diff --git a/etc/rc.d/mountcritremote b/etc/rc.d/mountcritremote new file mode 100755 index 000000000000..30c3952c0646 --- /dev/null +++ b/etc/rc.d/mountcritremote @@ -0,0 +1,16 @@ +#!/bin/sh +# +# $NetBSD: mountcritremote,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: mountcritremote +# REQUIRE: root mountcritlocal network + +. /etc/rc.subr +. /etc/rc.conf + +name="mountcritremote" +start_cmd="mount_critical_filesystems remote" +stop_cmd=":" + +run_rc_command "$1" diff --git a/etc/rc.d/mountd b/etc/rc.d/mountd new file mode 100755 index 000000000000..ddf03a5c3e78 --- /dev/null +++ b/etc/rc.d/mountd @@ -0,0 +1,25 @@ +#!/bin/sh +# +# $NetBSD: mountd,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: mountd +# REQUIRE: beforemountlkm network portmap + +. /etc/rc.subr +. /etc/rc.conf + +name="mountd" +rcvar="nfs_server" +command="/usr/sbin/${name}" +required_files="/etc/exports" +start_precmd="mountd_precmd" + +mountd_precmd() +{ + rm -f /var/db/mountdtab + echo -n > /var/db/mountdtab + return 0 +} + +run_rc_command "$1" "reload" diff --git a/etc/rc.d/mrouted b/etc/rc.d/mrouted new file mode 100755 index 000000000000..0d959536452c --- /dev/null +++ b/etc/rc.d/mrouted @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD: mrouted,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: mrouted +# REQUIRE: daemon + +. /etc/rc.subr +. /etc/rc.conf + +name="mrouted" +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/${name}.conf" + +run_rc_command "$1" "reload" diff --git a/etc/rc.d/named b/etc/rc.d/named new file mode 100755 index 000000000000..bd288f09dcc7 --- /dev/null +++ b/etc/rc.d/named @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD: named,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: named +# REQUIRE: servers + +. /etc/rc.subr +. /etc/rc.conf + +name="named" +command="/usr/sbin/${name}" +command_flags="$1" +pidfile="/var/run/${name}.pid" + +run_rc_command "$1" "reload dumpdb notrace qrylog querylog stats trace" diff --git a/etc/rc.d/network b/etc/rc.d/network new file mode 100755 index 000000000000..1f2ca4773750 --- /dev/null +++ b/etc/rc.d/network @@ -0,0 +1,330 @@ +#!/bin/sh +# +# $NetBSD: network,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: network +# REQUIRE: root mountcritlocal tty ipfilter + +. /etc/rc.subr +. /etc/rc.conf + +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" -a -f /etc/myname ]; then + hostname=`cat /etc/myname` + fi + if [ -n "$hostname" ]; then + echo "Hostname: $hostname" + hostname $hostname + else + warn "\$hostname not set." + fi + + # Check $domainname first, then /etc/defaultdomain, + # for NIS/YP domain name + # + if [ -z "$domainname" -a -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 + + # 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 + # + if [ "$net_interfaces" != NO ]; then + if checkyesno auto_ifconfig; then + tmp="`ifconfig -l`" + else + tmp="$net_interfaces" + fi + echo -n 'Configuring network interfaces:' + for int in $tmp; do + eval `echo '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 + if [ -n "`eval echo '$args'`" ] ; then + ifconfig $int $args + fi + 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" -a -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 `echo 'args=$ifaliases_'$int` + if [ -n "$args" ]; then + set -- $args + while [ $# -ge 2 ]; do + addr=$1 ; net=$2 ; shift 2 + if [ "$net" = "-" ]; then + 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 + 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 + # Note that manual configuration can be done in the above, using + # ifconfig. + # + if ifconfig lo0 inet6 >/dev/null 2>&1; then + # We have IPv6 support in kernel. + + # disallow scoped unicast dest without outgoing scope + # identifiers. + # + route add -inet6 fe80:: -prefixlen 10 ::1 -reject + route add -inet6 fc80:: -prefixlen 10 ::1 -reject + + # disallow "internal" addresses to appear on the wire. + # + route add -inet6 ::ffff:0.0.0.0 -prefixlen 96 ::1 -reject + 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" -a -n "$ip6forwarding" ]; then + warn 'Please migrate to newer rc.conf' \ + '(use ip6mode, not ip6forwarding)' + if checkyesno ip6forwarding; then + ip6mode=router + else + if checkyesno rtsol; then + ip6mode=autohost + else + ip6mode=host + fi + 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 + if [ -n "$ip6defaultif" ]; then + ndp -I $ip6defaultif + fi + ;; + + host) + echo 'IPv6 mode: host' + if [ -n "$ip6defaultif" ]; then + ndp -I $ip6defaultif + fi + ;; + + *) echo 'WARNING: invalid value in ip6mode' + ;; + + esac + + 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 + fi + + # 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 + 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 + + rtsolpid=`check_process rtsol` + if [ -n "$rtsolpid" ]; then + echo "Stopping rtsol (IPv6 router solicitation daemon)." + kill -TERM $rtsolpid + 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 $configured_interfaces; do + eval `echo '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 `echo '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 + +} + +run_rc_command "$1" diff --git a/etc/rc.d/nfsd b/etc/rc.d/nfsd new file mode 100755 index 000000000000..5175a614da2c --- /dev/null +++ b/etc/rc.d/nfsd @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD: nfsd,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: nfsd +# REQUIRE: mountd + +. /etc/rc.subr +. /etc/rc.conf + +name="nfsd" +rcvar="nfs_server" +command="/usr/sbin/${name}" +required_vars="portmap" + +run_rc_command "$1" diff --git a/etc/rc.d/nfsiod b/etc/rc.d/nfsiod new file mode 100644 index 000000000000..87237a28b502 --- /dev/null +++ b/etc/rc.d/nfsiod @@ -0,0 +1,16 @@ +#!/bin/sh +# +# $NetBSD: nfsiod,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: nfsiod +# REQUIRE: beforemountlkm network portmap + +. /etc/rc.subr +. /etc/rc.conf + +name="nfsiod" +rcvar="nfs_client" +command="/usr/sbin/${name}" + +run_rc_command "$1" diff --git a/etc/rc.d/nfslocking b/etc/rc.d/nfslocking new file mode 100755 index 000000000000..026a1a4a2f3c --- /dev/null +++ b/etc/rc.d/nfslocking @@ -0,0 +1,24 @@ +#!/bin/sh +# +# $NetBSD: nfslocking,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: nfslocking +# REQUIRE: nfsd nfsiod + +. /etc/rc.subr +. /etc/rc.conf + +arg=$1 + +start_precmd='checkyesno nfs_server || checkyesno nfs_client' +stop_precmd=$start_precmd +status_precmd=$start_precmd + +name="statd" +command="/usr/sbin/rpc.${name}" +run_rc_command "$arg" + +name="lockd" +command="/usr/sbin/rpc.${name}" +run_rc_command "$arg" diff --git a/etc/rc.d/ntpdate b/etc/rc.d/ntpdate new file mode 100755 index 000000000000..a66799fb60cd --- /dev/null +++ b/etc/rc.d/ntpdate @@ -0,0 +1,30 @@ +#!/bin/sh +# +# $NetBSD: ntpdate,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: ntpdate +# REQUIRE: syslogd network + +. /etc/rc.subr +. /etc/rc.conf + +name="ntpdate" +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} + ' '. + # + if [ -n "$ppp_peers" ]; then + set -- $ppp_peers + echo -n "Starting pppd:" + while [ $# -ge 1 ]; do + peer=$1 + shift + if [ -f /etc/ppp/peers/$peer ]; then + pppd call $peer + echo -n " $peer" + fi + done + echo "." + fi +} + +run_rc_command "$1" diff --git a/etc/rc.d/pwcheck b/etc/rc.d/pwcheck new file mode 100755 index 000000000000..e27baff4127f --- /dev/null +++ b/etc/rc.d/pwcheck @@ -0,0 +1,26 @@ +#!/bin/sh +# +# $NetBSD: pwcheck,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: pwcheck +# REQUIRE: systemfs syslogd + +. /etc/rc.subr +. /etc/rc.conf + +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 +} + +run_rc_command "$1" diff --git a/etc/rc.d/quota b/etc/rc.d/quota new file mode 100755 index 000000000000..bbeaa4dd66cd --- /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 +. /etc/rc.conf + +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 +} + +run_rc_command "$1" diff --git a/etc/rc.d/raidframe b/etc/rc.d/raidframe new file mode 100755 index 000000000000..716405a592be --- /dev/null +++ b/etc/rc.d/raidframe @@ -0,0 +1,26 @@ +#!/bin/sh +# +# $NetBSD: raidframe,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: raidframe + +. /etc/rc.subr +. /etc/rc.conf + +name="raidframe" +start_cmd="raidframe_start" +stop_cmd=":" + +raidframe_start() +{ + # Configure raid devices. + # + for dev in 0 1 2 3; do + if [ -f /etc/raid$dev.conf ]; then + raidctl -c /etc/raid$dev.conf raid$dev + fi + done +} + +run_rc_command "$1" diff --git a/etc/rc.d/rarpd b/etc/rc.d/rarpd new file mode 100755 index 000000000000..2e7e678b9c54 --- /dev/null +++ b/etc/rc.d/rarpd @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD: rarpd,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: rarpd +# REQUIRE: daemon + +. /etc/rc.subr +. /etc/rc.conf + +name="rarpd" +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/ethers" + +run_rc_command "$1" diff --git a/etc/rc.d/rbootd b/etc/rc.d/rbootd new file mode 100755 index 000000000000..c7ada967cef5 --- /dev/null +++ b/etc/rc.d/rbootd @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD: rbootd,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: rbootd +# REQUIRE: daemon + +. /etc/rc.subr +. /etc/rc.conf + +name="rbootd" +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/${name}.conf" + +run_rc_command "$1" "reload" diff --git a/etc/rc.d/root b/etc/rc.d/root new file mode 100755 index 000000000000..368d916aedd6 --- /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 +. /etc/rc.conf + +name="root" +start_cmd="root_start" +stop_cmd=":" + +root_start() +{ + umount -a >/dev/null 2>&1 + mount / + rm -f /fastboot +} + +run_rc_command "$1" diff --git a/etc/rc.d/route6d b/etc/rc.d/route6d new file mode 100755 index 000000000000..3fda91af79e5 --- /dev/null +++ b/etc/rc.d/route6d @@ -0,0 +1,15 @@ +#!/bin/sh +# +# $NetBSD: route6d,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: route6d +# REQUIRE: daemon + +. /etc/rc.subr +. /etc/rc.conf + +name="route6d" +command="/usr/sbin/${name}" + +run_rc_command "$1" diff --git a/etc/rc.d/routed b/etc/rc.d/routed new file mode 100755 index 000000000000..2a09746bbe0b --- /dev/null +++ b/etc/rc.d/routed @@ -0,0 +1,24 @@ +#!/bin/sh +# +# $NetBSD: routed,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: routed +# REQUIRE: daemon gated + +. /etc/rc.subr +. /etc/rc.conf + +name="routed" +command="/usr/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 +} + +run_rc_command "$1" diff --git a/etc/rc.d/rtadvd b/etc/rc.d/rtadvd new file mode 100755 index 000000000000..b51b056c3c44 --- /dev/null +++ b/etc/rc.d/rtadvd @@ -0,0 +1,25 @@ +#!/bin/sh +# +# $NetBSD: rtadvd,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: rtadvd +# REQUIRE: daemon + +. /etc/rc.subr +. /etc/rc.conf + +name="rtadvd" +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 +} + +run_rc_command "$1" diff --git a/etc/rc.d/rtsold b/etc/rc.d/rtsold new file mode 100755 index 000000000000..2f2488ad7369 --- /dev/null +++ b/etc/rc.d/rtsold @@ -0,0 +1,24 @@ +#!/bin/sh +# +# $NetBSD: rtsold,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: rtsold +# REQUIRE: daemon + +. /etc/rc.subr +. /etc/rc.conf + +name="rtsold" +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 +} + +run_rc_command "$1" diff --git a/etc/rc.d/rwho b/etc/rc.d/rwho new file mode 100755 index 000000000000..fa7bf02bfcde --- /dev/null +++ b/etc/rc.d/rwho @@ -0,0 +1,15 @@ +#!/bin/sh +# +# $NetBSD: rwho,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: rwho +# REQUIRE: daemon + +. /etc/rc.subr +. /etc/rc.conf + +name="rwhod" +command="/usr/sbin/${name}" + +run_rc_command "$1" diff --git a/etc/rc.d/savecore b/etc/rc.d/savecore new file mode 100755 index 000000000000..4d35c83085b0 --- /dev/null +++ b/etc/rc.d/savecore @@ -0,0 +1,30 @@ +#!/bin/sh +# +# $NetBSD: savecore,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: savecore +# REQUIRE: syslogd + +. /etc/rc.subr +. /etc/rc.conf + +name="savecore" +start_precmd="checkyesno savecore" +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 +} + +run_rc_command "$1" diff --git a/etc/rc.d/screenblank b/etc/rc.d/screenblank new file mode 100755 index 000000000000..80bf682e67ee --- /dev/null +++ b/etc/rc.d/screenblank @@ -0,0 +1,16 @@ +#!/bin/sh +# +# $NetBSD: screenblank,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: screenblank +# REQUIRE: daemon + +. /etc/rc.subr +. /etc/rc.conf + +name="screenblank" +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" + +run_rc_command "$1" diff --git a/etc/rc.d/sendmail b/etc/rc.d/sendmail new file mode 100755 index 000000000000..db80abf7dcd9 --- /dev/null +++ b/etc/rc.d/sendmail @@ -0,0 +1,21 @@ +#!/bin/sh +# +# $NetBSD: sendmail,v 1.1.1.1 2000/03/10 11:53:24 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 +. /etc/rc.conf + +name="sendmail" +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/${name}.cf" + +run_rc_command "$1" diff --git a/etc/rc.d/servers b/etc/rc.d/servers new file mode 100644 index 000000000000..932f15d35d98 --- /dev/null +++ b/etc/rc.d/servers @@ -0,0 +1,10 @@ +#!/bin/sh +# +# $NetBSD: servers,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: servers +# REQUIRE: ipmon savecore syslogd + +# This is a dummy dependancy, for early-start servers relying on +# some basic configuration. diff --git a/etc/rc.d/sshd b/etc/rc.d/sshd new file mode 100755 index 000000000000..3d5cbaa8794f --- /dev/null +++ b/etc/rc.d/sshd @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD: sshd,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: sshd +# REQUIRE: login + +. /etc/rc.subr +. /etc/rc.conf + +name="sshd" +command="/usr/pkg/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/${name}_config /etc/ssh_host_key" + +run_rc_command "$1" "reload" diff --git a/etc/rc.d/swap1 b/etc/rc.d/swap1 new file mode 100755 index 000000000000..e291bd08d210 --- /dev/null +++ b/etc/rc.d/swap1 @@ -0,0 +1,23 @@ +#!/bin/sh +# +# $NetBSD: swap1,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: localswap +# REQUIRE: ccd + +. /etc/rc.subr +. /etc/rc.conf + +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" + +run_rc_command "$1" diff --git a/etc/rc.d/swap2 b/etc/rc.d/swap2 new file mode 100755 index 000000000000..26ba2f0a6a62 --- /dev/null +++ b/etc/rc.d/swap2 @@ -0,0 +1,36 @@ +#!/bin/sh +# +# $NetBSD: swap2,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: nonlocalswap +# BEFORE: daemon +# REQUIRE: mountcritremote + +. /etc/rc.subr +. /etc/rc.conf + +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" + +run_rc_command "$1" diff --git a/etc/rc.d/sysctl b/etc/rc.d/sysctl new file mode 100755 index 000000000000..de0d7d819017 --- /dev/null +++ b/etc/rc.d/sysctl @@ -0,0 +1,40 @@ +#!/bin/sh +# +# $NetBSD: sysctl,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: sysctl +# REQUIRE: root mountcritremote + +. /etc/rc.subr +. /etc/rc.conf + +name="sysctl" +start_cmd="sysctl_start" +stop_cmd=":" + +sysctl_start() +{ + # if $defcorename is set, change it here. + # + if [ -n "$defcorename" ]; then + echo -n "Setting default core name template: " + sysctl -w kern.defcorename=$defcorename + fi + + # if $securelevel is set, change it here, else if it is 0, + # change it to 1 here, before we start 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 +} + +run_rc_command "$1" diff --git a/etc/rc.d/sysdb b/etc/rc.d/sysdb new file mode 100755 index 000000000000..ddb8b3550753 --- /dev/null +++ b/etc/rc.d/sysdb @@ -0,0 +1,32 @@ +#!/bin/sh +# +# $NetBSD: sysdb,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: databases +# REQUIRE: systemfs + +. /etc/rc.subr +. /etc/rc.conf + +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..." + sysctl machdep 2>/dev/null | grep -q booted_kernel + if [ $? -eq 0 ] ; then + kvm_mkdb `sysctl -n machdep.booted_kernel` || kvm_mkdb /netbsd + else + kvm_mkdb /netbsd + fi + dev_mkdb +} + +run_rc_command "$1" diff --git a/etc/rc.d/syslogd b/etc/rc.d/syslogd new file mode 100755 index 000000000000..27c6d5948838 --- /dev/null +++ b/etc/rc.d/syslogd @@ -0,0 +1,29 @@ +#!/bin/sh +# +# $NetBSD: syslogd,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: syslogd +# REQUIRE: systemfs + +. /etc/rc.subr +. /etc/rc.conf + +name="syslogd" +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/syslog.conf" +start_precmd="syslogd_precmd" + +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 +} + +run_rc_command "$1" "reload" diff --git a/etc/rc.d/systemfs b/etc/rc.d/systemfs new file mode 100644 index 000000000000..3b0ef5aa7967 --- /dev/null +++ b/etc/rc.d/systemfs @@ -0,0 +1,27 @@ +#!/bin/sh +# +# $NetBSD: systemfs,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: systemfs +# REQUIRE: network mountcritremote + +. /etc/rc.subr +. /etc/rc.conf + +name="systemfs" +start_cmd="systemfs_start" +stop_cmd=":" + +systemfs_start() +{ + # clean up left-over files. + # this could include the cleanup of lock files and /var/run, etc. + # + rm -f /etc/nologin /var/spool/lock/LCK.* /var/spool/uucp/STST/* + (cd /var/run && { + rm -rf -- *; install -c -m 664 -g utmp /dev/null utmp; + }) +} + +run_rc_command "$1" diff --git a/etc/rc.d/timed b/etc/rc.d/timed new file mode 100755 index 000000000000..85ec979500c0 --- /dev/null +++ b/etc/rc.d/timed @@ -0,0 +1,15 @@ +#!/bin/sh +# +# $NetBSD: timed,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: timed +# REQUIRE: daemon + +. /etc/rc.subr +. /etc/rc.conf + +name="timed" +command="/usr/sbin/${name}" + +run_rc_command "$1" diff --git a/etc/rc.d/ttys b/etc/rc.d/ttys new file mode 100755 index 000000000000..51116baeba66 --- /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 +. /etc/rc.conf + +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]* +} + +run_rc_command "$1" diff --git a/etc/rc.d/virecover b/etc/rc.d/virecover new file mode 100755 index 000000000000..b440c46db9f9 --- /dev/null +++ b/etc/rc.d/virecover @@ -0,0 +1,33 @@ +#!/bin/sh +# +# $NetBSD: virecover,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ +# + +# PROVIDE: virecover +# REQUIRE: systemfs +# +# XXX: should require `mail'! + +. /etc/rc.subr +. /etc/rc.conf + +name="virecover" +start_cmd="virecover_start" +stop_cmd=":" + +virecover_start() +{ + # XXX: replace me with a script that works! + # + virecovery=`echo /var/tmp/vi.recover/recover.*` + if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then + echo "Preserving editor files." + for i in $virecovery; do + if [ -f $i ]; then + sendmail -t < $i + fi + done + fi +} + +run_rc_command "$1" diff --git a/etc/rc.d/wscons b/etc/rc.d/wscons new file mode 100755 index 000000000000..1e31c9ebcd98 --- /dev/null +++ b/etc/rc.d/wscons @@ -0,0 +1,23 @@ +#!/bin/sh +# +# $NetBSD: wscons,v 1.1.1.1 2000/03/10 11:53:23 lukem Exp $ +# + +# PROVIDE: wscons +# REQUIRE: systemfs + +. /etc/rc.subr +. /etc/rc.conf + +name="wscons" +start_cmd="do_wscons start" +stop_cmd="do_wscons stop" + +do_wscons() +{ + if [ -f /etc/rc.wscons ]; then + set $1 ; . /etc/rc.wscons + fi +} + +run_rc_command "$1" diff --git a/etc/rc.d/xdm b/etc/rc.d/xdm new file mode 100755 index 000000000000..599fa9800fe9 --- /dev/null +++ b/etc/rc.d/xdm @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD: xdm,v 1.1.1.1 2000/03/10 11:53:23 lukem Exp $ +# + +# PROVIDE: xdm +# REQUIRE: daemon login wscons + +. /etc/rc.subr +. /etc/rc.conf + +name="xdm" +command="/usr/X11R6/bin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/usr/X11R6/lib/X11/xdm/xdm-config" + +run_rc_command "$1" "reload" diff --git a/etc/rc.d/xfs b/etc/rc.d/xfs new file mode 100755 index 000000000000..7d8d9fad6ac9 --- /dev/null +++ b/etc/rc.d/xfs @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD: xfs,v 1.1.1.1 2000/03/10 11:53:23 lukem Exp $ +# + +# PROVIDE: xfs +# REQUIRE: mountall + +. /etc/rc.subr +. /etc/rc.conf + +name="xfs" +command="/usr/X11R6/bin/${name}" +command_args="& sleep 2" +required_files="/usr/X11R6/lib/X11/fs/config" + +run_rc_command "$1" "reload" diff --git a/etc/rc.d/xntpd b/etc/rc.d/xntpd new file mode 100644 index 000000000000..c4984fb9f7fd --- /dev/null +++ b/etc/rc.d/xntpd @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $NetBSD: xntpd,v 1.1.1.1 2000/03/10 11:53:23 lukem Exp $ +# + +# PROVIDE: xntpd +# REQUIRE: daemon + +. /etc/rc.subr +. /etc/rc.conf + +name="xntpd" +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/ntp.conf" + +run_rc_command "$1" diff --git a/etc/rc.d/ypbind b/etc/rc.d/ypbind new file mode 100755 index 000000000000..5bb0b1f7870b --- /dev/null +++ b/etc/rc.d/ypbind @@ -0,0 +1,24 @@ +#!/bin/sh +# +# $NetBSD: ypbind,v 1.1.1.1 2000/03/10 11:53:23 lukem Exp $ +# + +# PROVIDE: ypbind +# REQUIRE: ypserv + +. /etc/rc.subr +. /etc/rc.conf + +name="ypbind" +command="/usr/sbin/${name}" +start_precmd="ypbind_precmd" + +ypbind_precmd() +{ + if [ -z "$domainname" ]; then + warn "\$domainname is not set; ${name} not started" + return 1 + fi +} + +run_rc_command "$1" diff --git a/etc/rc.d/yppasswdd b/etc/rc.d/yppasswdd new file mode 100755 index 000000000000..853abfb3a1b0 --- /dev/null +++ b/etc/rc.d/yppasswdd @@ -0,0 +1,25 @@ +#!/bin/sh +# +# $NetBSD: yppasswdd,v 1.1.1.1 2000/03/10 11:53:23 lukem Exp $ +# + +# PROVIDE: yppasswdd +# REQUIRE: ypserv ypbind + +. /etc/rc.subr +. /etc/rc.conf + +name="yppasswdd" +command="/usr/sbin/rpc.${name}" +required_vars="portmap ypserv" +start_precmd="yppasswdd_precmd" + +yppasswdd_precmd() +{ + if [ -z "$domainname" ]; then + warn "\$domainname is not set; ${name} not started" + return 1 + fi +} + +run_rc_command "$1" diff --git a/etc/rc.d/ypserv b/etc/rc.d/ypserv new file mode 100755 index 000000000000..87893360806b --- /dev/null +++ b/etc/rc.d/ypserv @@ -0,0 +1,30 @@ +#!/bin/sh +# +# $NetBSD: ypserv,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $ +# + +# PROVIDE: ypserv +# REQUIRE: portmap + +. /etc/rc.subr +. /etc/rc.conf + +name="ypserv" +command="/usr/sbin/${name}" +required_vars="portmap" +start_precmd="ypserv_precmd" + +ypserv_precmd() +{ + if [ -z "$domainname" ]; then + warn "\$domainname is not set; ${name} not started" + return 1 + fi + + if [ ! -d /var/yp/$domainname/. ]; then + warn "/var/yp/$domainname is not a directory; ${name} not started" + return 1 + fi +} + +run_rc_command "$1"