Merge in all the changes that Mike Makonnen has been maintaining for a

while. This is only the script pieces, the glue for the build comes next.

Submitted by:	Mike Makonnen <makonnen@pacbell.net>
Reviewed by:	silence on -current and -hackers
Prodded by:	rwatson
This commit is contained in:
Gordon Tetlow 2002-06-13 22:14:37 +00:00
parent 1cfdefbb9f
commit 27bc1b287e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=98184
112 changed files with 2914 additions and 355 deletions

View File

@ -1,12 +1,12 @@
#!/bin/sh
#
# $NetBSD: DAEMON,v 1.4 2000/08/21 23:39:07 lukem Exp $
# $NetBSD: DAEMON,v 1.8 2002/03/22 04:33:57 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: DAEMON
# REQUIRE: accounting aftermountlkm amd cleartmp dmesg ipmon
# REQUIRE: ipnat ipsec ldconfig named network nonlocalswap nfslocking
# REQUIRE: pwcheck quota savecore securelevel sysctl sysdb virecover ypbind
# REQUIRE: NETWORKING SERVERS
# KEYWORD: FreeBSD NetBSD
# This is a dummy dependancy, to ensure that general purpose daemons
# are run _after_ the above are.

View File

@ -1,12 +1,12 @@
#!/bin/sh
#
# $NetBSD: LOGIN,v 1.3 2000/07/20 23:36:56 lukem Exp $
# $NetBSD: LOGIN,v 1.7 2002/03/22 04:33:57 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: LOGIN
# REQUIRE: apmd bootparams dhcpd dhcrelay gated local lpd mopd motd
# REQUIRE: mrouted ntpd rarpd rbootd route6d routed rtadvd rtsold
# REQUIRE: rwho screenblank timed wscons xfs yppasswdd
# REQUIRE: DAEMON
# KEYWORD: FreeBSD NetBSD
# This is a dummy dependancy to ensure user services such as xdm,
# inetd, cron and kerberos are started after everything else, incase

View File

@ -1,17 +1,23 @@
# $NetBSD: Makefile,v 1.16 2001/01/14 15:37:22 minoura Exp $
# $FreeBSD$
.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
FILES= DAEMON LOGIN NETWORKING SERVERS abi accounting addswap adjkerntz altqd \
amd apmd atm1 atm2.sh atm3.sh bgfsck bootconf.sh bootparams ccd \
cleanvar cleartmp cron devdb devfs dhclient dhcpd dhcrelay diskless \
dmesg dumpon fsck gated inetd initdiskless initrandom ipfilter ipfw \
ip6fw ipmon ipnat ipsec ipxrouted isdnd kadmind kdc kerberos keyserv \
ldconfig lkm1 lkm2 lkm3 local localdaemons lomac lpd mopd motd \
mountall mountcritlocal mountcritremote mountd moused mroute6d \
mrouted msgs named network network1 network2 network3 \
network_ipv6 newsyslog nfsclient nfsd nfslocking \
othermta nfsserver ntpd ntpdate pccard poffd ppp-user \
postfix ppp pppoed pwcheck quota racoon raidframe random rarpd \
rbootd root route6d routed rpcbind rtadvd rtsold \
rwho savecore screenblank securelevel sendmail serial sppp sshd swap1 \
swap2 sysdb syscons sysctl syslogd timed ttys usbd vinum virecover \
wscons xdm xfs ypbind yppasswdd ypserv ypset ypupdated ypxfrd
FILESDIR= /etc/rc.d
FILESMODE= ${BINMODE}

View File

@ -1,10 +0,0 @@
#!/bin/sh
#
# $NetBSD$
#
# PROVIDE: NETWORK
# REQUIRE: network dhclient
# This is a dummy dependancy, for services which require networking
# to be operational before starting.

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

@ -0,0 +1,12 @@
#!/bin/sh
#
# $NetBSD: NETWORKING,v 1.2 2002/03/22 04:33:57 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: NETWORKING NETWORK
# REQUIRE: network dhclient altqd network1 network2 network_ipv6 ppp-user
# KEYWORD: FreeBSD NetBSD
# This is a dummy dependancy, for services which require networking
# to be operational before starting.

View File

@ -1,10 +1,12 @@
#!/bin/sh
#
# $NetBSD: SERVERS,v 1.4 2000/09/21 10:38:04 ad Exp $
# $NetBSD: SERVERS,v 1.9 2002/03/22 04:33:57 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: SERVERS
# REQUIRE: ipmon kdc newsyslog ppp savecore syslogd ike
# REQUIRE: mountcritremote
# KEYWORD: FreeBSD NetBSD
# This is a dummy dependancy, for early-start servers relying on
# some basic configuration.

54
etc/rc.d/abi Normal file
View File

@ -0,0 +1,54 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: abi
# REQUIRE: LOGIN
# KEYWORD: FreeBSD
. /etc/rc.subr
echo -n 'Additional ABI support:'
name="sysvipc"
rcvar=`set_rcvar`
start_cmd="sysv_start"
stop_cmd=":"
sysv_start()
{
echo -n ' sysvipc'
kldload sysvmsg >/dev/null 2>&1
kldload sysvsem >/dev/null 2>&1
kldload sysvshm >/dev/null 2>&1
}
load_rc_config $name
run_rc_command "$1"
name="linux"
rcvar=`set_rcvar`
start_cmd="linux_start"
linux_start()
{
echo -n ' linux'
if ! kldstat -v | grep -E 'linux(aout|elf)' > /dev/null; then
kldload linux > /dev/null 2>&1
fi
if [ -x /compat/linux/sbin/ldconfig ]; then
/compat/linux/sbin/ldconfig
fi
}
load_rc_config $name
run_rc_command "$1"
name="svr4"
rcvar=`set_rcvar`
start_precmd="echo -n ' svr4'"
start_cmd="kldload svr4 > /dev/null 2>&1"
load_rc_config $name
run_rc_command "$1"
echo '.'

View File

@ -1,30 +1,54 @@
#!/bin/sh
#
# $NetBSD: accounting,v 1.2 2000/05/13 08:45:06 lukem Exp $
# $NetBSD: accounting,v 1.7 2002/03/22 04:33:57 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: accounting
# REQUIRE: mountall
# BEFORE: DAEMON
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="accounting"
rcvar=$name
rcvar=`set_rcvar`
accounting_command="/usr/sbin/accton"
accounting_file="/var/account/acct"
start_cmd="accounting_start"
stop_cmd="accounting_stop"
accounting_start()
{
if [ -f /var/account/acct ]; then
echo "Turning on accounting."
/usr/sbin/accton /var/account/acct
case `${CMD_OSTYPE}` in
FreeBSD)
_dir=`dirname "$accounting_file"`
if [ ! -d `dirname "$_dir"` ]; then
if ! mkdir -p "$_dir" ; then
warn "Could not create $_dir."
return 1
fi
fi
if [ ! -e "$accounting_file" ]; then
touch "$accounting_file"
fi
;;
*)
;;
esac
if [ ! -f ${accounting_file} ]; then
echo "Creating accounting file ${accounting_file}"
( umask 022 ; > ${accounting_file} )
fi
echo "Turning on accounting."
${accounting_command} ${accounting_file}
}
accounting_stop()
{
echo "Turning off accounting."
/usr/sbin/accton
${accounting_command}
}
load_rc_config $name

34
etc/rc.d/addswap Normal file
View File

@ -0,0 +1,34 @@
#!/bin/sh
#
# Add additional swap files
#
# $FreeBSD$
#
# PROVIDE: addswap
# REQUIRE: mountcritlocal
# BEFORE: sysctl
# KEYWORD: FreeBSD
. /etc/rc.subr
name="addswap"
start_cmd="addswap_start"
stop_cmd=":"
addswap_start()
{
case ${swapfile} in
[Nn][Oo] | '')
;;
*)
if [ -w "${swapfile}" -a -c /dev/mdctl ]; then
echo "Adding ${swapfile} as additional swap"
mdev=`mdconfig -a -t vnode -f ${swapfile}` && swapon /dev/${mdev}
fi
;;
esac
}
load_rc_config $name
run_rc_command "$1"

18
etc/rc.d/adjkerntz Normal file
View File

@ -0,0 +1,18 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: adjkerntz
# REQUIRE: diskless mountcritlocal random
# BEFORE: network1
# KEYWORD: FreeBSD
. /etc/rc.subr
name="adjkerntz"
start_cmd="adjkerntz -i"
stop_cmd=":"
load_rc_config $name
run_rc_command "$1"

22
etc/rc.d/altqd Normal file
View File

@ -0,0 +1,22 @@
#!/bin/sh
#
# $NetBSD: altqd,v 1.2 2002/03/22 04:33:58 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: altqd
# REQUIRE: network mountcritlocal dhclient
# BEFORE: NETWORKING
# KEYWORD: shutdown
. /etc/rc.subr
name="altqd"
rcvar=$name
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
required_files="/etc/altq.conf"
extra_commands="reload"
load_rc_config $name
run_rc_command "$1"

View File

@ -1,21 +1,68 @@
#!/bin/sh
#
# $NetBSD: amd,v 1.6 2000/09/19 13:04:38 lukem Exp $
# $NetBSD: amd,v 1.10 2002/04/29 12:08:17 lukem Exp $
# $FreeBSD$
#
# PROVIDE: amd
# REQUIRE: rpcbind mountall ypbind
# REQUIRE: rpcbind mountall ypbind nfsclient
# BEFORE: DAEMON
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="amd"
rcvar=$name
command="/usr/sbin/${name}"
rcvar=`set_rcvar`
case `${CMD_OSTYPE}` in
FreeBSD)
start_cmd="echo 'Starting amd.'; /usr/sbin/${name} &"
start_precmd="amd_precmd"
;;
NetBSD)
command_args='-p -a '$amd_dir' -F /etc/amd.conf >/var/run/amd.pid'
required_dirs="$amd_dir"
required_files="/etc/amd.conf"
required_vars="rpcbind"
command="/usr/sbin/${name}"
;;
esac
amd_precmd()
{
case `${CMD_OSTYPE}` in
FreeBSD)
if ! checkyesno nfs_client_enable ; then
force_depend nfsclient || return 1
fi
if [ -z "`check_process rpcbind`" \
-a ! `checkyesno portmap_enable` ]; then
force_depend rpcbind || return 1
fi
case ${amd_map_program} in
[Nn][Oo] | '')
;;
*)
amd_flags="${amd_flags} `eval ${amd_map_program}`"
;;
esac
case "${amd_flags}" in
'')
if [ ! -r /etc/amd.conf ]; then
warn 'amd will not load without arguments'
return 1
fi
;;
*)
amd_flags="-p ${amd_flags} > /var/run/amd.pid 2> /dev/null" \
;;
esac
;;
esac
return 0
}
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"

View File

@ -1,10 +1,12 @@
#!/bin/sh
#
# $NetBSD: apmd,v 1.3 2000/05/13 08:45:06 lukem Exp $
# $NetBSD: apmd,v 1.5 2002/03/22 04:33:58 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: apmd
# REQUIRE: DAEMON
# BEFORE: LOGIN
. /etc/rc.subr

19
etc/rc.d/bgfsck Normal file
View File

@ -0,0 +1,19 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: bgfsck
# REQUIRE: cron devfs
# KEYWORD: FreeBSD
. /etc/rc.subr
name="background-fsck"
rcvar="background_fsck"
start_precmd="echo 'Starting background file system checks'"
start_cmd="nice -4 fsck -B -p 2>&1 | logger -p daemon.notice &"
stop_cmd=":"
load_rc_config $name
run_rc_command "$1"

View File

@ -1,6 +1,7 @@
#!/bin/sh
#
# $NetBSD: bootconf.sh,v 1.2 2000/08/21 23:34:45 lukem Exp $
# $NetBSD: bootconf.sh,v 1.5 2002/03/25 03:22:10 wiz Exp $
# $FreeBSD$
#
# PROVIDE: bootconf
@ -20,9 +21,13 @@ bootconf_start()
else
default=current
fi
if [ "$default" = "current" ]; then
def=`ls -ld /etc/etc.current 2>&1`
default="${def##*-> etc.}"
fi
spc=""
for i in /etc/etc.*
do
for i in /etc/etc.*; do
name="${i##/etc/etc.}"
case $name in
current|default|\*)
@ -43,11 +48,11 @@ bootconf_start()
_DUMMY=/etc/passwd
conf=${_DUMMY}
while [ ! -d /etc/etc.$conf/. ]; do
trap "conf=$default; echo; echo Using default of $conf" 14
trap "conf=$default; echo; echo Using default of $conf" ALRM
echo -n "Which configuration [$default] ? "
(sleep 30 && kill -ALRM $master) >/dev/null 2>&1 &
read conf
trap : 14
trap : ALRM
if [ -z $conf ] ; then
conf=$default
fi
@ -55,8 +60,16 @@ bootconf_start()
conf=${_DUMMY}
fi
done
rm -f /etc/etc.current
ln -s /etc/etc.$conf /etc/etc.current
case $conf in
current|default)
;;
*)
rm -f /etc/etc.current
ln -s /etc/etc.$conf /etc/etc.current
;;
esac
if [ -f /etc/rc.conf ] ; then
. /etc/rc.conf
fi

