diff options
| author | Mike Makonnen <mtm@FreeBSD.org> | 2003-04-24 08:20:47 +0000 |
|---|---|---|
| committer | Mike Makonnen <mtm@FreeBSD.org> | 2003-04-24 08:20:47 +0000 |
| commit | 8cf06adbcbb067fdae529ca338ecaebe73c492b6 (patch) | |
| tree | c0744a674488d76a59082db26fc4805a539f9646 /etc/rc.d/ipfs | |
| parent | 38dd7dee8a923944eae550d4b18e27bc97360c8a (diff) | |
Notes
Diffstat (limited to 'etc/rc.d/ipfs')
| -rwxr-xr-x | etc/rc.d/ipfs | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/etc/rc.d/ipfs b/etc/rc.d/ipfs index 0abdba07826cf..1f8f9fb17fa3c 100755 --- a/etc/rc.d/ipfs +++ b/etc/rc.d/ipfs @@ -1,23 +1,47 @@ #!/bin/sh # # $NetBSD: ipfs,v 1.3 2002/02/11 13:55:42 lukem Exp $ +# $FreeBSD$ # # PROVIDE: ipfs -# REQUIRE: ipnat mountcritremote -# KEYWORD: shutdown +# REQUIRE: ipnat +# BEFORE: netif +# KEYWORD: FreeBSD NetBSD shutdown . /etc/rc.subr name="ipfs" -rcvar=$name +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 - /usr/sbin/ipfs -R ${rc_flags} + ${ipfs_program} -R ${rc_flags} rm -f /var/db/ipf/ipstate.ipf /var/db/ipf/ipnat.ipf fi } @@ -29,7 +53,7 @@ ipfs_stop() chmod 700 /var/db/ipf chown root:wheel /var/db/ipf fi - /usr/sbin/ipfs -W ${rc_flags} + ${ipfs_program} -W ${rc_flags} } load_rc_config $name |
