rc.d scripts derived from /etc/rc

This commit is contained in:
lukem 2000-03-10 11:53:23 +00:00
parent 34d0aa38df
commit c53094a738
75 changed files with 2093 additions and 0 deletions

17
etc/rc.d/Makefile Executable file
View File

@ -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 <bsd.prog.mk>

32
etc/rc.d/accounting Executable file
View File

@ -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"

19
etc/rc.d/amd Executable file
View File

@ -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"

15
etc/rc.d/apmd Executable file
View File

@ -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"

63
etc/rc.d/bootconf.sh Executable file
View File

@ -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

16
etc/rc.d/bootparams Executable file
View File

@ -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"

23
etc/rc.d/ccd Executable file
View File

@ -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"

30
etc/rc.d/cleartmp Executable file
View File

@ -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"

16
etc/rc.d/cron Executable file
View File

@ -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"

12
etc/rc.d/daemon Normal file
View File

@ -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.

17
etc/rc.d/dhclient Executable file
View File

@ -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"

17
etc/rc.d/dhcpd Executable file
View File

@ -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"

16
etc/rc.d/dhcrelay Executable file
View File

@ -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"

17
etc/rc.d/dmesg Executable file
View File

@ -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"

57
etc/rc.d/fsck.sh Normal file
View File

@ -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

17
etc/rc.d/gated Normal file
View File

@ -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"

17
etc/rc.d/inetd Executable file
View File

@ -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"

52
etc/rc.d/ipfilter Executable file
View File

@ -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"

16
etc/rc.d/ipmon Executable file
View File

@ -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"

37
etc/rc.d/ipnat Executable file
View File

@ -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"

24
etc/rc.d/kerberos Normal file
View File

@ -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"

24
etc/rc.d/ldconfig Executable file
View File

@ -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"

38
etc/rc.d/lkm1 Executable file
View File

@ -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"

38
etc/rc.d/lkm2 Executable file
View File

@ -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"

26
etc/rc.d/lkm3 Executable file
View File

@ -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"

24
etc/rc.d/local Executable file
View File

@ -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"

15
etc/rc.d/login Normal file
View File

@ -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.

17
etc/rc.d/lpd Executable file
View File

@ -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"

15
etc/rc.d/mopd Executable file
View File

@ -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"

36
etc/rc.d/motd Executable file
View File

@ -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"

16
etc/rc.d/mountall Executable file
View File

@ -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"

16
etc/rc.d/mountcritlocal Executable file
View File

@ -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"

16
etc/rc.d/mountcritremote Executable file
View File

@ -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"

25
etc/rc.d/mountd Executable file
View File

@ -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"

17
etc/rc.d/mrouted Executable file
View File

@ -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"

17
etc/rc.d/named Executable file
View File

@ -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"

330
etc/rc.d/network Executable file
View File

@ -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"

17
etc/rc.d/nfsd Executable file
View File

@ -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"

16
etc/rc.d/nfsiod Normal file
View File

@ -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"

24
etc/rc.d/nfslocking Executable file
View File

@ -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"

30
etc/rc.d/ntpdate Executable file
View File

@ -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}
' </etc/ntp.conf`
fi
if [ -n "$ntpdate_hosts" ]; then
echo "Setting date via ntp."
ntpdate -b -s $ntpdate_hosts
fi
}
run_rc_command "$1"

15
etc/rc.d/portmap Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
#
# $NetBSD: portmap,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $
#
# PROVIDE: portmap
# REQUIRE: network ntpdate syslogd named ppp
. /etc/rc.subr
. /etc/rc.conf
name="portmap"
command="/usr/sbin/${name}"
run_rc_command "$1"

41
etc/rc.d/ppp Executable file
View File

@ -0,0 +1,41 @@
#!/bin/sh
#
# $NetBSD: ppp,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $
#
# should provide `network' perhaps?
# PROVIDE: ppp
# note that this means that syslogd will not be listening on
# any PPP addresses. this is considered a feature.
# REQUIRE: systemfs syslogd
. /etc/rc.subr
. /etc/rc.conf
name="ppp"
start_cmd="ppp_start"
stop_cmd=":"
ppp_start()
{
# /etc/ppp/peers and $ppp_peers contain boot configuration
# information for pppd. each value in $ppp_peers that has a
# file in /etc/ppp/peers of the same name, will be run as
# `pppd <peer>'.
#
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"

26
etc/rc.d/pwcheck Executable file
View File

@ -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"

24
etc/rc.d/quota Executable file
View File

@ -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"

26
etc/rc.d/raidframe Executable file
View File

@ -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"

17
etc/rc.d/rarpd Executable file
View File

@ -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"

17
etc/rc.d/rbootd Executable file
View File

@ -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"

23
etc/rc.d/root Executable file
View File

@ -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"

15
etc/rc.d/route6d Executable file
View File

@ -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"

24
etc/rc.d/routed Executable file
View File

@ -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"

25
etc/rc.d/rtadvd Executable file
View File

@ -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"

24
etc/rc.d/rtsold Executable file
View File

@ -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"

15
etc/rc.d/rwho Executable file
View File

@ -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"

30
etc/rc.d/savecore Executable file
View File

@ -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"

16
etc/rc.d/screenblank Executable file
View File

@ -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"

21
etc/rc.d/sendmail Executable file
View File

@ -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"

10
etc/rc.d/servers Normal file
View File

@ -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.

17
etc/rc.d/sshd Executable file
View File

@ -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"

23
etc/rc.d/swap1 Executable file
View File

@ -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"

36
etc/rc.d/swap2 Executable file
View File

@ -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"

40
etc/rc.d/sysctl Executable file
View File

@ -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"

32
etc/rc.d/sysdb Executable file
View File

@ -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"

29
etc/rc.d/syslogd Executable file
View File

@ -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"

27
etc/rc.d/systemfs Normal file
View File

@ -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"

15
etc/rc.d/timed Executable file
View File

@ -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"

32
etc/rc.d/ttys Executable file
View File

@ -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"

33
etc/rc.d/virecover Executable file
View File

@ -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"

23
etc/rc.d/wscons Executable file
View File

@ -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"

17
etc/rc.d/xdm Executable file
View File

@ -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"

17
etc/rc.d/xfs Executable file
View File

@ -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"

17
etc/rc.d/xntpd Normal file
View File

@ -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"

24
etc/rc.d/ypbind Executable file
View File

@ -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"

25
etc/rc.d/yppasswdd Executable file
View File

@ -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"

30
etc/rc.d/ypserv Executable file
View File

@ -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"