View File

@ -1,10 +1,12 @@
#!/bin/sh
#
# $NetBSD: bootparams,v 1.4 2000/06/02 22:54:11 fvdl Exp $
# $NetBSD: bootparams,v 1.6 2002/03/22 04:33:58 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: bootparams
# REQUIRE: rpcbind DAEMON
# BEFORE: LOGIN
. /etc/rc.subr

View File

@ -1,9 +1,11 @@
#!/bin/sh
#
# $NetBSD: ccd,v 1.2 2000/04/26 05:13:51 thorpej Exp $
# $NetBSD: ccd,v 1.3 2000/05/13 08:45:06 lukem Exp $
# $FreeBSD$
#
# PROVIDE: disks
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr

48
etc/rc.d/cleanvar Normal file
View File

@ -0,0 +1,48 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: cleanvar
# REQUIRE: adjkerntz mountcritlocal
# BEFORE: network1
# KEYWORD: FreeBSD
purgedir()
{
local dir file
if [ $# -eq 0 ]; then
purgedir .
else
for dir
do
(
cd "$dir" && for file in .* *
do
[ ."$file" = .. -o ."$file" = ... ] && continue
if [ -d "$file" -a ! -L "$file" ]
then
purgedir "$file"
else
rm -f -- "$file"
fi
done
)
done
fi
}
rm -f /var/run/clean_var /var/spool/lock/clean_var
if [ -d /var/run -a ! -f /var/run/clean_var ]; then
purgedir /var/run
# And an initial utmp file
(cd /var/run && cp /dev/null utmp && chmod 644 utmp;)
>/var/run/clean_var
fi
if [ -d /var/spool/lock -a ! -f /var/spool/lock/clean_var ]; then
purgedir /var/spool/lock
>/var/spool/lock/clean_var
fi
rm -rf /var/spool/uucp/.Temp/*

View File

@ -1,15 +1,18 @@
#!/bin/sh
#
# $NetBSD: cleartmp,v 1.2 2000/05/13 08:45:06 lukem Exp $
# $NetBSD: cleartmp,v 1.4 2002/03/22 04:33:58 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: cleartmp
# REQUIRE: mountall
# BEFORE: DAEMON
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="cleartmp"
rcvar="clear_tmp"
rcvar=`set_rcvar clear_tmp`
start_cmd="cleartmp_start"
stop_cmd=":"
@ -24,6 +27,19 @@ cleartmp_start()
(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)
case `${CMD_OSTYPE}` in
FreeBSD)
# Remove X lock files, since they will prevent you from
# restarting X
#
rm -f /tmp/.X*-lock
rm -fr /tmp/.X11-unix
mkdir -m 1777 /tmp/.X11-unix
;;
NetBSD)
;;
esac
}
load_rc_config $name

View File

@ -1,16 +1,17 @@
#!/bin/sh
#
# $NetBSD: cron,v 1.4 2000/07/17 15:24:48 lukem Exp $
# $NetBSD: cron,v 1.5 2000/09/19 13:04:38 lukem Exp $
# $FreeBSD$
#
# PROVIDE: cron
# REQUIRE: LOGIN
# KEYWORD: shutdown
# KEYWORD: FreeBSD NetBSD shutdown
. /etc/rc.subr
name="cron"
rcvar=$name
rcvar="`set_rcvar`"
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"

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

@ -0,0 +1,17 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: devdb
# REQUIRE: syslogd
# KEYWORD: FreeBSD
# Build device name databases if we are not using DEVFS
#
if sysctl vfs.devfs.generation > /dev/null 2>&1 ; then
rm -f /var/run/dev.db
else
dev_mkdb
fi

19
etc/rc.d/devfs Normal file
View File

@ -0,0 +1,19 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: devfs
# REQUIRE: LOGIN
# KEYWORD: FreeBSD
. /etc/rc.subr
name="devfs"
load_rc_config $name
# Setup DEVFS, ie permissions, links etc.
#
ln -fs /dev/ttyv0 /dev/vga

View File

@ -1,10 +1,12 @@
#!/bin/sh
#
# $NetBSD: dhclient,v 1.6 2000/07/26 00:11:49 lukem Exp $
# $NetBSD: dhclient,v 1.8 2002/03/22 04:33:58 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: dhclient
# REQUIRE: network mountcritlocal
# BEFORE: NETWORKING
#
# Note that there no syslog logging of dhclient messages at boot because
# dhclient needs to start before services that syslog depends upon do.

View File

@ -1,10 +1,12 @@
#!/bin/sh
#
# $NetBSD: dhcpd,v 1.3 2000/05/13 08:45:06 lukem Exp $
# $NetBSD: dhcpd,v 1.5 2002/03/22 04:33:58 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: dhcpd
# REQUIRE: DAEMON
# BEFORE: LOGIN
. /etc/rc.subr

View File

@ -1,10 +1,12 @@
#!/bin/sh
#
# $NetBSD: dhcrelay,v 1.3 2000/05/13 08:45:06 lukem Exp $
# $NetBSD: dhcrelay,v 1.5 2002/03/22 04:33:58 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: dhcrelay
# REQUIRE: DAEMON
# BEFORE: LOGIN
. /etc/rc.subr

View File

@ -1,22 +1,26 @@
#!/bin/sh
#
# $NetBSD: dmesg,v 1.4 2000/07/26 00:11:49 lukem Exp $
# $NetBSD: dmesg,v 1.8 2002/03/22 04:33:58 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: dmesg
# REQUIRE: mountcritremote
# BEFORE: DAEMON
# KEYWORD: FreeBSD Daemon
. /etc/rc.subr
name="dmesg"
rcvar=$name
rcvar=`set_rcvar`
dmesg_file="/var/run/dmesg.boot"
start_cmd="do_dmesg"
stop_cmd=":"
do_dmesg()
{
rm -f /var/run/dmesg.boot
dmesg $dmesg_flags > /var/run/dmesg.boot
rm -f ${dmesg_file}
( umask 022 ; /sbin/dmesg $rc_flags > ${dmesg_file} )
}
load_rc_config $name

32
etc/rc.d/dumpon Normal file
View File

@ -0,0 +1,32 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: dumpon
# REQUIRE: initrandom
# BEFORE: disks savecore
# KEYWORD: FreeBSD
. /etc/rc.subr
name="dumpon"
start_cmd="dumpon_start"
stop_cmd=":"
dumpon_start()
{
# Enable dumpdev so that savecore can see it. Enable it
# early so a crash early in the boot process can be caught.
#
case ${dumpdev} in
[Nn][Oo] | '')
;;
*)
/sbin/dumpon -v ${dumpdev}
;;
esac
}
load_rc_config $name
run_rc_command "$1"

View File

@ -1,10 +1,12 @@
#!/bin/sh
#
# $NetBSD$
# $NetBSD: fsck,v 1.2 2001/06/18 06:42:35 lukem Exp $
# $FreeBSD$
#
# PROVIDE: fsck
# REQUIRE: localswap
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
@ -25,14 +27,26 @@ stop_boot()
fsck_start()
{
if [ -e /fastboot ]; then
if [ "$autoboot" = no ]; 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
echo "Starting file system checks:"
case `${CMD_OSTYPE}` in
FreeBSD)
if checkyesno background_fsck; then
fsck -F -p
else
fsck -p
fi
;;
NetBSD)
fsck -p
;;
esac
case $? in
0)
;;
@ -46,9 +60,30 @@ fsck_start()
stop_boot
;;
8)
case `${CMD_OSTYPE}` in
FreeBSD)
if checkyesno fsck_y_enable; then
echo "File system preen failed, trying fsck -y."
fsck -y
case $? in
0)
;;
*)
echo "Automatic file system check failed; help!"
stop_boot
;;
esac
else
echo "Automatic file system check failed; help!"
stop_boot
fi
;;
NetBSD)
echo "Automatic file system check failed; help!"
stop_boot
;;
esac
;;
12)
echo "Boot interrupted."
stop_boot

View File

@ -1,16 +1,17 @@
#!/bin/sh
#
# $NetBSD: inetd,v 1.5 2000/07/17 15:24:48 lukem Exp $
# $NetBSD: inetd,v 1.6 2000/09/19 13:04:38 lukem Exp $
# $FreeBSD$
#
# PROVIDE: inetd
# REQUIRE: DAEMON LOGIN
# KEYWORD: shutdown
# KEYWORD: FreeBSD NetBSD shutdown
. /etc/rc.subr
name="inetd"
rcvar=$name
rcvar=`set_rcvar`
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
required_files="/etc/${name}.conf"

73
etc/rc.d/initrandom Normal file
View File

@ -0,0 +1,73 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: initrandom
# REQUIRE: initdiskless
# BEFORE: disks
# KEYWORD: FreeBSD
. /etc/rc.subr
name="initrandom"
start_cmd="initrandom_start"
stop_cmd=":"
feed_dev_random()
{
if [ -f "${1}" -a -r "${1}" -a -s "${1}" ]; then
cat "${1}" | dd of=/dev/random bs=8k 2>/dev/null
fi
}
initrandom_start()
{
echo -n 'Entropy harvesting:'
if checkyesno harvest_interrupt; then
if [ -w /dev/random ]; then
${SYSCTL_W} kern.random.sys.harvest.interrupt=1 >/dev/null
echo -n ' interrupts'
fi
fi
if checkyesno harvest_ethernet; then
if [ -w /dev/random ]; then
${SYSCTL_W} kern.random.sys.harvest.ethernet=1 >/dev/null
echo -n ' ethernet'
fi
fi
if checkyesno harvest_p_to_p; then
if [ -w /dev/random ]; then
${SYSCTL_W} kern.random.sys.harvest.point_to_point=1 >/dev/null
echo -n ' point_to_point'
fi
fi
echo '.'
# First pass at reseeding /dev/random.
#
case ${entropy_file} in
[Nn][Oo] | '')
;;
*)
if [ -w /dev/random ]; then
feed_dev_random "${entropy_file}"
fi
;;
esac
# XXX temporary until we can get the entropy
# harvesting rate up
# Entropy below is not great,
# but better than nothing.
( ps -fauxww; sysctl -a; date; df -ib; dmesg; ps -fauxww; ) \
| dd of=/dev/random bs=8k 2>/dev/null
cat /bin/ls | dd of=/dev/random bs=8k 2>/dev/null
}
load_rc_config random
run_rc_command "$1"

58
etc/rc.d/ip6fw Normal file
View File

@ -0,0 +1,58 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: ip6fw
# REQUIRE: network2
# BEFORE: network_ipv6
# KEYWORD: FreeBSD
. /etc/rc.subr
name="ip6fw"
rcvar=`set_rcvar ipv6_firewall`
start_cmd="ip6fw_start"
start_precmd="ip6fw_prestart"
stop_cmd="${SYSCTL_W} net.inet6.ip6.fw.enable=0"
ip6fw_prestart()
{
# Load IPv6 firewall module, if not already loaded
if ! ${SYSCTL} net.inet6.ip6.fw.enable > /dev/null 2>&1; then
kldload ip6fw && {
debug 'Kernel IPv6 firewall module loaded.'
return 0
}
warn 'IPv6 firewall kernel module failed to load.'
return 1
fi
}
ip6fw_start()
{
# Specify default rules file if none provided
if [ -z "${ipv6_firewall_script}" ]; then
ipv6_firewall_script=/etc/rc.firewall6
fi
# Load rules
#
if [ -r "${ipv6_firewall_script}" ]; then
. "${ipv6_firewall_script}"
echo 'IPv6 Firewall rules loaded.'
elif [ "`ip6fw l 65535`" = "65535 deny ipv6 from any to any" ]; then
warn 'IPv6 firewall rules have not been loaded. Default' \
' to DENY all access.'
fi
# Enable firewall logging
#
if checkyesno ipv6_firewall_logging ; then
echo 'IPv6 Firewall logging=YES'
sysctl net.inet6.ip6.fw.verbose=1 >/dev/null
fi
}
load_rc_config $name
run_rc_command "$1"

View File

@ -1,27 +1,60 @@
#!/bin/sh
#
# $NetBSD: ipfilter,v 1.8 2000/10/01 05:58:06 lukem Exp $
# $NetBSD: ipfilter,v 1.10 2001/02/28 17:03:50 lukem Exp $
# $FreeBSD$
#
# PROVIDE: ipfilter
# REQUIRE: root beforenetlkm mountcritlocal tty
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="ipfilter"
rcvar=$name
rcvar=`set_rcvar`
load_rc_config $name
case `${CMD_OSTYPE}` in
FreeBSD)
stop_precmd="test -f ${ipfilter_rules}"
;;
NetBSD)
stop_precmd="test -f /etc/ipf.conf -o -f /etc/ipf6.conf"
;;
esac
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"
resync_precmd="$stop_precmd"
resync_cmd="ipfilter_resync"
status_precmd="$stop_precmd"
status_cmd="ipfilter_status"
extra_commands="reload status"
extra_commands="reload resync status"
ipfilter_prestart()
{
case `${CMD_OSTYPE}` in
FreeBSD)
# load ipfilter kernel module if needed
if ! sysctl net.inet.ipf.fr_pass > /dev/null 2>&1; then
if kldload ipl ; then
echo 'IP-filter module loaded.'
else
warn 'IP-filter module failed to load.'
return 1
fi
fi
# check for ipfilter rules
if [ ! -r "${ipfilter_rules}" ]; then
warn 'IP-filter: NO IPF RULES'
return 1
fi
;;
NetBSD)
if [ ! -f /etc/ipf.conf ] && [ ! -f /etc/ipf6.conf ]; then
warn "/etc/ipf*.conf not readable; ipfilter start aborted."
#
@ -35,23 +68,42 @@ ipfilter_prestart()
fi
return 1
fi
;;
esac
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
case `${CMD_OSTYPE}` in
FreeBSD)
${ipfilter_program:-/sbin/ipf} -Fa -f \
"${ipfilter_rules}" ${ipfilter_flags}
;;
NetBSD)
/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
;;
esac
}
ipfilter_stop()
{
case `${CMD_OSTYPE}` in
FreeBSD)
echo "Saving firewall state tables"
${ipfs_program:-/sbin/ipfs} -W ${ipfs_flags}
;;
NetBSD)
;;
esac
# XXX - The following command is not effective for 'lkm's
echo "Disabling ipfilter."
/sbin/ipf -D
}
@ -60,20 +112,42 @@ 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
case `${CMD_OSTYPE}` in
FreeBSD)
${ipfilter_program:-/sbin/ipf} -I -Fa -f \
"${ipfilter_rules}" ${ipfilter_flags}
;;
NetBSD)
/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
;;
esac
}
ipfilter_resync()
{
case `${CMD_OSTYPE}` in
FreeBSD)
# Don't resync if ipfilter is not loaded
[ sysctl net.inet.ipf.fr_pass > /dev/null 2>&1 ] && return
;;
esac
${ipfilter_program:-/sbin/ipf} -y ${ipfilter_flags}
}
ipfilter_status()
{
/sbin/ipf -V
${ipfilter_program:-/sbin/ipf} -V
}
load_rc_config $name
run_rc_command "$1"

70
etc/rc.d/ipfw Normal file
View File

@ -0,0 +1,70 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: ipfw
# REQUIRE: ppp-user
# BEFORE: NETWORKING
# KEYWORD: FreeBSD
. /etc/rc.subr
name="ipfw"
rcvar="firewall_enable"
start_cmd="ipfw_start"
start_precmd="ipfw_precmd"
stop_cmd="${SYSCTL_W} net.inet.ip.fw.enable=0"
ipfw_precmd()
{
if ! ${SYSCTL} net.inet.ip.fw.enable > /dev/null 2>&1 ; then
if ! kldload ipfw ; then
warn unable to load firewall module.
return 1
fi
fi
return 0
}
ipfw_start()
{
# set the firewall rules script if none was specified
[ -z "${firewall_script}" ] && firewall_script=/etc/rc.firewall
if [ -r "${firewall_script}" ]; then
. "${firewall_script}"
echo -n 'Firewall rules loaded, starting divert daemons:'
# Network Address Translation daemon
#
if checkyesno natd_enable ; then
if [ -n "${natd_interface}" ]; then
if echo ${natd_interface} | \
grep -q -E '^[0-9]+(\.[0-9]+){0,3}$'; then
natd_flags="$natd_flags -a ${natd_interface}"
else
natd_flags="$natd_flags -n ${natd_interface}"
fi
echo -n ' natd'
${natd_program:-/sbin/natd} ${natd_flags} ${natd_ifarg}
fi
fi
elif [ "`ipfw l 65535`" = "65535 deny ip from any to any" ]; then
echo 'Warning: kernel has firewall functionality, but' \
' firewall rules are not enabled.'
echo ' All ip services are disabled.'
fi
echo '.'
# Firewall logging
#
! checkyesno firewall_logging && return 0
echo 'Firewall logging=YES'
sysctl net.inet.ip.fw.verbose=1 >/dev/null
}
load_rc_config $name
run_rc_command "$1"

View File

@ -1,17 +1,37 @@
#!/bin/sh
#
# $NetBSD: ipmon,v 1.2 2000/05/13 08:45:07 lukem Exp $
# $NetBSD: ipmon,v 2002/04/18 05:02:01 lukem Exp $
# $FreeBSD$
#
# PROVIDE: ipmon
# REQUIRE: syslogd
# BEFORE: SERVERS
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="ipmon"
rcvar=$name
command="/usr/sbin/${name}"
command_args="&"
rcvar=`set_rcvar`
case `${CMD_OSTYPE}` in
FreeBSD)
command="/sbin/ipmon"
start_precmd="ipmon_precmd"
;;
NetBSD)
command="/usr/sbin/${name}"
command_args="-D"
esac
ipmon_precmd()
{
# Make sure ipfilter is loaded before continuing
if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1 ; then
return 1
fi
return 0
}
load_rc_config $name
run_rc_command "$1"

View File

@ -1,32 +1,84 @@
#!/bin/sh
#
# $NetBSD: ipnat,v 1.5 2000/08/21 23:33:50 lukem Exp $
# $NetBSD: ipnat,v 1.6 2000/09/19 13:04:38 lukem Exp $
# $FreeBSD$
#
# PROVIDE: ipnat
# REQUIRE: ipfilter mountcritremote
# BEFORE: DAEMON
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="ipnat"
rcvar=$name
config="/etc/ipnat.conf"
rcvar=`set_rcvar`
case `${CMD_OSTYPE}` in
FreeBSD)
IPNATDIR="/sbin"
start_precmd="ipnat_precmd"
reload_cmd="ipnat_start"
;;
NetBSD)
IPNATDIR="/usr/sbin"
config="/etc/ipnat.conf"
reload_cmd="/usr/sbin/ipnat -F -C -f ${config}"
start_precmd=
;;
esac
start_cmd="ipnat_start"
stop_cmd="/usr/sbin/ipnat -F -C"
reload_cmd="/usr/sbin/ipnat -F -C -f ${config}"
stop_cmd="${ipnat_program:-${IPNATDIR}/${name}} -F -C"
extra_commands="reload"
ipnat_precmd()
{
# Make sure ipfilter is loaded before continuing
if ! ${SYSCTL} net.inet.ipf.fr_pass >/dev/null 2>&1 ; then
err 'ipnat requires ipfilter be loaded'
return 1
fi
return 0
}
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}
case `${CMD_OSTYPE}` in
FreeBSD)
echo -n 'Installing NAT rules ... '
if [ -r "${ipnat_rules}" ]; then
${ipnat_program:-/sbin/ipnat} -CF -f \
"${ipnat_rules}" ${ipnat_flags}
else
echo -n ' NO IPNAT RULES'
fi
echo '.'
# restore filter/NAT state tables after loading the rules
if checkyesno ipfs_enable ; then
if [ -r "/var/db/ipf/ipstate.ipf" ]; then
echo -n ' ipfs'
${ipfs_program:-/sbin/ipfs} -R ${ipfs_flags}
# remove files to avoid reloading old state
# after an ungraceful shutdown
rm -f /var/db/ipf/ipstate.ipf
rm -f /var/db/ipf/ipnat.ipf
fi
fi
;;
NetBSD)
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}
;;
esac
}
load_rc_config $name

View File

@ -1,17 +1,22 @@
#!/bin/sh
#
# $NetBSD: ipsec,v 1.5 2000/07/21 01:16:07 lukem Exp $
# $NetBSD: ipsec,v 1.7 2002/03/22 04:33:58 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: ipsec
# REQUIRE: root beforenetlkm mountcritlocal tty
# BEFORE: DAEMON
# KEYWORD: FreeBSD NetBSD
# it does not really require beforenetlkm.
. /etc/rc.subr
name="ipsec"
rcvar=$name
rcvar=`set_rcvar`
# This will be overiden from rc.conf on FreeBSD.
ipsec_file="/etc/ipsec.conf"
start_precmd="ipsec_prestart"
start_cmd="ipsec_start"
stop_precmd="test -f /etc/ipsec.conf"
@ -21,8 +26,8 @@ extra_commands="reload"
ipsec_prestart()
{
if [ ! -f /etc/ipsec.conf ]; then
warn "/etc/ipsec.conf not readable; ipsec start aborted."
if [ ! -f "$ipsec_file" ]; then
warn "$ipsec_file not readable; ipsec start aborted."
#
# If booting directly to multiuser, send SIGTERM to
# the parent (/etc/rc) to abort the boot
@ -40,7 +45,7 @@ ipsec_prestart()
ipsec_start()
{
echo "Installing ipsec manual keys/policies."
/sbin/setkey -f /etc/ipsec.conf
/sbin/setkey -f $ipsec_file
}
ipsec_stop()
@ -60,7 +65,7 @@ ipsec_reload()
echo "Reloading ipsec manual keys/policies."
/sbin/setkey -F
/sbin/setkey -FP
/sbin/setkey -f /etc/ipsec.conf
/sbin/setkey -f "$ipsec_file"
}
load_rc_config $name

19
etc/rc.d/ipxrouted Normal file
View File

@ -0,0 +1,19 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: ipxrouted
# REQUIRE: SERVERS
# BEFORE: DAEMON
# KEYWORD: FreeBSD
. /etc/rc.subr
name="ipxrouted"
rcvar=`set_rcvar`
command="/usr/sbin/IPXrouted"
command_args="> /dev/null 2>&1"
load_rc_config $name
run_rc_command "$1"

32
etc/rc.d/kadmind Normal file
View File

@ -0,0 +1,32 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: kadmin
# REQUIRE: kerberos
# BEFORE: DAEMON
# KEYWORD: FreeBSD
. /etc/rc.subr
name="kadmindIV"
# XXX - The rc.conf files must be sourced early so that several
# variables can be set properly.
#
load_rc_config $name
rcvar=`set_rcvar kadmind4_server`
checkyesno kerberos_stash && stash='-n' || stash=
start_cmd="( sleep 20; ${kadmind4_server} ${stash} > /dev/null 2>&1 & ) &"
required_vars="kerberos4_server_enable"
run_rc_command "$1"
name="kadmind5"
rcvar="kadmind5_server_enable"
start_cmd="${kadmind5_server} &"
required_vars="kerberos5_server_enable"
run_rc_command "$1"

View File

@ -1,10 +1,12 @@
#!/bin/sh
#
# $NetBSD: kdc,v 1.2 2000/09/19 13:04:38 lukem Exp $
# $NetBSD: kdc,v 1.5 2002/03/22 04:33:58 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: kdc
# REQUIRE: NETWORK
# REQUIRE: NETWORKING
# BEFORE: SERVERS
. /etc/rc.subr

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

@ -0,0 +1,27 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: kerberos
# REQUIRE: NETWORKING
# KEYWORD: FreeBSD
. /etc/rc.subr
name="kerberosIV"
rcvar="kerberos4_server_enable"
command="${kerberos4_server}"
checkyesno kerberos_stash && stash='-n' || stash=
command_args="${stash} >> /var/log/kerberos.log &"
load_rc_config $name
run_rc_command "$1"
name="kerberos5"
rcvar="kerberos5_server_enable"
command="${kerberos5_server}"
command_args="&"
load_rc_config $name
run_rc_command "$1"

22
etc/rc.d/keyserv Normal file
View File

@ -0,0 +1,22 @@
#!/bin/sh
#
# $FreeBSD$
#
# Start keyserv if we are running Secure RPC
#
# PROVIDE: keyserv
# REQUIRE: ypbind
# BEFORE: DAEMON
# KEYWORD: FreeBSD
. /etc/rc.subr
name="keyserv"
rcvar=`set_rcvar`
command="/usr/sbin/${name}"
required_vars="portmap_enable"
load_rc_config $name
run_rc_command "$1"

View File

@ -1,23 +1,67 @@
#!/bin/sh
#
# $NetBSD: ldconfig,v 1.2 2000/05/13 08:45:07 lukem Exp $
# $NetBSD: ldconfig,v 1.5 2002/03/22 04:33:58 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: ldconfig
# REQUIRE: mountall
# BEFORE: DAEMON
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="ldconfig"
ldconfig_command="/sbin/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
case `${CMD_OSTYPE}` in
FreeBSD)
ldconfig=${ldconfig_command}
checkyesno ldconfig_insecure && ldconfig="${ldconfig} -i"
if [ -x "${ldconfig_command}" ]; then
case `/usr/bin/objformat` in
elf)
_LDC=/usr/lib
for i in ${ldconfig_paths}; do
if [ -d "${i}" ]; then
_LDC="${_LDC} ${i}"
fi
done
echo 'ELF ldconfig path:' ${_LDC}
${ldconfig} -elf ${_LDC}
;;
esac
# Legacy aout support for i386 only
case `sysctl -n hw.machine_arch` in
i386)
# Default the a.out ldconfig path.
: ${ldconfig_paths_aout=${ldconfig_paths}}
_LDC=/usr/lib/aout
for i in ${ldconfig_paths_aout}; do
if [ -d "${i}" ]; then
_LDC="${_LDC} ${i}"
fi
done
echo 'a.out ldconfig path:' ${_LDC}
${ldconfig} -aout ${_LDC}
;;
esac
fi
;;
NetBSD)
if [ -f ${ldconfig_command} ]; then
echo "Creating a.out runtime link editor directory cache."
${ldconfig_command}
fi
;;
*)
;;
esac
}
load_rc_config $name

View File

@ -1,6 +1,7 @@
#!/bin/sh
#
# $NetBSD: lkm1,v 1.5 2000/09/19 13:04:38 lukem Exp $
# $NetBSD: lkm1,v 1.6 2000/10/09 06:11:38 nisimura Exp $
# $FreeBSD$
#
# PROVIDE: beforenetlkm

View File

@ -1,6 +1,7 @@
#!/bin/sh
#
# $NetBSD: lkm2,v 1.3 2000/07/15 02:30:18 lukem Exp $
# $NetBSD: lkm2,v 1.4 2000/09/19 13:04:38 lukem Exp $
# $FreeBSD$
#
# PROVIDE: beforemountlkm

View File

@ -1,10 +1,12 @@
#!/bin/sh
#
# $NetBSD: lkm3,v 1.4 2000/07/15 02:30:18 lukem Exp $
# $NetBSD: lkm3,v 1.6 2002/03/22 04:33:58 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: aftermountlkm
# REQUIRE: mountall
# BEFORE: DAEMON
. /etc/rc.subr

View File

@ -1,11 +1,13 @@
#!/bin/sh
#
# $NetBSD: local,v 1.4 2000/05/13 08:45:07 lukem Exp $
# $NetBSD: local,v 1.6 2002/03/22 04:33:59 thorpej Exp $
# $FreeBSD$
#
# REQUIRE: DAEMON
# PROVIDE: local
# KEYWORD: shutdown
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: FreeBSD NetBSD shutdown
. /etc/rc.subr

89
etc/rc.d/localdaemons Normal file
View File

@ -0,0 +1,89 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: localdaemons
# REQUIRE: abi
# KEYWORD: FreeBSD shutdown
. /etc/rc.subr
name="localdaemons"
start_cmd="locald_start"
stop_cmd="locald_stop"
locald_start()
{
# For each dir in $local_startup, search for init scripts matching *.sh
#
case ${local_startup} in
[Nn][Oo] | '')
;;
*)
echo -n 'Local package initialization:'
slist=""
if [ -z "${script_name_sep}" ]; then
script_name_sep=" "
fi
for dir in ${local_startup}; do
if [ -d "${dir}" ]; then
for script in ${dir}/*.sh; do
slist="${slist}${script_name_sep}${script}"
done
fi
done
script_save_sep="$IFS"
IFS="${script_name_sep}"
for script in ${slist}; do
if [ -x "${script}" ]; then
(set -T
trap 'exit 1' 2
${script} start)
elif [ -f "${script}" -o -L "${script}" ]; then
echo -n " (skipping ${script##*/}, not executable)"
fi
done
IFS="${script_save_sep}"
echo '.'
;;
esac
}
locald_stop()
{
echo -n 'Shutting down daemon processes:'
# For each dir in $local_startup, search for init scripts matching *.sh
case ${local_startup} in
[Nn][Oo] | '')
;;
*)
slist=""
if [ -z "${script_name_sep}" ]; then
script_name_sep=" "
fi
for dir in ${local_startup}; do
if [ -d "${dir}" ]; then
for script in ${dir}/*.sh; do
slist="${slist}${script_name_sep}${script}"
done
fi
done
script_save_sep="$IFS"
IFS="${script_name_sep}"
for script in `reverse_list ${slist}`; do
if [ -x "${script}" ]; then
(set -T
trap 'exit 1' 2
${script} stop)
fi
done
IFS="${script_save_sep}"
echo '.'
;;
esac
}
load_rc_config $name
run_rc_command "$1"

View File

@ -1,27 +1,46 @@
#!/bin/sh
#
# $NetBSD: nfslocking,v 1.3 2000/05/13 08:45:07 lukem Exp $
# $NetBSD: nfslocking,v 1.6 2002/03/24 15:52:41 lukem Exp $
# $FreeBSD$
#
# PROVIDE: nfslocking
# REQUIRE: nfsd
# REQUIRE: nfsserver nfsclient nfsd
# BEFORE: DAEMON
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
arg=$1
start_precmd='checkyesno nfs_server || checkyesno nfs_client'
case `${CMD_OSTYPE}` in
FreeBSD)
RCVAR_SERVER="nfs_server_enable"
RCVAR_CLIENT="nfs_client_enable"
RCVAR_STATD="rpc_statd_enable"
RCVAR_LOCKD="rpc_lockd_enable"
;;
NetBSD)
RCVAR_SERVER="nfs_server"
RCVAR_CLIENT="nfs_client"
RCVAR_STATD="statd"
RCVAR_LOCKD="lockd"
;;
esac
start_precmd="checkyesno ${RCVAR_SERVER} || checkyesno ${RCVAR_CLIENT}
[ -n "$rc_force" ]"
stop_precmd=$start_precmd
status_precmd=$start_precmd
name="statd"
rcvar=$name
rcvar=${RCVAR_STATD}
command="/usr/sbin/rpc.${name}"
load_rc_config $name
run_rc_command "$arg"
name="lockd"
rcvar=$name
rcvar=${RCVAR_LOCKD}
command="/usr/sbin/rpc.${name}"
load_rc_config $name
run_rc_command "$arg"

19
etc/rc.d/lomac Normal file
View File

@ -0,0 +1,19 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: lomac
# REQUIRE: mountcritremote
# BEFORE: syslogd
# KEYWORD: FreeBSD
. /etc/rc.subr
name="lomac"
rcvar=`set_rcvar`
start_cmd="kldload lomac >/dev/null 2>&1"
stop_cmd=":"
load_rc_config $name
run_rc_command "$1"

View File

@ -1,18 +1,28 @@
#!/bin/sh
#
# $NetBSD: lpd,v 1.3 2000/05/13 08:45:07 lukem Exp $
# $NetBSD: lpd,v 1.5 2002/03/22 04:33:59 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: lpd
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="lpd"
rcvar=$name
rcvar=`set_rcvar`
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
required_files="/etc/printcap"
case `${CMD_OSTYPE}` in
NetBSD)
pidfile="/var/run/${name}.pid"
;;
*)
;;
esac
load_rc_config $name
run_rc_command "$1"

View File

@ -1,10 +1,12 @@
#!/bin/sh
#
# $NetBSD: mopd,v 1.3 2000/05/13 08:45:07 lukem Exp $
# $NetBSD: mopd,v 1.5 2002/03/22 04:33:59 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: mopd
# REQUIRE: DAEMON
# BEFORE: LOGIN
. /etc/rc.subr

View File

@ -1,10 +1,13 @@
#!/bin/sh
#
# $NetBSD: motd,v 1.5 2000/09/19 13:04:38 lukem Exp $
# $FreeBSD$
#
# PROVIDE: motd
# REQUIRE: mountcritremote
# BEFORE: LOGIN
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
@ -13,6 +16,17 @@ rcvar="update_motd"
start_cmd="motd_start"
stop_cmd=":"
case `${CMD_OSTYPE}` in
FreeBSD)
T=`mktemp /tmp/_motd.XXXXXX`
PERMS="644"
;;
NetBSD)
T="/etc/_motd"
PERMS="664"
;;
esac
motd_start()
{
# Update kernel info in /etc/motd
@ -21,12 +35,24 @@ motd_start()
#
echo "Updating motd."
if [ ! -f /etc/motd ]; then
install -c -o root -g wheel -m 664 /dev/null /etc/motd
install -c -o root -g wheel -m ${PERMS} /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
case `${CMD_OSTYPE}` in
FreeBSD)
uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T}
awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} else {print}}' < /etc/motd >> ${T}
;;
NetBSD)
sysctl -n kern.version | while read i; do echo $i; break; done > $T
sed '1{/^NetBSD.*/{d;};};' < /etc/motd >> $T
;;
esac
cmp -s $T /etc/motd || {
echo T=$T
cp $T /etc/motd
chmod ${PERMS} /etc/motd
}
rm -f $T
}

