#!/bin/sh
#
# firewall        Starts a Mason firewall.
#
#
# chkconfig: 2345 18 92
# description: firewall starts the firewall created by the Mason \
# firewall builder.  As a firewall is important to system security, \
# it should be always turned on.

# Debian init script derived from original script by Jeff Licquia.

# Debian flags for runlevels - similar to RH's chkconfig.
FLAGS="defaults 19"

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

MASONCONF=${MASONCONF:-"/etc/masonrc"}
[ -f $MASONCONF ] || exit 0

MASONLIB=${MASONLIB:-"/var/lib/mason/masonlib"}
if [ -f $MASONLIB ]; then
	. $MASONLIB
else
	echo Missing $MASONLIB library file.  Please get a complete copy of Mason from >/dev/stderr
	echo http://www.pobox.com/~wstearns/mason/ .  Exiting. >/dev/stderr
	exit
fi
if [ -f /etc/masonrc ]; then
	. /etc/masonrc
fi
checksys
checkconf


# See how we were called.
case "$1" in
  start)
	echo -n "Starting Mason firewall: "
	flushfirewall
	runstandardfirewall
#	touch /var/lock/subsys/firewall
	echo
	;;
  stop)
	echo -n "Shutting down Mason firewall: "
	flushfirewall
#	rm -f /var/lock/subsys/firewall
	echo
	;;
#  status)
#	status syslogd
#	status klogd
#	;;
  restart)
	$0 stop
	$0 start
	;;
  force-reload)
	$0 stop
	$0 start
  *)
	echo "Usage: firewall {start|stop|restart|force-reload}"
	exit 1
esac

exit 0

