Luke Mewburn has indicated that they (NetBSD) are not interested

in keeping the scripts under rc.d in sync with us. So, remove
NetBSD specific stuff (which made our scripts more complicated
than necessary).

The NetBSD ident string will be left intact, both for history and
also incase we wish to pull in future versions.
This commit is contained in:
Mike Makonnen 2004-01-17 10:40:45 +00:00
parent 4555065861
commit 9dd342fee6
14 changed files with 133 additions and 342 deletions

View File

@ -14,53 +14,38 @@
name="amd"
rcvar=`set_rcvar`
command="/usr/sbin/${name}"
case ${OSTYPE} in
FreeBSD)
start_precmd="amd_precmd"
command_args="&"
;;
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"
;;
esac
start_precmd="amd_precmd"
command_args="&"
amd_precmd()
{
case ${OSTYPE} in
FreeBSD)
if ! checkyesno nfs_client_enable; then
force_depend nfsclient || return 1
if ! checkyesno nfs_client_enable; then
force_depend nfsclient || return 1
fi
if ! checkyesno rpcbind_enable && \
! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
force_depend rpcbind || return 1
fi
case ${amd_map_program} in
[Nn][Oo] | '')
;;
*)
rc_flags="${rc_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
if ! checkyesno rpcbind_enable && \
! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
force_depend rpcbind || return 1
fi
case ${amd_map_program} in
[Nn][Oo] | '')
;;
*)
rc_flags="${rc_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
;;
*)
rc_flags="-p ${rc_flags} > /var/run/amd.pid 2> /dev/null" \
;;
esac
;;
*)
rc_flags="-p ${rc_flags} > /var/run/amd.pid 2> /dev/null" \
;;
esac
return 0

View File

@ -14,15 +14,7 @@
name="bootparamd"
rcvar=`set_rcvar`
required_files="/etc/bootparams"
case ${OSTYPE} in
FreeBSD)
command="/usr/sbin/${name}"
;;
NetBSD)
command="/usr/sbin/rpc.${name}"
;;
esac
command="/usr/sbin/${name}"
load_rc_config $name
run_rc_command "$1"

View File

@ -32,15 +32,9 @@ cleartmp_start()
load_rc_config $name
run_rc_command "$1"
case ${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
# 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

View File

@ -17,20 +17,12 @@
. /etc/network.subr
name="dhclient"
rcvar=
pidfile="/var/run/${name}.pid"
case "${OSTYPE}" in
FreeBSD)
rcvar=
start_precmd="dhclient_prestart"
start_postcmd="dhclient_poststart"
stop_precmd="dhclient_prestop"
stop_postcmd="dhclient_poststop"
;;
NetBSD)
rcvar=$name
command="/sbin/${name}"
;;
esac
start_precmd="dhclient_prestart"
start_postcmd="dhclient_poststart"
stop_precmd="dhclient_prestop"
stop_postcmd="dhclient_poststop"
dhclient_common()
{

View File

@ -34,18 +34,12 @@ fsck_start()
trap : 3
echo "Starting file system checks:"
case ${OSTYPE} in
FreeBSD)
if checkyesno background_fsck; then
fsck -F -p
else
fsck -p
fi
;;
NetBSD)
if checkyesno background_fsck; then
fsck -F -p
else
fsck -p
;;
esac
fi
;;
case $? in
0)
@ -60,8 +54,6 @@ fsck_start()
stop_boot
;;
8)
case ${OSTYPE} in
FreeBSD)
if checkyesno fsck_y_enable; then
echo "File system preen failed, trying fsck -y."
fsck -y
@ -78,12 +70,6 @@ fsck_start()
stop_boot
fi
;;
NetBSD)
echo "Automatic file system check failed; help!"
stop_boot
;;
esac
;;
12)
echo "Boot interrupted."
stop_boot

View File