View File

@ -1,6 +1,7 @@
#!/bin/sh
#
# $NetBSD: mountall,v 1.2 2000/04/27 21:00:50 veego Exp $
# $NetBSD: mountall,v 1.3 2000/05/13 08:45:07 lukem Exp $
# $FreeBSD$
#
# PROVIDE: mountall

View File

@ -1,10 +1,12 @@
#!/bin/sh
#
# $NetBSD: mountcritlocal,v 1.3 2000/07/26 00:11:49 lukem Exp $
# $NetBSD: mountcritlocal,v 1.7 2002/04/29 12:29:53 lukem Exp $
# $FreeBSD$
#
# PROVIDE: mountcritlocal
# REQUIRE: root
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
@ -14,16 +16,52 @@ stop_cmd=":"
mountcritlocal_start()
{
# mount critical local filesystems
# (as specified in $critical_filesystems_beforenet)
#
mount_critical_filesystems local
case `${CMD_OSTYPE}` in
FreeBSD)
# Set up the list of network filesystem types for which mounting
# should be delayed until after network initialization.
networkfs_types='nfs:NFS smbfs:SMB portalfs:PORTAL'
case ${extra_netfs_types} in
[Nn][Oo])
;;
*)
networkfs_types="${networkfs_types} ${extra_netfs_types}"
;;
esac
# 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 -- *)
# Mount everything except nfs filesystems.
mount_excludes='no'
for i in ${networkfs_types}; do
fstype=${i%:*}
mount_excludes="${mount_excludes}${fstype},"
done
mount_excludes=${mount_excludes%,}
mount -a -t ${mount_excludes}
case $? in
0)
;;
*)
echo 'Mounting /etc/fstab filesystems failed,' \
' startup aborted'
exit 1
;;
esac
;;
NetBSD)
# Mount critical filesystems that are `local'
# (as specified in $critical_filesystems_local)
# This usually includes /var.
#
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 -- *)
;;
esac
}
load_rc_config $name

