freebsd-nq/etc/rc.d/ipfs
Mike Makonnen 1afce00360 Luke Mewburn has indicated that they (NetBSD) are not interested
in keeping the scripts under rc.d in sync with us. So, begin removal
of NetBSD specific stuff (which made our scripts more complicated
than necessary), starting with the NetBSD KEYWORD.
2004-01-17 10:16:38 +00:00

61 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
#
# $NetBSD: ipfs,v 1.3 2002/02/11 13:55:42 lukem Exp $
# $FreeBSD$
#
# PROVIDE: ipfs
# REQUIRE: ipnat
# BEFORE: netif
# KEYWORD: FreeBSD shutdown
. /etc/rc.subr
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
ipfs_prestart()
{
# Do not continue if either ipnat or ipfilter is not enabled or
# if the ipfilter module is not loaded.
#
if ! checkyesno ipfilter_enable -o ! checkyesno ipnat_enable ; then
err 1 "${name} requires either ipfilter or ipnat enabled"
fi
if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then
err 1 "ipfilter module is not loaded"
fi
return 0
}
ipfs_start()
{
if [ -r /var/db/ipf/ipstate.ipf -a -r /var/db/ipf/ipnat.ipf ]; then
${ipfs_program} -R ${rc_flags}
rm -f /var/db/ipf/ipstate.ipf /var/db/ipf/ipnat.ipf
fi
}
ipfs_stop()
{
if [ ! -d /var/db/ipf ]; then
mkdir /var/db/ipf
chmod 700 /var/db/ipf
chown root:wheel /var/db/ipf
fi
${ipfs_program} -W ${rc_flags}
}
load_rc_config $name
run_rc_command "$1"