@ -14,15 +14,7 @@
name="ipfilter"
rcvar=`set_rcvar`
load_rc_config $name
case ${OSTYPE} in
FreeBSD)
stop_precmd="test -f ${ipfilter_rules} -o -f ${ipv6_ipfilter_rules}"
;;
NetBSD)
stop_precmd="test -f /etc/ipf.conf -o -f /etc/ipf6.conf"
;;
esac
stop_precmd="test -f ${ipfilter_rules} -o -f ${ipv6_ipfilter_rules}"
start_precmd="ipfilter_prestart"
start_cmd="ipfilter_start"
@ -37,8 +29,6 @@ extra_commands="reload resync status"
ipfilter_prestart()
{
case ${OSTYPE} in
FreeBSD)
# load ipfilter kernel module if needed
if ! kldstat -v | grep "IP Filter" > /dev/null 2>&1; then
if kldload ipl; then
@ -54,73 +44,35 @@ FreeBSD)
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."
#
# If booting directly to multiuser, send SIGTERM to
# the parent (/etc/rc) to abort the boot
#
if [ "$autoboot" = yes ]; then
echo "ERROR: ABORTING BOOT (sending SIGTERM to parent)!"
kill -TERM $$
exit 1
fi
return 1
fi
;;
esac
return 0
}
ipfilter_start()
{
echo "Enabling ipfilter."
case ${OSTYPE} in
FreeBSD)
if [ `sysctl -n net.inet.ipf.fr_running` -eq 0 ]; then
${ipfilter_program:-/sbin/ipf} -E
fi
${ipfilter_program:-/sbin/ipf} -Fa
if [ -r "${ipfilter_rules}" ]; then
${ipfilter_program:-/sbin/ipf} \
-f "${ipfilter_rules}" ${ipfilter_flags}
fi
${ipfilter_program:-/sbin/ipf} -6 -Fa
if [ -r "${ipv6_ipfilter_rules}" ]; then
${ipfilter_program:-/sbin/ipf} -6 \
-f "${ipv6_ipfilter_rules}" ${ipfilter_flags}
fi
;;
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
if [ `sysctl -n net.inet.ipf.fr_running` -eq 0 ]; then
${ipfilter_program:-/sbin/ipf} -E
fi
${ipfilter_program:-/sbin/ipf} -Fa
if [ -r "${ipfilter_rules}" ]; then
${ipfilter_program:-/sbin/ipf} \
-f "${ipfilter_rules}" ${ipfilter_flags}
fi
${ipfilter_program:-/sbin/ipf} -6 -Fa
if [ -r "${ipv6_ipfilter_rules}" ]; then
${ipfilter_program:-/sbin/ipf} -6 \
-f "${ipv6_ipfilter_rules}" ${ipfilter_flags}
fi
}
ipfilter_stop()
{
# XXX - The ipf -D command is not effective for 'lkm's
if [ `sysctl -n net.inet.ipf.fr_running` -eq 1 ]; then
case ${OSTYPE} in
FreeBSD)
echo "Saving firewall state tables"
${ipfs_program:-/sbin/ipfs} -W ${ipfs_flags}
echo "Disabling ipfilter."
${ipfilter_program:-/sbin/ipf} -D
;;
NetBSD)
echo "Disabling ipfilter."
/sbin/ipf -D
;;
esac
echo "Saving firewall state tables"
${ipfs_program:-/sbin/ipfs} -W ${ipfs_flags}
echo "Disabling ipfilter."
${ipfilter_program:-/sbin/ipf} -D
fi
}
@ -128,47 +80,26 @@ ipfilter_reload()
{
echo "Reloading ipfilter rules."
case ${OSTYPE} in
FreeBSD)
${ipfilter_program:-/sbin/ipf} -I -Fa
if [ -r "${ipfilter_rules}" ]; then
${ipfilter_program:-/sbin/ipf} -I \
-f "${ipfilter_rules}" ${ipfilter_flags}
fi
${ipfilter_program:-/sbin/ipf} -I -6 -Fa
if [ -r "${ipv6_ipfilter_rules}" ]; then
${ipfilter_program:-/sbin/ipf} -I -6 \
-f "${ipv6_ipfilter_rules}" ${ipfilter_flags}
fi
${ipfilter_program:-/sbin/ipf} -s
;;
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_program:-/sbin/ipf} -I -Fa
if [ -r "${ipfilter_rules}" ]; then
${ipfilter_program:-/sbin/ipf} -I \
-f "${ipfilter_rules}" ${ipfilter_flags}
fi
${ipfilter_program:-/sbin/ipf} -I -6 -Fa
if [ -r "${ipv6_ipfilter_rules}" ]; then
${ipfilter_program:-/sbin/ipf} -I -6 \
-f "${ipv6_ipfilter_rules}" ${ipfilter_flags}
fi
${ipfilter_program:-/sbin/ipf} -s
}
ipfilter_resync()
{
case ${OSTYPE} in
FreeBSD)
# Don't resync if ipfilter is not loaded
if ! kldstat -v | grep "IP Filter" > /dev/null 2>&1; then
return
fi
;;
esac
# Don't resync if ipfilter is not loaded
if ! kldstat -v | grep "IP Filter" > /dev/null 2>&1; then
return
fi
${ipfilter_program:-/sbin/ipf} -y ${ipfilter_flags}
}

View File

@ -15,14 +15,7 @@ name="ipfs"
rcvar=`set_rcvar`
start_cmd="ipfs_start"
stop_cmd="ipfs_stop"
case ${OSTYPE} in
FreeBSD)
start_precmd="ipfs_prestart"
;;
NetBSD)
ipfs_program="/usr/sbin/ipfs"
;;
esac
start_precmd="ipfs_prestart"
ipfs_prestart()
{

View File

@ -13,16 +13,8 @@
name="ipmon"
rcvar=`set_rcvar`
case ${OSTYPE} in
FreeBSD)
command="/sbin/ipmon"
start_precmd="ipmon_precmd"
;;
NetBSD)
command="/usr/sbin/${name}"
command_args="-D"
esac
command="/sbin/ipmon"
start_precmd="ipmon_precmd"
ipmon_precmd()
{

View File

@ -14,15 +14,6 @@
name="ipnat"
rcvar=`set_rcvar`
load_rc_config $name
case ${OSTYPE} in
NetBSD)
ipnat_flags=
ipnat_rules="/etc/ipnat.conf"
ipnat_program="/usr/sbin/ipnat"
;;
esac
start_precmd="ipnat_precmd"
start_cmd="ipnat_start"
stop_cmd="${ipnat_program} -F -C"
@ -31,16 +22,6 @@ extra_commands="reload"
ipnat_precmd()
{
case ${OSTYPE} in
NetBSD)
if ! checkyesno ipfilter || [ ! -f /etc/ipf.conf ]; then
echo "Enabling ipfilter for NAT."
/sbin/ipf -E -Fa
fi
return 0
;;
esac
# Make sure ipfilter is loaded before continuing
if ! ${SYSCTL} net.inet.ipf.fr_pass >/dev/null 2>&1; then
if kldload ipl; then