View File

@ -1,19 +1,89 @@
#!/bin/sh
#
# $NetBSD: mountcritremote,v 1.2 2000/05/13 08:45:07 lukem Exp $
# $NetBSD: mountcritremote,v 1.7 2002/04/29 12:29:53 lukem Exp $
# $FreeBSD$
#
# PROVIDE: mountcritremote
# REQUIRE: NETWORK root mountcritlocal
# REQUIRE: NETWORKING root mountcritlocal
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
# mount critical remote filesystems
# (as specified in $critical_filesystems)
#
name="mountcritremote"
start_cmd="mount_critical_filesystems remote"
stop_cmd=":"
case `${CMD_OSTYPE}` in
FreeBSD)
start_cmd="mountcritremote_start"
start_precmd="mountcritremote_precmd"
;;
NetBSD)
start_cmd="mountcritremote_start"
;;
esac
# Mount NFS filesystems if present in /etc/fstab
#
# XXX When the vfsload() issues with nfsclient support and related sysctls
# have been resolved, this block can be removed, and the condition that
# skips nfs in the following block (for "other network filesystems") can
# be removed.
#
mountcritremote_precmd()
{
case "`mount -d -a -t nfs 2> /dev/null`" in
*mount_nfs*)
# Handle absent nfs client support
if ! sysctl vfs.nfs >/dev/null 2>&1 ; then
kldload nfsclient || warn 'nfs mount ' \
'requested, but no nfs client in kernel' \
return 1
fi
;;
esac
return 0
}
mountcritremote_start()
{
case `${CMD_OSTYPE}` in
FreeBSD)
# Mount nfs filesystems.
#
echo -n 'Mounting NFS file systems:'
mount -a -t nfs
echo '.'
# Mount other network filesystems if present in /etc/fstab
for i in ${networkfs_types}; do
fstype=${i%:*}
fsdecr=${i#*:}
[ "${fstype}" = "nfs" ] && continue
case "`mount -d -a -t ${fstype}`" in
*mount_${fstype}*)
echo -n "Mounting ${fsdecr} file systems:"
mount -a -t ${fstype}
echo '.'
;;
esac
done
# Cleanup /var again just in case it's a network mount
/etc/rc.d/cleanvar start
rm -f /var/run/clean_var /var/spool/lock/clean_var
;;
NetBSD)
# Mount critical filesystems that may be `remote'.
# (as specified in $critical_filesystems_remote)
# This usually includes /usr.
#
mount_critical_filesystems remote
;;
esac
}
load_rc_config $name
run_rc_command "$1"

