ipfs revision 174438
1#!/bin/sh 2# 3# $FreeBSD: head/etc/rc.d/ipfs 174438 2007-12-08 07:20:23Z dougb $ 4# 5 6# PROVIDE: ipfs 7# REQUIRE: ipnat 8# BEFORE: netif 9# KEYWORD: nojail shutdown 10 11. /etc/rc.subr 12 13name="ipfs" 14rcvar=`set_rcvar` 15start_cmd="ipfs_start" 16stop_cmd="ipfs_stop" 17start_precmd="ipfs_prestart" 18 19ipfs_prestart() 20{ 21 # Do not continue if either ipnat or ipfilter is not enabled or 22 # if the ipfilter module is not loaded. 23 # 24 if ! checkyesno ipfilter_enable -o ! checkyesno ipnat_enable ; then 25 err 1 "${name} requires either ipfilter or ipnat enabled" 26 fi 27 if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then 28 err 1 "ipfilter module is not loaded" 29 fi 30 return 0 31} 32 33ipfs_start() 34{ 35 if [ -r /var/db/ipf/ipstate.ipf -a -r /var/db/ipf/ipnat.ipf ]; then 36 ${ipfs_program} -R ${rc_flags} 37 rm -f /var/db/ipf/ipstate.ipf /var/db/ipf/ipnat.ipf 38 fi 39} 40 41ipfs_stop() 42{ 43 if [ ! -d /var/db/ipf ]; then 44 mkdir /var/db/ipf 45 chmod 700 /var/db/ipf 46 chown root:wheel /var/db/ipf 47 fi 48 ${ipfs_program} -W ${rc_flags} 49} 50 51load_rc_config $name 52run_rc_command "$1" 53