summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xetc/rc.d/DAEMON8
-rwxr-xr-xetc/rc.d/LOGIN8
-rwxr-xr-xetc/rc.d/Makefile26
-rwxr-xr-xetc/rc.d/NETWORK10
-rw-r--r--etc/rc.d/NETWORKING12
-rwxr-xr-xetc/rc.d/SERVERS6
-rw-r--r--etc/rc.d/abi54
-rwxr-xr-xetc/rc.d/accounting36
-rw-r--r--etc/rc.d/addswap34
-rw-r--r--etc/rc.d/adjkerntz18
-rw-r--r--etc/rc.d/altqd22
-rwxr-xr-xetc/rc.d/amd65
-rwxr-xr-xetc/rc.d/apmd4
-rw-r--r--etc/rc.d/bgfsck19
-rwxr-xr-xetc/rc.d/bootconf.sh27
-rwxr-xr-xetc/rc.d/bootparams4
-rwxr-xr-xetc/rc.d/ccd4
-rw-r--r--etc/rc.d/cleanvar48
-rwxr-xr-xetc/rc.d/cleartmp20
-rwxr-xr-xetc/rc.d/cron7
-rw-r--r--etc/rc.d/devdb17
-rw-r--r--etc/rc.d/devfs19
-rwxr-xr-xetc/rc.d/dhclient4
-rwxr-xr-xetc/rc.d/dhcpd4
-rwxr-xr-xetc/rc.d/dhcrelay4
-rwxr-xr-xetc/rc.d/dmesg12
-rw-r--r--etc/rc.d/dumpon32
-rwxr-xr-xetc/rc.d/fsck43
-rwxr-xr-xetc/rc.d/inetd7
-rw-r--r--etc/rc.d/initrandom73
-rw-r--r--etc/rc.d/ip6fw58
-rwxr-xr-xetc/rc.d/ipfilter116
-rw-r--r--etc/rc.d/ipfw70
-rwxr-xr-xetc/rc.d/ipmon28
-rwxr-xr-xetc/rc.d/ipnat80
-rwxr-xr-xetc/rc.d/ipsec17
-rw-r--r--etc/rc.d/ipxrouted19
-rw-r--r--etc/rc.d/kadmind32
-rwxr-xr-xetc/rc.d/kdc6
-rw-r--r--etc/rc.d/kerberos27
-rw-r--r--etc/rc.d/keyserv22
-rwxr-xr-xetc/rc.d/ldconfig54
-rwxr-xr-xetc/rc.d/lkm13
-rwxr-xr-xetc/rc.d/lkm23
-rwxr-xr-xetc/rc.d/lkm34
-rwxr-xr-xetc/rc.d/local8
-rw-r--r--etc/rc.d/localdaemons89
-rw-r--r--etc/rc.d/lockd29
-rw-r--r--etc/rc.d/lomac19
-rwxr-xr-xetc/rc.d/lpd16
-rwxr-xr-xetc/rc.d/mopd4
-rwxr-xr-xetc/rc.d/motd36
-rwxr-xr-xetc/rc.d/mountall3
-rwxr-xr-xetc/rc.d/mountcritlocal60
-rwxr-xr-xetc/rc.d/mountcritremote82
-rwxr-xr-xetc/rc.d/mountd45
-rw-r--r--etc/rc.d/moused47
-rw-r--r--etc/rc.d/mroute6d18
-rwxr-xr-xetc/rc.d/mrouted7
-rw-r--r--etc/rc.d/msgs14
-rwxr-xr-xetc/rc.d/named111
-rwxr-xr-xetc/rc.d/newsyslog9
-rw-r--r--etc/rc.d/nfsclient57
-rwxr-xr-xetc/rc.d/nfsd35
-rwxr-xr-xetc/rc.d/nfslocking29
-rw-r--r--etc/rc.d/nfsserver30
-rwxr-xr-xetc/rc.d/ntpd48
-rwxr-xr-xetc/rc.d/ntpdate28
-rw-r--r--etc/rc.d/othermta16
-rw-r--r--etc/rc.d/poffd3
-rwxr-xr-xetc/rc.d/postfix34
-rw-r--r--etc/rc.d/ppp48
-rw-r--r--etc/rc.d/ppp-user48
-rw-r--r--etc/rc.d/pppoed31
-rwxr-xr-xetc/rc.d/pwcheck5
-rwxr-xr-xetc/rc.d/quota23
-rwxr-xr-xetc/rc.d/racoon6
-rwxr-xr-xetc/rc.d/raidframe22
-rw-r--r--etc/rc.d/random93
-rwxr-xr-xetc/rc.d/rarpd7
-rwxr-xr-xetc/rc.d/rbootd4
-rwxr-xr-xetc/rc.d/root36
-rwxr-xr-xetc/rc.d/route6d26
-rwxr-xr-xetc/rc.d/routed31
-rwxr-xr-xetc/rc.d/rpcbind29
-rwxr-xr-xetc/rc.d/rtadvd64
-rwxr-xr-xetc/rc.d/rtsold4
-rwxr-xr-xetc/rc.d/rwho7
-rwxr-xr-xetc/rc.d/savecore62
-rwxr-xr-xetc/rc.d/screenblank4
-rwxr-xr-xetc/rc.d/securelevel49
-rwxr-xr-xetc/rc.d/sendmail60
-rw-r--r--etc/rc.d/sppp36
-rwxr-xr-xetc/rc.d/sshd58
-rw-r--r--etc/rc.d/statd29
-rwxr-xr-xetc/rc.d/swap133
-rwxr-xr-xetc/rc.d/swap24
-rwxr-xr-xetc/rc.d/sysdb6
-rwxr-xr-xetc/rc.d/syslogd55
-rwxr-xr-xetc/rc.d/timed7
-rwxr-xr-xetc/rc.d/ttys40
-rw-r--r--etc/rc.d/usbd18
-rw-r--r--etc/rc.d/vinum17
-rwxr-xr-xetc/rc.d/virecover58
-rwxr-xr-xetc/rc.d/wscons39
-rwxr-xr-xetc/rc.d/xfs4
-rwxr-xr-xetc/rc.d/ypbind16
-rwxr-xr-xetc/rc.d/yppasswdd21
-rwxr-xr-xetc/rc.d/ypserv18
-rw-r--r--etc/rc.d/ypset29
-rw-r--r--etc/rc.d/ypupdated28
-rw-r--r--etc/rc.d/ypxfrd29
112 files changed, 2913 insertions, 354 deletions
diff --git a/etc/rc.d/DAEMON b/etc/rc.d/DAEMON
index 5619e56..0dce994 100755
--- a/etc/rc.d/DAEMON
+++ b/etc/rc.d/DAEMON
@@ -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.
diff --git a/etc/rc.d/LOGIN b/etc/rc.d/LOGIN
index 39fc88b..f4501b1 100755
--- a/etc/rc.d/LOGIN
+++ b/etc/rc.d/LOGIN
@@ -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
diff --git a/etc/rc.d/Makefile b/etc/rc.d/Makefile
index 9c26553..13573a0 100755
--- a/etc/rc.d/Makefile
+++ b/etc/rc.d/Makefile
@@ -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}
diff --git a/etc/rc.d/NETWORK b/etc/rc.d/NETWORK
deleted file mode 100755
index 92040d2..0000000
--- a/etc/rc.d/NETWORK
+++ /dev/null
@@ -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.
diff --git a/etc/rc.d/NETWORKING b/etc/rc.d/NETWORKING
new file mode 100644
index 0000000..ca23df3
--- /dev/null
+++ b/etc/rc.d/NETWORKING
@@ -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.
diff --git a/etc/rc.d/SERVERS b/etc/rc.d/SERVERS
index 99a9c17..e3496cc 100755
--- a/etc/rc.d/SERVERS
+++ b/etc/rc.d/SERVERS
@@ -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.
diff --git a/etc/rc.d/abi b/etc/rc.d/abi
new file mode 100644
index 0000000..c17b9cb
--- /dev/null
+++ b/etc/rc.d/abi
@@ -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 '.'
diff --git a/etc/rc.d/accounting b/etc/rc.d/accounting
index aecb2ad..af443dc 100755
--- a/etc/rc.d/accounting
+++ b/etc/rc.d/accounting
@@ -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
diff --git a/etc/rc.d/addswap b/etc/rc.d/addswap
new file mode 100644
index 0000000..12233d7
--- /dev/null
+++ b/etc/rc.d/addswap
@@ -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"
diff --git a/etc/rc.d/adjkerntz b/etc/rc.d/adjkerntz
new file mode 100644
index 0000000..654c157
--- /dev/null
+++ b/etc/rc.d/adjkerntz
@@ -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"
diff --git a/etc/rc.d/altqd b/etc/rc.d/altqd
new file mode 100644
index 0000000..c7e626e
--- /dev/null
+++ b/etc/rc.d/altqd
@@ -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"
diff --git a/etc/rc.d/amd b/etc/rc.d/amd
index a674a24..20339c3 100755
--- a/etc/rc.d/amd
+++ b/etc/rc.d/amd
@@ -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}"
-load_rc_config $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
-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"
+ 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
run_rc_command "$1"
diff --git a/etc/rc.d/apmd b/etc/rc.d/apmd
index 01f26d1..13f9268 100755
--- a/etc/rc.d/apmd
+++ b/etc/rc.d/apmd
@@ -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
diff --git a/etc/rc.d/bgfsck b/etc/rc.d/bgfsck
new file mode 100644
index 0000000..ae081f0
--- /dev/null
+++ b/etc/rc.d/bgfsck
@@ -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"
diff --git a/etc/rc.d/bootconf.sh b/etc/rc.d/bootconf.sh
index 8f663ca..1fdc201 100755
--- a/etc/rc.d/bootconf.sh
+++ b/etc/rc.d/bootconf.sh
@@ -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
diff --git a/etc/rc.d/bootparams b/etc/rc.d/bootparams
index 2f27d4f..3afbd76 100755
--- a/etc/rc.d/bootparams
+++ b/etc/rc.d/bootparams
@@ -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
diff --git a/etc/rc.d/ccd b/etc/rc.d/ccd
index 57c6406..d967888 100755
--- a/etc/rc.d/ccd
+++ b/etc/rc.d/ccd
@@ -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
diff --git a/etc/rc.d/cleanvar b/etc/rc.d/cleanvar
new file mode 100644
index 0000000..5e7331a
--- /dev/null
+++ b/etc/rc.d/cleanvar
@@ -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/*
+
diff --git a/etc/rc.d/cleartmp b/etc/rc.d/cleartmp
index 943e5ca..27e40ba 100755
--- a/etc/rc.d/cleartmp
+++ b/etc/rc.d/cleartmp
@@ -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
diff --git a/etc/rc.d/cron b/etc/rc.d/cron
index 9363443..6a1e77c 100755
--- a/etc/rc.d/cron
+++ b/etc/rc.d/cron
@@ -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"
diff --git a/etc/rc.d/devdb b/etc/rc.d/devdb
new file mode 100644
index 0000000..8bd040a
--- /dev/null
+++ b/etc/rc.d/devdb
@@ -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
+
diff --git a/etc/rc.d/devfs b/etc/rc.d/devfs
new file mode 100644
index 0000000..90a80c3
--- /dev/null
+++ b/etc/rc.d/devfs
@@ -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
+
diff --git a/etc/rc.d/dhclient b/etc/rc.d/dhclient
index 453062e..cbdc8b0 100755
--- a/etc/rc.d/dhclient
+++ b/etc/rc.d/dhclient
@@ -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.
diff --git a/etc/rc.d/dhcpd b/etc/rc.d/dhcpd
index 1126769..55b1f4a 100755
--- a/etc/rc.d/dhcpd
+++ b/etc/rc.d/dhcpd
@@ -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
diff --git a/etc/rc.d/dhcrelay b/etc/rc.d/dhcrelay
index 4d76dba..d78afa6 100755
--- a/etc/rc.d/dhcrelay
+++ b/etc/rc.d/dhcrelay
@@ -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
diff --git a/etc/rc.d/dmesg b/etc/rc.d/dmesg
index 41ad00f..bea74c2 100755
--- a/etc/rc.d/dmesg
+++ b/etc/rc.d/dmesg
@@ -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
diff --git a/etc/rc.d/dumpon b/etc/rc.d/dumpon
new file mode 100644
index 0000000..c65f63e
--- /dev/null
+++ b/etc/rc.d/dumpon
@@ -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"
diff --git a/etc/rc.d/fsck b/etc/rc.d/fsck
index ddd4302..a57e15c 100755
--- a/etc/rc.d/fsck
+++ b/etc/rc.d/fsck
@@ -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
diff --git a/etc/rc.d/inetd b/etc/rc.d/inetd
index 8f6249f..08b3438 100755
--- a/etc/rc.d/inetd
+++ b/etc/rc.d/inetd
@@ -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"
diff --git a/etc/rc.d/initrandom b/etc/rc.d/initrandom
new file mode 100644
index 0000000..318d83f
--- /dev/null
+++ b/etc/rc.d/initrandom
@@ -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"
diff --git a/etc/rc.d/ip6fw b/etc/rc.d/ip6fw
new file mode 100644
index 0000000..4f37e26
--- /dev/null
+++ b/etc/rc.d/ip6fw
@@ -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"
diff --git a/etc/rc.d/ipfilter b/etc/rc.d/ipfilter
index a2d0c20..2962551 100755
--- a/etc/rc.d/ipfilter
+++ b/etc/rc.d/ipfilter
@@ -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"
diff --git a/etc/rc.d/ipfw b/etc/rc.d/ipfw
new file mode 100644
index 0000000..92c88e9
--- /dev/null
+++ b/etc/rc.d/ipfw
@@ -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"
diff --git a/etc/rc.d/ipmon b/etc/rc.d/ipmon
index 6f635c5..52e8400 100755
--- a/etc/rc.d/ipmon
+++ b/etc/rc.d/ipmon
@@ -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"
diff --git a/etc/rc.d/ipnat b/etc/rc.d/ipnat
index 1ac21c0..6d4dd3a 100755
--- a/etc/rc.d/ipnat
+++ b/etc/rc.d/ipnat
@@ -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_start()
+ipnat_precmd()
{
- if [ ! -f ${config} ]; then
- return 0
+ # 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
- 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}
+ return 0
+}
+
+ipnat_start()
+{
+ 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
diff --git a/etc/rc.d/ipsec b/etc/rc.d/ipsec
index 01313f9..609b6a6 100755
--- a/etc/rc.d/ipsec
+++ b/etc/rc.d/ipsec
@@ -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
diff --git a/etc/rc.d/ipxrouted b/etc/rc.d/ipxrouted
new file mode 100644
index 0000000..28691e3
--- /dev/null
+++ b/etc/rc.d/ipxrouted
@@ -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"
diff --git a/etc/rc.d/kadmind b/etc/rc.d/kadmind
new file mode 100644
index 0000000..a65a1bb
--- /dev/null
+++ b/etc/rc.d/kadmind
@@ -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"
diff --git a/etc/rc.d/kdc b/etc/rc.d/kdc
index 0d887f3..43a5005 100755
--- a/etc/rc.d/kdc
+++ b/etc/rc.d/kdc
@@ -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
diff --git a/etc/rc.d/kerberos b/etc/rc.d/kerberos
new file mode 100644
index 0000000..5dfec95
--- /dev/null
+++ b/etc/rc.d/kerberos
@@ -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"
diff --git a/etc/rc.d/keyserv b/etc/rc.d/keyserv
new file mode 100644
index 0000000..2f46908
--- /dev/null
+++ b/etc/rc.d/keyserv
@@ -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"
diff --git a/etc/rc.d/ldconfig b/etc/rc.d/ldconfig
index 73cbba5..97cd38b 100755
--- a/etc/rc.d/ldconfig
+++ b/etc/rc.d/ldconfig
@@ -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
diff --git a/etc/rc.d/lkm1 b/etc/rc.d/lkm1
index 8e71daf..e252909 100755
--- a/etc/rc.d/lkm1
+++ b/etc/rc.d/lkm1
@@ -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
diff --git a/etc/rc.d/lkm2 b/etc/rc.d/lkm2
index b7b69b9..23608df 100755
--- a/etc/rc.d/lkm2
+++ b/etc/rc.d/lkm2
@@ -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
diff --git a/etc/rc.d/lkm3 b/etc/rc.d/lkm3
index a02e0dc..a9d6efd 100755
--- a/etc/rc.d/lkm3
+++ b/etc/rc.d/lkm3
@@ -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
diff --git a/etc/rc.d/local b/etc/rc.d/local
index 8d6926f..42e96bf 100755
--- a/etc/rc.d/local
+++ b/etc/rc.d/local
@@ -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
diff --git a/etc/rc.d/localdaemons b/etc/rc.d/localdaemons
new file mode 100644
index 0000000..0ddd4ad
--- /dev/null
+++ b/etc/rc.d/localdaemons
@@ -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"
diff --git a/etc/rc.d/lockd b/etc/rc.d/lockd
index bddec82..aa55bc3 100644
--- a/etc/rc.d/lockd
+++ b/etc/rc.d/lockd
@@ -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"
diff --git a/etc/rc.d/lomac b/etc/rc.d/lomac
new file mode 100644
index 0000000..9919ed0
--- /dev/null
+++ b/etc/rc.d/lomac
@@ -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"
diff --git a/etc/rc.d/lpd b/etc/rc.d/lpd
index 83a543a..83b051e 100755
--- a/etc/rc.d/lpd
+++ b/etc/rc.d/lpd
@@ -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"
diff --git a/etc/rc.d/mopd b/etc/rc.d/mopd
index 888c4d6..f6a6710 100755
--- a/etc/rc.d/mopd
+++ b/etc/rc.d/mopd
@@ -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
diff --git a/etc/rc.d/motd b/etc/rc.d/motd
index f000364..f61abc8 100755
--- a/etc/rc.d/motd
+++ b/etc/rc.d/motd
@@ -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
}
diff --git a/etc/rc.d/mountall b/etc/rc.d/mountall
index 2fd80eb..6ce01f7 100755
--- a/etc/rc.d/mountall
+++ b/etc/rc.d/mountall
@@ -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
diff --git a/etc/rc.d/mountcritlocal b/etc/rc.d/mountcritlocal
index 38b75f4..9598f13 100755
--- a/etc/rc.d/mountcritlocal
+++ b/etc/rc.d/mountcritlocal
@@ -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
-
- # 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 -- *)
+ 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
+
+ # 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
diff --git a/etc/rc.d/mountcritremote b/etc/rc.d/mountcritremote
index 6479ea1..919fe6d 100755
--- a/etc/rc.d/mountcritremote
+++ b/etc/rc.d/mountcritremote
@@ -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"
diff --git a/etc/rc.d/mountd b/etc/rc.d/mountd
index d1a64bf..7618aeb 100755
--- a/etc/rc.d/mountd
+++ b/etc/rc.d/mountd
@@ -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
}
diff --git a/etc/rc.d/moused b/etc/rc.d/moused
new file mode 100644
index 0000000..bd42e9f
--- /dev/null
+++ b/etc/rc.d/moused
@@ -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"
diff --git a/etc/rc.d/mroute6d b/etc/rc.d/mroute6d
new file mode 100644
index 0000000..7ae71f0
--- /dev/null
+++ b/etc/rc.d/mroute6d
@@ -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"
diff --git a/etc/rc.d/mrouted b/etc/rc.d/mrouted
index 8239384..b1409e1 100755
--- a/etc/rc.d/mrouted
+++ b/etc/rc.d/mrouted
@@ -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"
diff --git a/etc/rc.d/msgs b/etc/rc.d/msgs
new file mode 100644
index 0000000..64e73cf
--- /dev/null
+++ b/etc/rc.d/msgs
@@ -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
diff --git a/etc/rc.d/named b/etc/rc.d/named
index b311822..853acf7 100755
--- a/etc/rc.d/named
+++ b/etc/rc.d/named
@@ -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"
diff --git a/etc/rc.d/newsyslog b/etc/rc.d/newsyslog
index a842e40..5a3927e 100755
--- a/etc/rc.d/newsyslog
+++ b/etc/rc.d/newsyslog
@@ -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."
}
diff --git a/etc/rc.d/nfsclient b/etc/rc.d/nfsclient
new file mode 100644
index 0000000..9327748
--- /dev/null
+++ b/etc/rc.d/nfsclient
@@ -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"
diff --git a/etc/rc.d/nfsd b/etc/rc.d/nfsd
index a0d3aa1..df96720 100755
--- a/etc/rc.d/nfsd
+++ b/etc/rc.d/nfsd
@@ -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"
diff --git a/etc/rc.d/nfslocking b/etc/rc.d/nfslocking
index bddec82..aa55bc3 100755
--- a/etc/rc.d/nfslocking
+++ b/etc/rc.d/nfslocking
@@ -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"
diff --git a/etc/rc.d/nfsserver b/etc/rc.d/nfsserver
new file mode 100644
index 0000000..f62029e
--- /dev/null
+++ b/etc/rc.d/nfsserver
@@ -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"
diff --git a/etc/rc.d/ntpd b/etc/rc.d/ntpd
index b09c4d1..81671a1 100755
--- a/etc/rc.d/ntpd
+++ b/etc/rc.d/ntpd
@@ -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"
diff --git a/etc/rc.d/ntpdate b/etc/rc.d/ntpdate
index d0a8a18..37b1d07 100755
--- a/etc/rc.d/ntpdate
+++ b/etc/rc.d/ntpdate
@@ -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
}
diff --git a/etc/rc.d/othermta b/etc/rc.d/othermta
new file mode 100644
index 0000000..774546f
--- /dev/null
+++ b/etc/rc.d/othermta
@@ -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}
diff --git a/etc/rc.d/poffd b/etc/rc.d/poffd
index 12422c4..5b5668a 100644
--- a/etc/rc.d/poffd
+++ b/etc/rc.d/poffd
@@ -1,6 +1,7 @@
#!/bin/sh
#
-# $NetBSD$
+# $NetBSD: poffd,v 1.1 2001/01/14 15:37:22 minoura Exp $
+# $FreeBSD$
#
# PROVIDE: poffd
diff --git a/etc/rc.d/postfix b/etc/rc.d/postfix
index b453464..807072b 100755
--- a/etc/rc.d/postfix
+++ b/etc/rc.d/postfix
@@ -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"
diff --git a/etc/rc.d/ppp b/etc/rc.d/ppp
new file mode 100644
index 0000000..67638cb
--- /dev/null
+++ b/etc/rc.d/ppp
@@ -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"
diff --git a/etc/rc.d/ppp-user b/etc/rc.d/ppp-user
new file mode 100644
index 0000000..67638cb
--- /dev/null
+++ b/etc/rc.d/ppp-user
@@ -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"
diff --git a/etc/rc.d/pppoed b/etc/rc.d/pppoed
new file mode 100644
index 0000000..e9376d2
--- /dev/null
+++ b/etc/rc.d/pppoed
@@ -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"
diff --git a/etc/rc.d/pwcheck b/etc/rc.d/pwcheck
index 80949e9..c57e27e 100755
--- a/etc/rc.d/pwcheck
+++ b/etc/rc.d/pwcheck
@@ -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
diff --git a/etc/rc.d/quota b/etc/rc.d/quota
index 8f63255..a225880 100755
--- a/etc/rc.d/quota
+++ b/etc/rc.d/quota
@@ -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
diff --git a/etc/rc.d/racoon b/etc/rc.d/racoon
index ebc0627..aaa264a 100755
--- a/etc/rc.d/racoon
+++ b/etc/rc.d/racoon
@@ -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
diff --git a/etc/rc.d/raidframe b/etc/rc.d/raidframe
index 640ad6f..53156dc 100755
--- a/etc/rc.d/raidframe
+++ b/etc/rc.d/raidframe
@@ -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
) &
}
diff --git a/etc/rc.d/random b/etc/rc.d/random
new file mode 100644
index 0000000..1450b93
--- /dev/null
+++ b/etc/rc.d/random
@@ -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"
diff --git a/etc/rc.d/rarpd b/etc/rc.d/rarpd
index b0e4212..63e0bfc 100755
--- a/etc/rc.d/rarpd
+++ b/etc/rc.d/rarpd
@@ -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"
diff --git a/etc/rc.d/rbootd b/etc/rc.d/rbootd
index ba64fdf..423c5c0 100755
--- a/etc/rc.d/rbootd
+++ b/etc/rc.d/rbootd
@@ -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
diff --git a/etc/rc.d/root b/etc/rc.d/root
index 8a7e3b0..d1c0783 100755
--- a/etc/rc.d/root
+++ b/etc/rc.d/root
@@ -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
diff --git a/etc/rc.d/route6d b/etc/rc.d/route6d
index 0edfcb3..4d94efe 100755
--- a/etc/rc.d/route6d
+++ b/etc/rc.d/route6d
@@ -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"
diff --git a/etc/rc.d/routed b/etc/rc.d/routed
index c9ae523..0d58ee8 100755
--- a/etc/rc.d/routed
+++ b/etc/rc.d/routed
@@ -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"
diff --git a/etc/rc.d/rpcbind b/etc/rc.d/rpcbind
index 1715975..9f6e544 100755
--- a/etc/rc.d/rpcbind
+++ b/etc/rc.d/rpcbind
@@ -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"
diff --git a/etc/rc.d/rtadvd b/etc/rc.d/rtadvd
index 7347035..8317e33 100755
--- a/etc/rc.d/rtadvd
+++ b/etc/rc.d/rtadvd
@@ -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
diff --git a/etc/rc.d/rtsold b/etc/rc.d/rtsold
index 840ab2a..8645816 100755
--- a/etc/rc.d/rtsold
+++ b/etc/rc.d/rtsold
@@ -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
diff --git a/etc/rc.d/rwho b/etc/rc.d/rwho
index e628171..4a01ac1 100755
--- a/etc/rc.d/rwho
+++ b/etc/rc.d/rwho
@@ -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
diff --git a/etc/rc.d/savecore b/etc/rc.d/savecore
index 5b6e115..21a6a4b 100755
--- a/etc/rc.d/savecore
+++ b/etc/rc.d/savecore
@@ -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=":"
-savecore_start()
+case `${CMD_OSTYPE}` in
+NetBSD)
+ rcvar=$name
+ ;;
+esac
+
+savecore_prestart()
{
- # /var/crash should be a directory or a symbolic link
+ # ${DUMPDIR} should be a directory or a symbolic link
# to the crash directory if core dumps are to be saved.
#
- if [ -d /var/crash/. ]; then
+ 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()
+{
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
diff --git a/etc/rc.d/screenblank b/etc/rc.d/screenblank
index 6ac8f5e..de2af4f 100755
--- a/etc/rc.d/screenblank
+++ b/etc/rc.d/screenblank
@@ -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
diff --git a/etc/rc.d/securelevel b/etc/rc.d/securelevel
index c3f3121..dce65e5 100755
--- a/etc/rc.d/securelevel
+++ b/etc/rc.d/securelevel
@@ -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
diff --git a/etc/rc.d/sendmail b/etc/rc.d/sendmail
index 61a0b6f..efa0963 100755
--- a/etc/rc.d/sendmail
+++ b/etc/rc.d/sendmail
@@ -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
diff --git a/etc/rc.d/sppp b/etc/rc.d/sppp
new file mode 100644
index 0000000..0080fc7
--- /dev/null
+++ b/etc/rc.d/sppp
@@ -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"
diff --git a/etc/rc.d/sshd b/etc/rc.d/sshd
index e31a028..416ab7f 100755
--- a/etc/rc.d/sshd
+++ b/etc/rc.d/sshd
@@ -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
+ /usr/bin/ssh-keygen -t rsa1 -b 1024 \
+ -f /etc/ssh/ssh_host_key -N ''
+ fi
+
+ 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 -b 1024 -f /etc/ssh_host_key -N ''
+ /usr/bin/ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_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_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
- umask 022
- /usr/bin/ssh-keygen -d -f /etc/ssh_host_dsa_key -N ''
+ /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"
diff --git a/etc/rc.d/statd b/etc/rc.d/statd
index bddec82..aa55bc3 100644
--- a/etc/rc.d/statd
+++ b/etc/rc.d/statd
@@ -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"
diff --git a/etc/rc.d/swap1 b/etc/rc.d/swap1
index 0582498..9281107 100755
--- a/etc/rc.d/swap1
+++ b/etc/rc.d/swap1
@@ -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"
diff --git a/etc/rc.d/swap2 b/etc/rc.d/swap2
index 288e620..5f3bd6f 100755
--- a/etc/rc.d/swap2
+++ b/etc/rc.d/swap2
@@ -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
diff --git a/etc/rc.d/sysdb b/etc/rc.d/sysdb
index 29b0d3b..7d07235 100755
--- a/etc/rc.d/sysdb
+++ b/etc/rc.d/sysdb
@@ -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
diff --git a/etc/rc.d/syslogd b/etc/rc.d/syslogd
index 2c8caea..07399b8 100755
--- a/etc/rc.d/syslogd
+++ b/etc/rc.d/syslogd
@@ -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"
diff --git a/etc/rc.d/timed b/etc/rc.d/timed
index 097a53c0..1c26e4a 100755
--- a/etc/rc.d/timed
+++ b/etc/rc.d/timed
@@ -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
diff --git a/etc/rc.d/ttys b/etc/rc.d/ttys
index 6e12854..d9073f8 100755
--- a/etc/rc.d/ttys
+++ b/etc/rc.d/ttys
@@ -1,10 +1,12 @@
#!/bin/sh
#
# $NetBSD: ttys,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $
+# $FreeBSD$
#
# PROVIDE: tty
# REQUIRE: root
+# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
@@ -14,18 +16,34 @@ 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
+ case `${CMD_OSTYPE}` in
+ FreeBSD)
- # setup ptys
- #
- # XXX: there may be more ptys than this; maybe use
- # sysctl to find out how many?
- #
- chmod 666 /dev/tty[pqrs]*
+ # Whack the pty perms back into shape.
+ # XXX: there may be more ptys than this; maybe use
+ # sysctl to find out how many?
+ #
+ if ls /dev/tty[pqrsPQRS]* > /dev/null 2>&1; then
+ chflags 0 /dev/tty[pqrsPQRS]*
+ chmod 666 /dev/tty[pqrsPQRS]*
+ chown root:wheel /dev/tty[pqrsPQRS]*
+ fi
+ ;;
+ NetBSD)
+ # 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]*
+ ;;
+ esac
}
load_rc_config $name
diff --git a/etc/rc.d/usbd b/etc/rc.d/usbd
new file mode 100644
index 0000000..bed1a6d
--- /dev/null
+++ b/etc/rc.d/usbd
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: usbd
+# REQUIRE: DAEMON
+# BEFORE: LOGIN
+# KEYWORD: FreeBSD
+
+. /etc/rc.subr
+
+name="usbd"
+rcvar=`set_rcvar`
+command="/usr/sbin/${name}"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/vinum b/etc/rc.d/vinum
new file mode 100644
index 0000000..706e7f0
--- /dev/null
+++ b/etc/rc.d/vinum
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: disks
+# KEYWORD: FreeBSD
+
+. /etc/rc.subr
+
+name="vinum"
+rcvar="start_vinum"
+start_cmd="vinum start"
+stop_cmd=":"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/virecover b/etc/rc.d/virecover
index aad6295..9ecdbf6 100755
--- a/etc/rc.d/virecover
+++ b/etc/rc.d/virecover
@@ -1,27 +1,71 @@
#!/bin/sh
#
-# $NetBSD: virecover,v 1.3 2000/07/26 00:11:49 lukem Exp $
+# $NetBSD: virecover,v 1.6 2002/03/22 04:34:00 thorpej Exp $
+# $FreeBSD$
#
# PROVIDE: virecover
# REQUIRE: mountcritremote
+# BEFORE: DAEMON
+# KEYWORD: FreeBSD NetBSD
#
# XXX: should require `mail'!
. /etc/rc.subr
name="virecover"
-start_cmd="virecover_start"
stop_cmd=":"
+case `${CMD_OSTYPE}` in
+FreeBSD)
+ start_cmd="virecover_start"
+ ;;
+NetBSD)
+ command="/usr/libexec/${name}"
+ ;;
+esac
+
virecover_start()
{
- recover=`find /var/tmp/vi.recover -name 'recover.*' -type f -print`
- if [ -n "$recover" ]; then
- echo "Preserving editor files."
- for i in $recover; do
- sendmail -t < $i
+ find /var/tmp/vi.recover ! -type f -a ! -type d -delete
+ vibackup=`echo /var/tmp/vi.recover/vi.*`
+ if [ "${vibackup}" != '/var/tmp/vi.recover/vi.*' ]; then
+ echo -n 'Recovering vi editor sessions:'
+ for i in /var/tmp/vi.recover/vi.*; do
+ # Only test files that are readable.
+ if [ ! -r "${i}" ]; then
+ continue
+ fi
+
+ # Unmodified nvi editor backup files either have the
+ # execute bit set or are zero length. Delete them.
+ if [ -x "${i}" -o ! -s "${i}" ]; then
+ rm -f "${i}"
+ fi
done
+
+ # It is possible to get incomplete recovery files, if the editor
+ # crashes at the right time.
+ virecovery=`echo /var/tmp/vi.recover/recover.*`
+ if [ "${virecovery}" != "/var/tmp/vi.recover/recover.*" ]; then
+ for i in /var/tmp/vi.recover/recover.*; do
+ # Only test files that are readable.
+ if [ ! -r "${i}" ]; then
+ continue
+ fi
+
+ # Delete any recovery files that are zero length,
+ # corrupted, or that have no corresponding backup file.
+ # Else send mail to the user.
+ recfile=`awk '/^X-vi-recover-path:/{print $2}' < "${i}"`
+ if [ -n "${recfile}" -a -s "${recfile}" ]; then
+ sendmail -t < "${i}"
+ else
+ rm -f "${i}"
+ fi
+ done
+ fi
+ echo '.'
fi
}
diff --git a/etc/rc.d/wscons b/etc/rc.d/wscons
index ecbc48a..9bb6e11 100755
--- a/etc/rc.d/wscons
+++ b/etc/rc.d/wscons
@@ -1,10 +1,12 @@
#!/bin/sh
#
-# $NetBSD: wscons,v 1.5 2000/08/21 23:02:25 lukem Exp $
+# $NetBSD: wscons,v 1.9 2002/04/26 00:06:54 lukem Exp $
+# $FreeBSD$
#
# PROVIDE: wscons
# REQUIRE: mountcritremote
+# BEFORE: LOGIN
. /etc/rc.subr
@@ -17,8 +19,9 @@ wscons_start()
{
wscfg=/usr/sbin/wsconscfg
wsfld=/usr/sbin/wsfontload
+ wsctl=/sbin/wsconsctl
config=/etc/wscons.conf
- usage="usage: wsconfig [-n] [-f configfile] [-font fontpgm] [-screen screenpgm]"
+ usage="Usage: wsconfig [-n] [-f configfile] [-font fontpgm] [-screen screenpgm]"
DOIT=
while [ $# -gt 0 ]; do
@@ -55,6 +58,7 @@ wscons_start()
\#*|"")
continue
;;
+
font)
name=$arg1
width=$arg2
@@ -87,6 +91,7 @@ wscons_start()
cmd="$cmd -N $name $file"
eval $DOIT $cmd
;;
+
screen)
idx=$arg1
scr=$arg2
@@ -110,6 +115,7 @@ wscons_start()
cmd="$cmd $idx"
eval $DOIT $cmd
;;
+
keyboard)
kbd=$arg1
cmd=$wscfg
@@ -123,10 +129,39 @@ wscons_start()
esac
eval $DOIT $cmd
;;
+
+ encoding)
+ map=$arg1
+ cmd="$wsctl -w \"encoding=$map\""
+ eval $DOIT $cmd
+ ;;
+
+ mapfile)
+ mapfile=$arg1
+ ( while read entry; do
+ case "$entry" in
+ \#*|"")
+ continue
+ ;;
+ *)
+ cmd="$wsctl -w \"map+=$entry\""
+ cmd="$cmd >/dev/null"
+ eval $DOIT $cmd
+ ;;
+ esac
+ done ) < $mapfile
+ ;;
+
mux)
cmd="$wscfg -m $arg1"
eval $DOIT $cmd
;;
+
+ setvar)
+ cmd="$wsctl -w $arg1"
+ eval $DOIT $cmd
+ ;;
+
esac
done ) < $config
}
diff --git a/etc/rc.d/xfs b/etc/rc.d/xfs
index f1b4dad..a0692fa 100755
--- a/etc/rc.d/xfs
+++ b/etc/rc.d/xfs
@@ -1,10 +1,12 @@
#!/bin/sh
#
-# $NetBSD: xfs,v 1.4 2000/09/19 13:04:39 lukem Exp $
+# $NetBSD: xfs,v 1.6 2002/03/22 04:34:01 thorpej Exp $
+# $FreeBSD$
#
# PROVIDE: xfs
# REQUIRE: mountall cleartmp
+# BEFORE: LOGIN
. /etc/rc.subr
diff --git a/etc/rc.d/ypbind b/etc/rc.d/ypbind
index 7549087..dfd87ec 100755
--- a/etc/rc.d/ypbind
+++ b/etc/rc.d/ypbind
@@ -1,18 +1,30 @@
#!/bin/sh
#
-# $NetBSD: ypbind,v 1.3 2000/05/13 08:45:10 lukem Exp $
+# $NetBSD: ypbind,v 1.5 2002/03/22 04:34:01 thorpej Exp $
+# $FreeBSD$
#
# PROVIDE: ypbind
# REQUIRE: ypserv
+# BEFORE: DAEMON
+# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="ypbind"
-rcvar=$name
command="/usr/sbin/${name}"
start_precmd="ypbind_precmd"
+case `${CMD_OSTYPE}` in
+FreeBSD)
+ rcvar="nis_client_enable"
+ command_args="${nis_client_flags}"
+ ;;
+NetBSD)
+ rcvar=$name
+ ;;
+esac
+
ypbind_precmd()
{
_domain=`domainname`
diff --git a/etc/rc.d/yppasswdd b/etc/rc.d/yppasswdd
index 4b3ab70..3cb98076 100755
--- a/etc/rc.d/yppasswdd
+++ b/etc/rc.d/yppasswdd
@@ -1,19 +1,32 @@
#!/bin/sh
#
-# $NetBSD: yppasswdd,v 1.4 2000/06/02 22:54:13 fvdl Exp $
+# $NetBSD: yppasswdd,v 1.6 2002/03/22 04:34:01 thorpej Exp $
+# $FreeBSD$
#
# PROVIDE: yppasswdd
# REQUIRE: ypserv ypbind
+# BEFORE: LOGIN
+# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="yppasswdd"
-rcvar=$name
-command="/usr/sbin/rpc.${name}"
-required_vars="rpcbind ypserv"
+command="/usr/sbin/rpc.{name}"
start_precmd="yppasswdd_precmd"
+case `${CMD_OSTYPE}` in
+FreeBSD)
+ rcvar="nis_yppasswdd_enable"
+ required_vars="portmap_enable nis_server_enable"
+ command_args="${nis_yppasswdd_flags}"
+ ;;
+NetBSD)
+ rcvar=$name
+ required_vars="rpcbind ypserv"
+ ;;
+esac
+
yppasswdd_precmd()
{
_domain=`domainname`
diff --git a/etc/rc.d/ypserv b/etc/rc.d/ypserv
index 69fdd20..99c8d9d 100755
--- a/etc/rc.d/ypserv
+++ b/etc/rc.d/ypserv
@@ -1,19 +1,31 @@
#!/bin/sh
#
-# $NetBSD: ypserv,v 1.4 2000/06/02 22:54:13 fvdl Exp $
+# $NetBSD: ypserv,v 1.5 2000/09/19 13:04:39 lukem Exp $
+# $FreeBSD$
#
# PROVIDE: ypserv
# REQUIRE: rpcbind
+# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="ypserv"
-rcvar=$name
command="/usr/sbin/${name}"
-required_vars="rpcbind"
start_precmd="ypserv_precmd"
+case `${CMD_OSTYPE}` in
+FreeBSD)
+ rcvar="nis_server_enable"
+ required_vars="portmap_enable"
+ command_args="${nis_server_flags}"
+ ;;
+NetBSD)
+ rcvar=${name}
+ required_vars="rpcbind"
+ ;;
+esac
+
ypserv_precmd()
{
_domain=`domainname`
diff --git a/etc/rc.d/ypset b/etc/rc.d/ypset
new file mode 100644
index 0000000..175a634
--- /dev/null
+++ b/etc/rc.d/ypset
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: ypset
+# REQUIRE: ypbind
+# KEYWORD: FreeBSD
+
+. /etc/rc.subr
+
+name="ypset"
+rcvar="nis_ypset_enable"
+command="/usr/sbin/${name}"
+command_args="${nis_ypset_flags}"
+required_vars="portmap_enable nis_client_enable"
+start_precmd="ypset_precmd"
+
+ypset_precmd()
+{
+ _domain=`domainname`
+ if [ -z "$_domain" ]; then
+ warn "domainname(1) is not set."
+ return 1
+ fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/ypupdated b/etc/rc.d/ypupdated
new file mode 100644
index 0000000..1b3e2b1
--- /dev/null
+++ b/etc/rc.d/ypupdated
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: ypupdated
+# REQUIRE: rpcbind ypserv
+# KEYWORD: FreeBSD
+
+. /etc/rc.subr
+
+name="ypupdated"
+rcvar="rpc_ypupdated_enable"
+command="/usr/sbin/rpc.${name}"
+required_vars="portmap_enable nis_server_enable"
+start_precmd="rpc_ypupdated_precmd"
+
+rpc_ypupdated_precmd()
+{
+ _domain=`domainname`
+ if [ -z "$_domain" ]; then
+ warn "domainname(1) is not set."
+ return 1
+ fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/ypxfrd b/etc/rc.d/ypxfrd
new file mode 100644
index 0000000..9b32532
--- /dev/null
+++ b/etc/rc.d/ypxfrd
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: ypxfrd
+# REQUIRE: rpcbind
+# KEYWORD: FreeBSD
+
+. /etc/rc.subr
+
+name="ypxfrd"
+rcvar="nis_ypxfrd_enable"
+command="/usr/sbin/rpc.${name}"
+command_args="${nis_ypxfrd_flags}"
+required_vars="portmap_enable nis_server_enable"
+start_precmd="ypxfrd_precmd"
+
+ypxfrd_precmd()
+{
+ _domain=`domainname`
+ if [ -z "$_domain" ]; then
+ warn "domainname(1) is not set."
+ return 1
+ fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
OpenPOWER on IntegriCloud