#!/bin/sh
#
# firewall      This shell script brings up the firewall rules
#
# chkconfig: 2345 91 9
# description: Firewall packet filter
# probe: false
#
# Copyright (c) 2001-2004 NeoNova BV"
#
# ASTIUM Home Page: http://www.astium.nl"
#
# ASTIUM: IP Filtering Firewall script for ASTIUM."
#                  

# Source function library.
. /etc/init.d/functions

[ -f /etc/sysconfig/firewall ] && . /etc/sysconfig/firewall

start() {
        action "Installing Firewall packet filter" \
	/usr/local/astium/sbin/astium-iptables $FIREWALL_OPTS start
        RETVAL=$?
	[ $RETVAL = 0 ] && touch /var/lock/subsys/firewall
        return $RETVAL
	
}

stop() {
	action "Deleting firewall packet filter" \
	/usr/local/astium/sbin/astium-iptables stop
	RETVAL=?$
        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/firewall
}

status() {
        echo "Display firewall status:"
        /usr/local/astium/sbin/astium-iptables status
}


# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        start
        ;;
  condrestart)
        if [ -f /var/lock/subsys/firewall ]; then
            stop
            start
        fi
        ;;
  status)
        status
        ;;

  probe)
	if [ -f /var/lock/subsys/firewall -a \
	    /etc/sysconfig/firewall -nt /var/lock/subsys/firewall ];then
	    echo reload
	fi
	if [ ! -f /etc/sysconfig/firewall ]; then
	    if [ -f /var/lock/subsys/firewall ]; then
		echo stop
	    fi
	fi
	exit 0
	;;
  *)
	echo "Usage: firewall {start|stop|restart|status}"
	exit 1
esac

exit 0