View File

@ -1,24 +1,59 @@
#!/bin/sh
#
# $NetBSD: mountd,v 1.6 2000/06/02 22:54:11 fvdl Exp $
# $NetBSD: mountd,v 1.11 2002/01/31 01:26:06 lukem Exp $
# $FreeBSD$
#
# PROVIDE: mountd
# REQUIRE: NETWORK mountall beforemountlkm rpcbind quota
# REQUIRE: NETWORKING mountall beforemountlkm nfsserver rpcbind quota
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="mountd"
rcvar="nfs_server"
command="/usr/sbin/${name}"
required_files="/etc/exports"
start_precmd="mountd_precmd"
extra_commands="reload"
case `${CMD_OSTYPE}` in
FreeBSD)
rcvar=`set_rcvar nfs_server`
command="/sbin/${name}"
;;
NetBSD)
rcvar=`set_rcvar`
command="/usr/sbin/${name}"
;;
esac
mountd_precmd()
{
case `${CMD_OSTYPE}` in
FreeBSD)
if ! sysctl vfs.nfsrv >/dev/null 2>&1; then
force_depend nfsserver || return 1
fi
if [ -z "`check_process rpcbind`" -a ! `checkyesno portmap_enable` ]; then
force_depend rpcbind || return 1
fi
# mountd flags will differ depending on rc.conf settings
#
case ${nfs_server_enable} in
[Yy][Ee][Ss])
if checkyesno weak_mountd_authentication ; then
mountd_flags="${mountd_flags} -n"
fi
;;
*)
if checkyesno single_mountd_enable ; then
checkyesno weak_mountd_authentication && mountd_flags="-n"
fi
esac
;;
esac
rm -f /var/db/mountdtab
echo -n > /var/db/mountdtab
( umask 022 ; > /var/db/mountdtab )
return 0
}

47
etc/rc.d/moused Normal file
View File

@ -0,0 +1,47 @@
#!/bin/sh
#
# $NetBSD: moused,v 1.1 2001/10/29 23:25:01 augustss Exp $
# $FreeBSD$
#
# PROVIDE: moused
# REQUIRE: DAEMON
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name=moused
rcvar=`set_rcvar`
case `${CMD_OSTYPE}` in
FreeBSD)
start_cmd="moused_start"
;;
NetBSD)
command="/usr/sbin/${name}"
;;
esac
moused_start()
{
echo -n 'Starting moused:'
/usr/sbin/moused ${moused_flags} -p ${moused_port} -t ${moused_type}
_mousechar_arg=
case ${mousechar_start} in
[Nn][Oo] | '')
;;
*)
echo -n ' mousechar_start'
_mousechar_arg="-M ${mousechar_start}"
;;
esac
for ttyv in /dev/ttyv* ; do
vidcontrol < ${ttyv} ${_mousechar_arg} -m on
done
echo '.'
}
load_rc_config $name
run_rc_command "$1"

18
etc/rc.d/mroute6d Normal file
View File

@ -0,0 +1,18 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: mroute6d
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: FreeBSD
. /etc/rc.subr
name="mroute6d"
rcvar=`set_rcvar`
command="/usr/local/sbin/pim6dd"
load_rc_config $name
run_rc_command "$1"

View File

@ -1,15 +1,18 @@
#!/bin/sh
#
# $NetBSD: mrouted,v 1.4 2000/05/13 08:45:07 lukem Exp $
# $NetBSD: mrouted,v 1.6 2002/03/22 04:33:59 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: mrouted
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="mrouted"
rcvar=$name
rcvar=`set_rcvar`
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
required_files="/etc/${name}.conf"

14
etc/rc.d/msgs Normal file
View File

@ -0,0 +1,14 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: msgs
# REQUIRE: LOGIN
# KEYWORD: FreeBSD
# Make a bounds file for msgs(1) if there isn't one already
#
if [ -d /var/msgs -a ! -f /var/msgs/bounds -a ! -L /var/msgs/bounds ]; then
echo 0 > /var/msgs/bounds
fi

View File

@ -1,19 +1,124 @@
#!/bin/sh
#
# $NetBSD: named,v 1.5 2000/05/13 08:45:07 lukem Exp $
# $NetBSD: named,v 1.10 2002/03/22 04:33:59 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: named
# REQUIRE: SERVERS
# BEFORE: DAEMON
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="named"
rcvar=$name
rcvar=`set_rcvar`
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
start_precmd="named_precmd"
required_dirs="$named_chrootdir" # if it is set, it must exist
extra_commands="reload"
case `${CMD_OSTYPE}` in
FreeBSD)
nuser=bind
ngroup=bind
;;
NetBSD)
nuser=named
ngroup=named
;;
esac
# If running in a chroot cage, ensure that the appropriate files
# exist inside the cage, as well as helper symlinks into the cage
# from outside.
#
# As this is called after the is_running and required_dir checks
# are made in run_rc_command(), we can safely assume ${named_chrootdir}
# exists and named isn't running at this point (unless forcestart
# is used).
#
chroot_autoupdate()
{
# If the named-xfer in the system is newer than the one in the
# chroot directory or if it (in the chrootdir) doesn't exist
# copy it over
#
if [ ! -x "${named_chrootdir}/usr/libexec/named-xfer" -o \
"${named_chrootdir}/usr/libexec/named-xfer" -ot \
/usr/libexec/named-xfer ]; then
rm -f "${named_chrootdir}/usr/libexec/named-xfer"
cp -p /usr/libexec/named-xfer "${named_chrootdir}/usr/libexec"
fi
# Copy /dev/null over, if neccessary. Preserve everything (perms,
# ownership, mod times).
#
if [ ! -c "${named_chrootdir}/dev/null" ]; then
rm -f "${named_chrootdir}/dev/null"
( cd /dev ; /bin/pax -rw -pe null "${named_chrootdir}/dev" )
fi
# Copy local timezone information if it's not up-to-date.
#
if [ -f /etc/localtime ]; then
cmp -s /etc/localtime "${named_chrootdir}/etc/localtime" || \
cp -p /etc/localtime "${named_chrootdir}/etc/localtime"
fi
}
# Make symlinks to the correct pid and ndc socket files
#
make_symlinks()
{
ln -fs "${named_chrootdir}/var/run/named.pid" /var/run/named.pid
ln -fs "${named_chrootdir}/var/run/ndc" /var/run/ndc
}
named_precmd()
{
case `${CMD_OSTYPE}` in
FreeBSD)
! checkyesno named_rcng && return 0
# Is the user using a sandbox?
if [ -z "$named_chrootdir" ]; then
rc_flags="-u $nuser -g $ngroup rc_flags"
return 0
fi
# Do the following checks only if the user wants them done
checkyesno named_chroot_autoupdate && chroot_autoupdate
;;
NetBSD)
chroot_autoupdate
;;
esac
case `${CMD_OSTYPE}` in
FreeBSD)
# Make the symlinks only if the user wants them done.
checkyesno named_symlink_enable && make_symlinks
;;
NetBSD)
make_symlinks
;;
esac
# Change run_rc_commands()'s internal copy of $named_flags
#
case `${CMD_OSTYPE}` in
FreeBSD)
! checkyesno named_rcng && return
;;
esac
rc_flags="-u $nuser -g $ngroup -t ${named_chrootdir} $rc_flags"
}
load_rc_config $name
# The following variable requires that rc.conf be loaded first
#
required_dirs="$named_chrootdir" # if it is set, it must exist
run_rc_command "$1"

View File

@ -1,24 +1,25 @@
#!/bin/sh
#
# $NetBSD$
# $NetBSD: newsyslog,v 1.5 2002/03/24 15:51:26 lukem Exp $
# $FreeBSD$
#
# PROVIDE: newsyslog
# REQUIRE: mountcritremote sysdb
# BEFORE: syslogd
# BEFORE: syslogd SERVERS
. /etc/rc.subr
name="newsyslog"
rcvar=$name
required_files="/etc/newsyslog.conf"
start_precmd="checkyesno newsyslog"
start_cmd="newsyslog_start"
stop_cmd=":"
newsyslog_start()
{
echo -n "Trimming log files:"
/usr/bin/newsyslog -s $newsyslog_flags
/usr/bin/newsyslog -s $rc_flags
echo " done."
}

57
etc/rc.d/nfsclient Normal file
View File

@ -0,0 +1,57 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: nfsclient
# REQUIRE: NETWORKING mountcritremote rpcbind
# KEYWORD: FreeBSD shutdown
. /etc/rc.subr
name="nfsclient"
rcvar="nfs_client_enable"
start_cmd="nfsclient_start"
start_precmd="nfsclient_precmd"
stop_cmd="unmount_all"
# Load nfs module if it was not compiled into the kernel
nfsclient_precmd()
{
if ! sysctl vfs.nfs >/dev/null 2>&1; then
if ! kldload nfsclient ; then
warn 'Could not load nfs client module'
return 1
fi
fi
return 0
}
nfsclient_start()
{
#
# Set some nfs client related sysctls
#
if [ -n "${nfs_access_cache}" ]; then
echo -n " NFS access cache time=${nfs_access_cache}"
sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null
fi
if [ -n "${nfs_bufpackets}" ]; then
sysctl vfs.nfs.bufpackets=${nfs_bufpackets} > /dev/null
fi
unmount_all
}
unmount_all()
{
# If /var/db/mounttab exists, some nfs-server has not been
# successfully notified about a previous client shutdown.
# If there is no /var/db/mounttab, we do nothing.
if [ -f /var/db/mounttab ]; then
rpc.umntall -k
fi
}
load_rc_config $name
run_rc_command "$1"

View File

@ -1,17 +1,44 @@
#!/bin/sh
#
# $NetBSD: nfsd,v 1.2 2000/05/13 08:45:07 lukem Exp $
# $NetBSD: nfsd,v 1.4 2001/06/16 06:13:10 lukem Exp $
# $FreeBSD$
#
# PROVIDE: nfsd
# REQUIRE: mountd
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="nfsd"
rcvar="nfs_server"
command="/usr/sbin/${name}"
required_vars="rpcbind"
rcvar=`set_rcvar nfs_server`
case `${CMD_OSTYPE}` in
FreeBSD)
command="/sbin/nfsd"
command_args="${nfs_server_flags}"
required_vars="portmap_enable"
start_precmd="nfsd_precmd"
;;
NetBSD)
command="/usr/sbin/${name}"
required_vars="mountd rpcbind"
start_precmd=
;;
esac
nfsd_precmd()
{
if ! sysctl vfs.nfsrv >/dev/null 2>&1; then
force_depend nfsserver || return 1
fi
if checkyesno nfs_reserved_port_only ; then
echo -n ' NFS on reserved port only=YES'
sysctl vfs.nfsrv.nfs_privport=1 > /dev/null
fi
return 0
}
load_rc_config $name
run_rc_command "$1"

View File

@ -1,27 +1,46 @@
#!/bin/sh
#
# $NetBSD: nfslocking,v 1.3 2000/05/13 08:45:07 lukem Exp $
# $NetBSD: nfslocking,v 1.6 2002/03/24 15:52:41 lukem Exp $
# $FreeBSD$
#
# PROVIDE: nfslocking
# REQUIRE: nfsd
# REQUIRE: nfsserver nfsclient nfsd
# BEFORE: DAEMON
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
arg=$1
start_precmd='checkyesno nfs_server || checkyesno nfs_client'
case `${CMD_OSTYPE}` in
FreeBSD)
RCVAR_SERVER="nfs_server_enable"
RCVAR_CLIENT="nfs_client_enable"
RCVAR_STATD="rpc_statd_enable"
RCVAR_LOCKD="rpc_lockd_enable"
;;
NetBSD)
RCVAR_SERVER="nfs_server"
RCVAR_CLIENT="nfs_client"
RCVAR_STATD="statd"
RCVAR_LOCKD="lockd"
;;
esac
start_precmd="checkyesno ${RCVAR_SERVER} || checkyesno ${RCVAR_CLIENT}
[ -n "$rc_force" ]"
stop_precmd=$start_precmd
status_precmd=$start_precmd
name="statd"
rcvar=$name
rcvar=${RCVAR_STATD}
command="/usr/sbin/rpc.${name}"
load_rc_config $name
run_rc_command "$arg"
name="lockd"
rcvar=$name
rcvar=${RCVAR_LOCKD}
command="/usr/sbin/rpc.${name}"
load_rc_config $name
run_rc_command "$arg"

