#! /bin/sh
#
# Startup script for gpe firewall engine. 
# Based on debian skeleton.
#	

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
GPE_SHIELD=/usr/bin/gpe-shield
IPTABLES=/usr/sbin/iptables
NAME=gpe-shield
DESC="GPE desktop firewall"

SCRIPTNAME=/etc/init.d/$NAME

# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0

# Read config file if it is present.
#if [ -r /etc/default/$NAME ]
#then
#	. /etc/default/$NAME
#fi

case "$1" in
  start)
	echo -n "Starting $DESC: $NAME"
	if [ -f /etc/gpe/gpe-shield-load ]
	then
		$GPE_SHIELD --activate
		echo " OK"
	else
		echo " deactivated"
	fi
	echo "."
	;;
  stop)
	echo -n "Stopping $DESC: $NAME"
	$IPTABLES --flush
	$IPTABLES -P INPUT ACCEPT
	echo "."
	;;
  restart|force-reload)
	#
	#	If the "reload" option is implemented, move the "force-reload"
	#	option to the "reload" entry above. If not, "force-reload" is
	#	just the same as "restart".
	#
	echo -n "Restarting $DESC: $NAME"
	echo "."
	;;
  *)
	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0