View File

@ -21,17 +21,8 @@ stop_precmd="test -f /etc/ipsec.conf"
stop_cmd="ipsec_stop"
reload_cmd="ipsec_reload"
extra_commands="reload"
case ${OSTYPE} in
FreeBSD)
ipsec_program="/usr/sbin/setkey"
# ipsec_file is set by rc.conf
;;
NetBSD)
ipsec_program="/sbin/setkey"
ipsec_file="/etc/ipsec.conf"
;;
esac
ipsec_program="/usr/sbin/setkey"
# ipsec_file is set by rc.conf
ipsec_prestart()
{

View File

@ -15,16 +15,7 @@
name="isdnd"
rcvar=`set_rcvar isdn`
pidfile="/var/run/${name}.pid"
case ${OSTYPE} in
FreeBSD)
start_cmd="isdnd_start"
;;
NetBSD)
command="/usr/sbin/${name}"
required_files="/etc/isdn/${name}.rc"
;;
esac
start_cmd="isdnd_start"
isdnd_start()
{

View File

@ -18,47 +18,35 @@ stop_cmd=":"
ldconfig_start()
{
case ${OSTYPE} in
FreeBSD)
_ins=
ldconfig=${ldconfig_command}
checkyesno ldconfig_insecure && _ins="-i"
if [ -x "${ldconfig_command}" ]; then
_LDC="/lib /usr/lib"
for i in ${ldconfig_paths} /etc/ld-elf.so.conf; do
_ins=
ldconfig=${ldconfig_command}
checkyesno ldconfig_insecure && _ins="-i"
if [ -x "${ldconfig_command}" ]; then
_LDC="/lib /usr/lib"
for i in ${ldconfig_paths} /etc/ld-elf.so.conf; do
if [ -r "${i}" ]; then
_LDC="${_LDC} ${i}"
fi
done
echo 'ELF ldconfig path:' ${_LDC}
${ldconfig} -elf ${_ins} ${_LDC}
# 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} /etc/ld.so.conf; do
if [ -r "${i}" ]; then
_LDC="${_LDC} ${i}"
fi
done
echo 'ELF ldconfig path:' ${_LDC}
${ldconfig} -elf ${_ins} ${_LDC}
# 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} /etc/ld.so.conf; do
if [ -r "${i}" ]; then
_LDC="${_LDC} ${i}"
fi
done
echo 'a.out ldconfig path:' ${_LDC}
${ldconfig} -aout ${_ins} ${_LDC}
;;
esac
fi
;;
NetBSD)
if [ -f ${ldconfig_command} ]; then
echo "Creating a.out runtime link editor directory cache."
${ldconfig_command}
fi
;;
*)
;;
esac
echo 'a.out ldconfig path:' ${_LDC}
${ldconfig} -aout ${_ins} ${_LDC}
;;
esac
fi
}
load_rc_config $name

View File

@ -16,13 +16,5 @@ rcvar=`set_rcvar`
command="/usr/sbin/${name}"
required_files="/etc/printcap"
case ${OSTYPE} in
NetBSD)
pidfile="/var/run/${name}.pid"
;;
*)
;;
esac
load_rc_config $name
run_rc_command "$1"

View File

@ -16,49 +16,32 @@ stop_cmd=":"
mountcritlocal_start()
{
case ${OSTYPE} in
FreeBSD)
# Set up the list of network filesystem types for which mounting
# should be delayed until after network initialization.
case ${extra_netfs_types} in
[Nn][Oo])
;;
*)
netfs_types="${netfs_types} ${extra_netfs_types}"
;;
esac
# Mount everything except nfs filesystems.
mount_excludes='no'
for i in ${netfs_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'
kill -QUIT $$
;;
esac
# Set up the list of network filesystem types for which mounting
# should be delayed until after network initialization.
case ${extra_netfs_types} in
[Nn][Oo])
;;
NetBSD)
# Mount critical filesystems that are `local'
# (as specified in $critical_filesystems_local)
# This usually includes /var.
#
mount_critical_filesystems local
*)
netfs_types="${netfs_types} ${extra_netfs_types}"
;;
esac
# clean up left-over files.
# this could include the cleanup of lock files and /var/run, etc.
#
rm -f /etc/nologin /var/spool/lock/LCK.* /var/spool/uucp/STST/*
(cd /var/run && rm -rf -- *)
# Mount everything except nfs filesystems.
mount_excludes='no'
for i in ${netfs_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'
kill -QUIT $$
;;
esac
}