30
etc/rc.d/nfsserver Normal file
View File

@ -0,0 +1,30 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: nfsserver
# REQUIRE: NETWORKING mountcritremote
# KEYWORD: FreeBSD
. /etc/rc.subr
name="nfsserver"
rcvar="nfs_server_enable"
start_cmd="nfsserver_start"
stop_cmd=":"
# Load nfs modules if they were not compiled into the kernel
nfsserver_start()
{
if ! sysctl vfs.nfsrv >/dev/null 2>&1; then
if ! kldload nfsserver ; then
warn 'Could not load NFS server module'
return 1
fi
fi
return 0
}
load_rc_config $name
run_rc_command "$1"

View File

@ -1,18 +1,56 @@
#!/bin/sh
#
# $NetBSD: ntpd,v 1.2 2000/05/13 08:45:07 lukem Exp $
# $NetBSD: ntpd,v 1.6 2002/03/22 04:33:59 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: ntpd
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="ntpd"
rcvar=$name
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
case `${CMD_OSTYPE}` in
FreeBSD)
name="xntpd"
;;
NetBSD)
name="ntpd"
start_precmd="ntpd_precmd"
;;
esac
rcvar=`set_rcvar`
command="/usr/sbin/ntpd"
pidfile="/var/run/ntpd.pid"
required_files="/etc/ntp.conf"
ntpd_precmd()
{
if [ -z "$ntpd_chrootdir" ]; then
return 0;
fi
# If running in a chroot cage, ensure that the appropriate files
# exist inside the cage, as well as helper symlinks into the cage
# from outside.
#
# As this is called after the is_running and required_dir checks
# are made in run_rc_command(), we can safely assume ${ntpd_chrootdir}
# exists and ntpd isn't running at this point (unless forcestart
# is used).
#
if [ ! -c "${ntpd_chrootdir}/dev/clockctl" ]; then
rm -f "${ntpd_chrootdir}/dev/clockctl"
( cd /dev ; /bin/pax -rw -pe clockctl "${ntpd_chrootdir}/dev" )
fi
ln -fs "${ntpd_chrootdir}/var/db/ntp.drift" /var/db/ntp.drift
# Change run_rc_commands()'s internal copy of $ntpd_flags
#
rc_flags="-u ntpd:ntpd -i ${ntpd_chrootdir} $rc_flags"
}
load_rc_config $name
run_rc_command "$1"

View File

@ -1,29 +1,41 @@
#!/bin/sh
#
# $NetBSD: ntpdate,v 1.5 2000/08/21 14:48:39 abs Exp $
# $NetBSD: ntpdate,v 1.8 2002/03/22 04:16:39 lukem Exp $
# $FreeBSD$
#
# PROVIDE: ntpdate
# REQUIRE: NETWORK syslogd
# REQUIRE: NETWORKING syslogd
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="ntpdate"
rcvar=$name
start_cmd="ntpdate_start"
stop_cmd=":"
rcvar=`set_rcvar`
case `${CMD_OSTYPE}` in
FreeBSD)
command="/usr/sbin/${name}"
command_args=">/dev/null 2>&1"
pidfile="/var/run/${name}.pid"
;;
NetBSD)
start_cmd="ntpdate_start"
stop_cmd=":"
;;
esac
ntpdate_start()
{
if [ -z "$ntpdate_hosts" ]; then
ntpdate_hosts=`awk '
/^server[ \t]*127.127/ {next}
/^(server|peer)/ {print $2}
/^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
ntpdate $rc_flags $ntpdate_hosts
fi
}

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

@ -0,0 +1,16 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: mail
# REQUIRE: LOGIN
# KEYWORD: FreeBSD
# XXX - TEMPORARY SCRIPT UNTIL YOU WRITE YOUR OWN REPLACEMENT.
#
. /etc/rc.subr
load_rc_config 'XXX'
[ "${mta_start_script}" != "/etc/rc.sendmail" ] && sh ${mta_start_script}

View File

@ -1,6 +1,7 @@
#!/bin/sh
#
# $NetBSD$
# $NetBSD: poffd,v 1.1 2001/01/14 15:37:22 minoura Exp $
# $FreeBSD$
#
# PROVIDE: poffd

View File

@ -1,24 +1,42 @@
#!/bin/sh
#
# $NetBSD: postfix,v 1.4 2000/05/13 08:45:08 lukem Exp $
# $NetBSD: postfix,v 1.6 2002/02/12 02:19:27 lukem Exp $
# $FreeBSD$
#
# PROVIDE: mail
# REQUIRE: LOGIN
# we could do this, but make mail start late, so that things like
# .forward's are not processed until the system is fully operational
## REQUIRE: DAEMON
# we make mail start late, so that things like .forward's are not
# processed until the system is fully operational
. /etc/rc.subr
name="postfix"
rcvar=$name
required_files="/etc/${name}/main.cf"
start_cmd="postfix start"
stop_cmd="postfix stop"
reload_cmd="postfix reload"
start_precmd="postfix_precmd"
start_cmd="${name} start"
stop_cmd="${name} stop"
reload_cmd="${name} reload"
extra_commands="reload"
spooletcdir="/var/spool/${name}/etc"
required_dirs=$spooletcdir
postfix_precmd()
{
# As this is called after the is_running and required_dir checks
# are made in run_rc_command(), we can safely assume ${spooletcdir}
# exists and postfix isn't running at this point (unless forcestart
# is used).
#
for f in localtime resolv.conf services; do
if [ -f /etc/$f ]; then
cmp -s /etc/$f ${spooletcdir}/$f || \
cp -p /etc/$f ${spooletcdir}/$f
fi
done
}
load_rc_config $name
run_rc_command "$1"

48
etc/rc.d/ppp Normal file
View File

@ -0,0 +1,48 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: ppp-user
# REQUIRE: network1
# KEYWORD: FreeBSD
. /etc/rc.subr
name="ppp"
rcvar="ppp_enable"
start_cmd="ppp_start"
stop_cmd=":"
ppp_start()
{
# Establish ppp mode.
#
if [ "${ppp_mode}" != "ddial" -a "${ppp_mode}" != "direct" \
-a "${ppp_mode}" != "dedicated" \
-a "${ppp_mode}" != "background" ]; then
ppp_mode="auto"
fi
ppp_command="/usr/sbin/ppp -quiet -${ppp_mode}"
# Switch on NAT mode?
#
case ${ppp_nat} in
[Yy][Ee][Ss])
ppp_command="${ppp_command} -nat"
;;
esac
ppp_command="${ppp_command} ${ppp_profile}"
echo "Starting ppp as \"${ppp_user}\""
su -m ${ppp_user} -c "exec ${ppp_command}"
# Re-Sync ipfilter so it picks up any new network interfaces
#
/etc/rc.d/ipfilter resync
}
load_rc_config $name
run_rc_command "$1"

48
etc/rc.d/ppp-user Normal file
View File

@ -0,0 +1,48 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: ppp-user
# REQUIRE: network1
# KEYWORD: FreeBSD
. /etc/rc.subr
name="ppp"
rcvar="ppp_enable"
start_cmd="ppp_start"
stop_cmd=":"
ppp_start()
{
# Establish ppp mode.
#
if [ "${ppp_mode}" != "ddial" -a "${ppp_mode}" != "direct" \
-a "${ppp_mode}" != "dedicated" \
-a "${ppp_mode}" != "background" ]; then
ppp_mode="auto"
fi
ppp_command="/usr/sbin/ppp -quiet -${ppp_mode}"
# Switch on NAT mode?
#
case ${ppp_nat} in
[Yy][Ee][Ss])
ppp_command="${ppp_command} -nat"
;;
esac
ppp_command="${ppp_command} ${ppp_profile}"
echo "Starting ppp as \"${ppp_user}\""
su -m ${ppp_user} -c "exec ${ppp_command}"
# Re-Sync ipfilter so it picks up any new network interfaces
#
/etc/rc.d/ipfilter resync
}
load_rc_config $name
run_rc_command "$1"

31
etc/rc.d/pppoed Normal file
View File

@ -0,0 +1,31 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: pppoed
# REQUIRE: NETWORKING
# BEFORE: DAEMON
# KEYWORD: FreeBSD
. /etc/rc.subr
name="pppoed"
rcvar="`set_rcvar`"
start_cmd="pppoed_start"
# XXX stop_cmd will not be straightforward
stop_cmd=":"
pppoed_start()
{
if [ -n "${pppoed_provider}" ]; then
pppoed_flags="${pppoed_flags} -p ${pppoed_provider}"
fi
echo 'Starting pppoed'
_opts=$-; set -f
/usr/libexec/pppoed ${pppoed_flags} ${pppoed_interface}
set +f; set -${_opts}
}
load_rc_config $name
run_rc_command "$1"

View File

@ -1,10 +1,13 @@
#!/bin/sh
#
# $NetBSD: pwcheck,v 1.2 2000/05/13 08:45:08 lukem Exp $
# $NetBSD: pwcheck,v 1.4 2002/03/22 04:33:59 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: pwcheck
# REQUIRE: mountcritremote syslogd
# BEFORE: DAEMON
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr

View File

@ -1,23 +1,34 @@
#!/bin/sh
#
# $NetBSD: quota,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $
# $FreeBSD$
#
# Enable/Check the quotas (must be after ypbind if using NIS)
#
# PROVIDE: quota
# REQUIRE: mountall
# REQUIRE: mountcritremote
# BEFORE: DAEMON
# KEYWORD: FreeBSD
. /etc/rc.subr
name="quota"
rcvar="enable_quotas"
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
if checkyesno check_quotas ; then
echo -n 'Checking quotas:'
quotacheck -a
echo ' done.'
fi
echo -n 'Enabling quotas:'
quotaon -a
echo ' done.'
}
load_rc_config $name

View File

@ -1,10 +1,12 @@
#!/bin/sh
#
# $NetBSD$
# $NetBSD: racoon,v 1.3 2002/03/22 04:33:59 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: ike
# REQUIRE: kdc ppp
# REQUIRE: isdnd kdc ppp
# BEFORE: SERVERS
. /etc/rc.subr

View File

@ -1,6 +1,7 @@
#!/bin/sh
#
# $NetBSD: raidframe,v 1.4 2000/05/16 16:54:33 oster Exp $
# $NetBSD: raidframe,v 1.6 2002/01/27 14:16:33 lukem Exp $
# $FreeBSD$
#
# PROVIDE: disks
@ -13,7 +14,7 @@ stop_cmd=":"
raidframe_start()
{
# Configure raid devices.
# Configure non-auto-configured raid devices.
# Ensure order by globbing raid[0-9].conf before raid[0-9][0-9].conf.
#
for cfg in /etc/raid[0-9].conf /etc/raid[0-9][0-9].conf ; do
@ -23,18 +24,15 @@ raidframe_start()
raidctl -c $cfg $dev
done
# Initiate parity/mirror reconstruction as needed.
# Backgrounded, and sequentially ordered.
#
# XXX: this currently doesn't work for autoconfigured raid devices
# that don't have a corresponding raidN.conf
# Initiate parity/mirror reconstruction as needed, in the background.
#
(
for cfg in /etc/raid[0-9].conf /etc/raid[0-9][0-9].conf ; do
[ ! -f $cfg ] && continue
dev=${cfg##*/}
dev=${dev%%.conf}
raidctl -P $dev
for dev in `sysctl -n hw.disknames`; do
case $dev in
raid[0-9]*)
raidctl -P $dev
;;
esac
done
) &
}

93
etc/rc.d/random Normal file
View File

@ -0,0 +1,93 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: random
# REQUIRE: diskless mountcritlocal initrandom
# BEFORE: network1
# KEYWORD: FreeBSD shutdown
. /etc/rc.subr
name="random"
start_cmd="random_start"
stop_cmd="random_stop"
feed_dev_random()
{
if [ -f "${1}" -a -r "${1}" -a -s "${1}" ]; then
cat "${1}" | dd of=/dev/random bs=8k 2>/dev/null
fi
}
random_start()
{
# Reseed /dev/random with previously stored entropy.
case ${entropy_dir} in
[Nn][Oo])
;;
*)
entropy_dir=${entropy_dir:-/var/db/entropy}
if [ -d "${entropy_dir}" ]; then
if [ -w /dev/random ]; then
for seedfile in ${entropy_dir}/*; do
feed_dev_random "${seedfile}"
done
fi
fi
;;
esac
case ${entropy_file} in
[Nn][Oo] | '')
;;
*)
if [ -w /dev/random ]; then
feed_dev_random "${entropy_file}"
fi
;;
esac
}
random_stop()
{
# Write some entropy so when the machine reebots /dev/random
# can be reseeded
#
case ${entropy_file} in
[Nn][Oo] | '')
;;
*)
echo -n 'Writing entropy file:'
rm -f ${entropy_file}
oumask=`umask`
umask 077
if touch ${entropy_file} ; then
entropy_file_confirmed="${entropy_file}"
else
# Try this as a reasonable alternative for read-only
# roots, diskless workstations, etc.
rm -f /var/db/entropy
if touch /var/db/entropy ; then
entropy_file_confirmed=/var/db/entropy
fi
fi
case ${entropy_file_confirmed} in
'')
err 1 '${entropy_file_confirmed}:' \
' entropy file write failed.'
;;
*)
dd if=/dev/random of=${entropy_file_confirmed} \
bs=4096 count=1 2> /dev/null
echo '.'
;;
esac
umask ${oumask}
;;
esac
}
load_rc_config $name
run_rc_command "$1"

View File

@ -1,15 +1,18 @@
#!/bin/sh
#
# $NetBSD: rarpd,v 1.3 2000/05/13 08:45:09 lukem Exp $
# $NetBSD: rarpd,v 1.5 2002/03/22 04:33:59 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: rarpd
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="rarpd"
rcvar=$name
rcvar=`set_rcvar`
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
required_files="/etc/ethers"

View File

@ -1,10 +1,12 @@
#!/bin/sh
#
# $NetBSD: rbootd,v 1.4 2000/05/13 08:45:09 lukem Exp $
# $NetBSD: rbootd,v 1.6 2002/03/22 04:34:00 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: rbootd
# REQUIRE: DAEMON
# BEFORE: LOGIN
. /etc/rc.subr

View File

@ -1,10 +1,12 @@
#!/bin/sh
#
# $NetBSD: root,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $
# $NetBSD: root,v 1.2 2000/05/13 08:45:09 lukem Exp $
# $FreeBSD$
#
# PROVIDE: root
# REQUIRE: fsck
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
@ -14,9 +16,35 @@ stop_cmd=":"
root_start()
{
umount -a >/dev/null 2>&1
mount /
rm -f /fastboot
case `${CMD_OSTYPE}` in
FreeBSD)
# root normally must be read/write, but if this is a BOOTP NFS
# diskless boot it does not have to be.
#
case ${root_rw_mount} in
[Nn][Oo] | '')
;;
*)
if ! mount -u -o rw / ; then
echo 'Mounting root filesystem rw failed, startup aborted'
exit 1
fi
;;
esac
umount -a >/dev/null 2>&1
mount /
# If we booted a special kernel remove the record
# so we will boot the default kernel next time.
[ -e /boot/nextkernel ] && rm -f /boot/nextkernel
;;
NetBSD)
umount -a >/dev/null 2>&1
mount /
rm -f /fastboot
;;
esac
}
load_rc_config $name

View File

@ -1,16 +1,36 @@
#!/bin/sh
#
# $NetBSD: route6d,v 1.3 2000/05/13 08:45:09 lukem Exp $
# $NetBSD: route6d,v 1.5 2002/03/22 04:34:00 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: route6d
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="route6d"
rcvar=$name
command="/usr/sbin/${name}"
# XXX - Executable may be in a different location. The $name variable
# is different from the variable in rc.conf(5) so the
# subroutines in rc.subr won't catch it. In this case, it
# is also needed by the eval statement in the FreeBSD conditional.
#
load_rc_config $name
case `${CMD_OSTYPE}` in
FreeBSD)
rcvar="ipv6_router_enable"
command="${ipv6_router:-/usr/sbin/${name}}"
required_vars="ipv6_gateway_enable"
eval ${name}_flags=\"${ipv6_router_flags}\"
;;
NetBSD)
rcvar=$name
command="/usr/sbin/${name}"
;;
esac
run_rc_command "$1"

View File

@ -1,17 +1,37 @@
#!/bin/sh
#
# $NetBSD: routed,v 1.4 2000/05/13 08:45:09 lukem Exp $
# $NetBSD: routed,v 1.7 2002/03/22 04:34:00 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: routed
# REQUIRE: DAEMON gated
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="routed"
rcvar=$name
command="/sbin/${name}"
start_precmd="routed_precmd"
# XXX - Executable may be in a different location. The $name variable
# is different from the variable in rc.conf(5) so the
# subroutines in rc.subr won't catch it.
#
load_rc_config $name
case `${CMD_OSTYPE}` in
FreeBSD)
rcvar="router_enable"
command="${router:-/sbin/${name}}"
eval ${name}_flags=${router_flags}
start_precmd=
;;
NetBSD)
rcvar=${name}
command="/sbin/${name}"
start_precmd="routed_precmd"
;;
esac
routed_precmd()
{
@ -21,5 +41,4 @@ routed_precmd()
fi
}
load_rc_config $name
run_rc_command "$1"

View File

@ -1,17 +1,36 @@
#!/bin/sh
#
# $NetBSD: rpcbind,v 1.4 2000/07/26 00:11:49 lukem Exp $
# $NetBSD: rpcbind,v 1.6 2002/01/31 01:26:06 lukem Exp $
# $FreeBSD$
#
# PROVIDE: rpcbind
# REQUIRE: NETWORK ntpdate syslogd named ppp
# REQUIRE: NETWORKING ntpdate syslogd named ppp
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="rpcbind"
rcvar=$name
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
# XXX - Executable may be in a different location. The $name variable
# is different from the variable in rc.conf(5) so the
# subroutines in rc.subr won't catch it.
#
load_rc_config $name
command="${portmap_program:-/usr/sbin/${name}}"
case `${CMD_OSTYPE}` in
FreeBSD)
pidfile=
rcvar="portmap_enable"
command="${portmap_program:-/usr/sbin/${name}}"
eval ${name}_flags=\"${portmap_flags}\"
;;
NetBSD)
rcvar=$name
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
;;
esac
run_rc_command "$1"

View File

@ -1,25 +1,81 @@
#!/bin/sh
#
# $NetBSD: rtadvd,v 1.3 2000/05/13 08:45:09 lukem Exp $
# $NetBSD: rtadvd,v 1.5 2002/03/22 04:34:00 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: rtadvd
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="rtadvd"
rcvar=$name
rcvar=`set_rcvar`
command="/usr/sbin/${name}"
start_precmd="rtadvd_precmd"
case `${CMD_OSTYPE}` in
FreeBSD)
IS_GATEWAY="checkyesno ipv6_gateway_enable"
;;
NetBSD)
IS_GATEWAY="eval [ \"$ip6mode\" = \"router\" ]"
;;
esac
rtadvd_precmd()
{
if [ "$ip6mode" != "router" ]; then
if ! ${IS_GATEWAY} ; then
warn \
"${name} cannot be used on IPv6 host, only on an IPv6 router."
"${name} cannot be used on IPv6 host, only on an IPv6 router."
return 1
fi
# This should be enabled with a great care.
# You may want to fine-tune /etc/rtadvd.conf.
#
# And if you wish your rtadvd to receive and process
# router renumbering messages, specify your Router Renumbering
# security policy by -R option.
#
# See `man 3 ipsec_set_policy` for IPsec policy specification
# details.
# (CAUTION: This enables your routers prefix renumbering
# from another machine, so if you enable this, do it with
# enough care.)
#
case `${CMD_OSTYPE}` in
FreeBSD)
# If specific interfaces haven't been specified,
# get a list of interfaces and enable it on them
#
case ${rtadvd_interfaces} in
'')
for i in `ifconfig -l` ; do
case $i in
lo0|gif[0-9]*|stf[0-9]*|faith[0-9]*|lp[0-9]*|sl[0-9]*|tun[0-9]*)
continue
;;
*)
rtadvd_interfaces="${rtadvd_interfaces} ${i}"
;;
esac
done
;;
esac
command_args="${rtadvd_interfaces}"
# Enable Router Renumbering, unicast case
# (use correct src/dst addr)
# rtadvd -R "in ipsec ah/transport/fec0:0:0:1::1-fec0:0:0:10::1/require" ${ipv6_network_interfaces}
# Enable Router Renumbering, multicast case
# (use correct src addr)
# rtadvd -R "in ipsec ah/transport/ff05::2-fec0:0:0:10::1/require" ${ipv6_network_interfaces}
;;
esac
return 0
}
load_rc_config $name

View File

@ -1,10 +1,12 @@
#!/bin/sh
#
# $NetBSD: rtsold,v 1.3 2000/05/13 08:45:09 lukem Exp $
# $NetBSD: rtsold,v 1.5 2002/03/22 04:34:00 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: rtsold
# REQUIRE: DAEMON
# BEFORE: LOGIN
. /etc/rc.subr

View File

@ -1,15 +1,18 @@
#!/bin/sh
#
# $NetBSD: rwho,v 1.3 2000/05/13 08:45:09 lukem Exp $
# $NetBSD: rwho,v 1.5 2002/03/22 04:34:00 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: rwho
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="rwhod"
rcvar=$name
rcvar="`set_rcvar`"
command="/usr/sbin/${name}"
load_rc_config $name

View File

@ -1,29 +1,73 @@
#!/bin/sh
#
# $NetBSD: savecore,v 1.2 2000/05/13 08:45:09 lukem Exp $
# $NetBSD: savecore,v 1.5 2002/03/22 04:34:00 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: savecore
# REQUIRE: syslogd
# BEFORE: SERVERS
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="savecore"
rcvar=$name
start_cmd="savecore_start"
start_precmd="savecore_prestart"
stop_cmd=":"
case `${CMD_OSTYPE}` in
NetBSD)
rcvar=$name
;;
esac
savecore_prestart()
{
# ${DUMPDIR} should be a directory or a symbolic link
# to the crash directory if core dumps are to be saved.
#
DUMPDIR="${dumpdir:-/var/crash}"
case `${CMD_OSTYPE}` in
FreeBSD)
# Quit if we have no dump device
case ${dumpdev} in
[Nn][Oo] | '')
debug 'No dump device. Quitting.'
return 1
;;
esac
# If there is no crash directory set it now
case ${dumpdir} in
'')
dumpdir='/var/crash'
;;
[Nn][Oo])
dumpdir='NO'
;;
esac
if [ ! -e "${dumpdev}" -o ! -d "${dumpdir}" ]; then
warn "Wrong dump device or directory. Savecore not run."
return 1
fi
;;
NetBSD)
if [ ! -d "${dumpdir}" ]; then
warn "No /var/crash directory; savecore not run."
return 1
fi
;;
esac
return 0
}
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
savecore ${savecore_flags} ${DUMPDIR}
}
load_rc_config $name

View File

@ -1,10 +1,12 @@
#!/bin/sh
#
# $NetBSD: screenblank,v 1.3 2000/05/13 08:45:09 lukem Exp $
# $NetBSD: screenblank,v 1.5 2002/03/22 04:34:00 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: screenblank
# REQUIRE: DAEMON
# BEFORE: LOGIN
. /etc/rc.subr

View File

@ -1,10 +1,13 @@
#!/bin/sh
#
# $NetBSD: securelevel,v 1.1 2000/08/21 23:31:24 lukem Exp $
# $NetBSD: securelevel,v 1.4 2002/03/22 04:34:00 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: securelevel
# REQUIRE: aftermountlkm ipnat mountd
# BEFORE: DAEMON
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
@ -14,19 +17,39 @@ 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 kern.securelevel=$securelevel
else
securelevel=`sysctl -n kern.securelevel`
if [ x"$securelevel" = x0 ]; then
echo -n "Setting securelevel: "
sysctl kern.securelevel=1
case `${CMD_OSTYPE}` in
FreeBSD)
case ${kern_securelevel_enable} in
[Yy][Ee][Ss])
if [ ${kern_securelevel} -ge 0 ]; then
echo 'Raising kernel security level: '
${SYSCTL_W} kern.securelevel=${kern_securelevel}
fi
;;
esac
;;
NetBSD)
# if $securelevel is set higher, change it here, else if
# it is 0, change it to 1 here, before we start daemons
# or login services.
#
osecurelevel=`sysctl -n kern.securelevel`
if [ -n "$securelevel" -a "$securelevel" != "$osecurelevel" ]; then
if [ "$securelevel" -lt "$osecurelevel" ]; then
echo "Can't lower securelevel."
exit 1
else
echo -n "Setting securelevel: "
${SYSCTL_W} kern.securelevel=$securelevel
fi
else
if [ "$osecurelevel" = 0 ]; then
echo -n "Setting securelevel: "
${SYSCTL_W} kern.securelevel=1
fi
fi
fi
;;
esac
}
load_rc_config $name

View File

@ -1,19 +1,22 @@
#!/bin/sh
#
# $NetBSD: sendmail,v 1.12 2000/10/09 06:11:38 nisimura Exp $
# $NetBSD: sendmail,v 1.14 2002/02/12 01:26:36 lukem Exp $
# $FreeBSD$
#
# PROVIDE: mail
# REQUIRE: LOGIN
# KEYWORD: FreeBSD NetBSD
# we make mail start late, so that things like .forward's are not
# processed until the system is fully operational
# 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
# XXX - Get together with sendmail mantainer to figure out how to
# better handle SENDMAIL_ENABLE and 3rd party MTAs.
#
. /etc/rc.subr
name="sendmail"
rcvar=$name
rcvar=`set_rcvar`
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
required_files="/etc/mail/${name}.cf"
@ -24,7 +27,7 @@ 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 checkyesno ${rcvar} && [ -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."
@ -47,8 +50,8 @@ sendmail_precmd()
# check couple of common db files, too
for f in genericstable virtusertable domaintable mailertable; do
if [ -r "/etc/mail/$f" ] && [ "/etc/mail/$f" -nt "/etc/mail/$f.db" ];
then
if [ -r "/etc/mail/$f" -a \
"/etc/mail/$f" -nt "/etc/mail/$f.db" ]; then
echo \
"${name}: /etc/mail/$f newer than /etc/mail/$f.db, regenerating"
/usr/sbin/makemap hash /etc/mail/$f < /etc/mail/$f
@ -58,3 +61,42 @@ sendmail_precmd()
load_rc_config $name
run_rc_command "$1"
case `${CMD_OSTYPE}` in
FreeBSD)
case $SENDMAIL_ENABLE in
NONE)
exit
;;
esac
pid_file=
required_files=
start_precmd=
name="sendmail_outbound"
rcvar=`set_rcvar`
start_cmd="/usr/sbin/sendmail $sendmail_outbound_flags"
#command="/usr/sbin/sendmail"
load_rc_config $name
run_rc_command "$1"
name="sendmail_submit"
rcvar=`set_rcvar`
start_cmd="/usr/sbin/sendmail $sendmail_submit_flags"
#command="/usr/sbin/sendmail"
load_rc_config $name
run_rc_command "$1"
name="sendmail_clientmqueue"
rcvar="sendmail_msp_queue_enable"
start_cmd="/usr/sbin/sendmail $sendmail_msp_queue_flags"
#command="/usr/sbin/sendmail"
#command_args="${sendmail_msp_queue_flags}"
required_files="/etc/mail/submit.cf"
load_rc_config $name
run_rc_command "$1"
;;
esac

36
etc/rc.d/sppp Normal file
View File

@ -0,0 +1,36 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: sppp
# REQUIRE: root
# BEFORE: network1
# KEYWORD: FreeBSD
. /etc/rc.subr
name="sppp"
start_cmd="sppp_start"
stop_cmd=":"
sppp_start()
{
# Special options for sppp(4) interfaces go here. These need
# to go _before_ the general ifconfig since in the case
# of hardwired (no link1 flag) but required authentication, you
# cannot pass auth parameters down to the already running interface.
#
for ifn in ${sppp_interfaces}; do
eval spppcontrol_args=\$spppconfig_${ifn}
if [ -n "${spppcontrol_args}" ]; then
# The auth secrets might contain spaces; in order
# to retain the quotation, we need to eval them
# here.
eval spppcontrol ${ifn} ${spppcontrol_args}
fi
done
}
load_rc_config $name
run_rc_command "$1"

View File

@ -1,48 +1,70 @@
#!/bin/sh
#
# $NetBSD: sshd,v 1.7 2000/08/10 22:49:43 lukem Exp $
# $NetBSD: sshd,v 1.18 2002/04/29 08:23:34 lukem Exp $
# $FreeBSD$
#
# PROVIDE: sshd
# REQUIRE: LOGIN
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="sshd"
rcvar=$name
rcvar=`set_rcvar`
command="/usr/sbin/${name}"
keygen_cmd="sshd_keygen"
start_precmd="sshd_precmd"
pidfile="/var/run/${name}.pid"
required_files="/etc/${name}.conf"
required_files="/etc/ssh/sshd_config"
extra_commands="keygen reload"
sshd_keygen()
{
if [ -f /etc/ssh_host_key ]; then
echo "You already have an RSA host key in /etc/ssh_host_key"
echo "Skipping RSA Key Generation"
(
umask 022
# Can't do anything if ssh is not installed
[ -x /usr/bin/ssh-keygen ] || {
warn "/usr/bin/ssh-keygen does not exist."
return 1
}
if [ -f /etc/ssh/ssh_host_key ]; then
echo "You already have an RSA host key" \
"in /etc/ssh/ssh_host_key"
echo "Skipping protocol version 1 RSA Key Generation"
else
umask 022
/usr/bin/ssh-keygen -b 1024 -f /etc/ssh_host_key -N ''
/usr/bin/ssh-keygen -t rsa1 -b 1024 \
-f /etc/ssh/ssh_host_key -N ''
fi
if [ -f /etc/ssh_host_dsa_key ]; then
echo "You already have a DSA host key in /etc/ssh_host_dsa_key"
echo "Skipping DSA Key Generation"
if [ -f /etc/ssh/ssh_host_dsa_key ]; then
echo "You already have a DSA host key" \
"in /etc/ssh/ssh_host_dsa_key"
echo "Skipping protocol version 2 DSA Key Generation"
else
umask 022
/usr/bin/ssh-keygen -d -f /etc/ssh_host_dsa_key -N ''
/usr/bin/ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
fi
if [ -f /etc/ssh/ssh_host_rsa_key ]; then
echo "You already have a RSA host key" \
"in /etc/ssh/ssh_host_rsa_key"
echo "Skipping protocol version 2 RSA Key Generation"
else
/usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
fi
)
}
sshd_precmd()
{
if [ ! -f /etc/ssh_host_key -o ! -f /etc/ssh_host_dsa_key ]; then
/etc/rc.d/sshd keygen
if [ ! -f /etc/ssh/ssh_host_key -o \
! -f /etc/ssh/ssh_host_dsa_key -o \
! -f /etc/ssh/ssh_host_rsa_key ]; then
run_rc_command keygen
fi
}
keygen_cmd=sshd_keygen
start_precmd=sshd_precmd
load_rc_config $name
run_rc_command "$1"

View File

@ -1,27 +1,46 @@
#!/bin/sh
#
# $NetBSD: nfslocking,v 1.3 2000/05/13 08:45:07 lukem Exp $
# $NetBSD: nfslocking,v 1.6 2002/03/24 15:52:41 lukem Exp $
# $FreeBSD$
#
# PROVIDE: nfslocking
# REQUIRE: nfsd
# REQUIRE: nfsserver nfsclient nfsd
# BEFORE: DAEMON
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
arg=$1
start_precmd='checkyesno nfs_server || checkyesno nfs_client'
case `${CMD_OSTYPE}` in
FreeBSD)
RCVAR_SERVER="nfs_server_enable"
RCVAR_CLIENT="nfs_client_enable"
RCVAR_STATD="rpc_statd_enable"
RCVAR_LOCKD="rpc_lockd_enable"
;;
NetBSD)
RCVAR_SERVER="nfs_server"
RCVAR_CLIENT="nfs_client"
RCVAR_STATD="statd"
RCVAR_LOCKD="lockd"
;;
esac
start_precmd="checkyesno ${RCVAR_SERVER} || checkyesno ${RCVAR_CLIENT}
[ -n "$rc_force" ]"
stop_precmd=$start_precmd
status_precmd=$start_precmd
name="statd"
rcvar=$name
rcvar=${RCVAR_STATD}
command="/usr/sbin/rpc.${name}"
load_rc_config $name
run_rc_command "$arg"
name="lockd"
rcvar=$name
rcvar=${RCVAR_LOCKD}
command="/usr/sbin/rpc.${name}"
load_rc_config $name
run_rc_command "$arg"

View File

@ -1,23 +1,50 @@
#!/bin/sh
#
# $NetBSD: swap1,v 1.4 2000/05/13 08:45:09 lukem Exp $
# $NetBSD: swap1,v 1.8 2002/03/24 15:52:41 lukem Exp $
# $FreeBSD$
#
# PROVIDE: localswap
# REQUIRE: disks
# KEYWORD: FreeBSD NetBSD shutdown
. /etc/rc.subr
name="swap1"
case `${CMD_OSTYPE}` in
FreeBSD)
start_cmd='swapon -a'
stop_cmd=':'
;;
NetBSD)
# Add all block-type swap devices; these might be necessary
# during disk checks.
#
start_cmd="swap1_start"
stop_cmd="swap1_stop"
;;
esac
# Add all block-type swap devices; these might be necessary
# during disk checks.
#
start_cmd='swapctl -A -t blk'
swap1_start()
{
if ! checkyesno no_swap; then
swapctl -A -t blk
fi
}
# Remove all block-type swap devices
#
stop_cmd="swapctl -U -t blk"
swap1_stop()
{
if checkyesno swapoff || [ -n "$rc_force" ]; then
echo "Removing block-type swap devices"
swapctl -U -t blk
fi
}
load_rc_config swap
run_rc_command "$1"

View File

@ -1,10 +1,12 @@
#!/bin/sh
#
# $NetBSD: swap2,v 1.4 2000/07/17 12:27:04 lukem Exp $
# $NetBSD: swap2,v 1.6 2002/03/22 04:34:00 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: nonlocalswap
# REQUIRE: mountcritremote
# BEFORE: DAEMON
. /etc/rc.subr

View File

@ -1,10 +1,12 @@
#!/bin/sh
#
# $NetBSD: sysdb,v 1.6 2000/10/09 05:02:14 nisimura Exp $
# $NetBSD: sysdb,v 1.9 2002/03/22 04:34:00 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: sysdb
# REQUIRE: mountcritremote
# BEFORE: DAEMON
. /etc/rc.subr
@ -20,7 +22,7 @@ sysdb_start()
#
echo "Building databases..."
booted_kernel=`sysctl -n machdep.booted_kernel 2>/dev/null`
kvm_mkdb ${booted_kernel:-/netbsd}
kvm_mkdb "${booted_kernel:-/netbsd}"
dev_mkdb
# Re-create /var/run/utmp, which is deleted by mountcritlocal

View File

@ -1,21 +1,38 @@
#!/bin/sh
#
# $NetBSD: syslogd,v 1.6 2000/07/29 21:50:20 veego Exp $
# $NetBSD: syslogd,v 1.12 2002/03/22 04:34:00 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: syslogd
# REQUIRE: mountcritremote sysdb wscons
# BEFORE: SERVERS
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="syslogd"
rcvar=$name
rcvar=`set_rcvar`
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
required_files="/etc/syslog.conf"
start_precmd="syslogd_precmd"
extra_commands="reload"
_sockfile="/var/run/syslogd.sockets"
case `${CMD_OSTYPE}` in
FreeBSD)
pidfile="/var/run/syslog.pid"
evalargs="rc_flags=\"\`set_socketlist\` \$rc_flags\""
altlog_proglist="named"
;;
NetBSD)
pidfile="/var/run/${name}.pid"
evalargs="rc_flags=\"-P \$_sockfile \$rc_flags\""
altlog_proglist="named ntpd"
;;
esac
syslogd_precmd()
{
# Transitional symlink for old binaries
@ -24,8 +41,40 @@ syslogd_precmd()
ln -sf /var/run/log /dev/log
fi
rm -f /var/run/log
# Create default list of syslog sockets to watch
#
( umask 022 ; > $_sockfile )
# If running named(8) or ntpd(8) chrooted, added appropriate
# syslog socket to list of sockets to watch.
#
for _l in $altlog_proglist; do
eval _ldir=\$${_l}_chrootdir
if checkyesno `set_rcvar $_l` && [ -n "$_ldir" ]; then
echo "${_ldir}/var/run/log" >> $_sockfile
fi
done
# If other sockets have been provided, change run_rc_command()'s
# internal copy of $syslogd_flags to force use of specific
# syslogd sockets.
#
if [ -s $_sockfile ]; then
echo "/var/run/log" >> $_sockfile
eval $evalargs
fi
return 0
}
set_socketlist()
{
_socketargs=
for _s in `cat $_sockfile | tr '\n' ' '` ; do
_socketargs="-l $_s $_socketargs"
done
echo $_socketargs
}
load_rc_config $name
run_rc_command "$1"

View File

@ -1,15 +1,18 @@
#!/bin/sh
#
# $NetBSD: timed,v 1.3 2000/05/13 08:45:09 lukem Exp $
# $NetBSD: timed,v 1.5 2002/03/22 04:34:00 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: timed
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="timed"
rcvar=$name
rcvar=`set_rcvar`
command="/usr/sbin/${name}"
load_rc_config $name

Some files were not shown because too many files have changed in this diff Show More