#!/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.

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

[ -f /var/lib/mason/masonrc ] || exit 0
[ -f /var/lib/mason/masonlib ] || exit 0

MASONDIR=${MASONDIR:-"/var/lib/mason/"}
MASONCONF=${MASONCONF:-"/var/lib/mason/masonrc"}
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 /var/lib/mason/masonrc ]; then
	. /var/lib/mason/masonrc
fi
checksys
checkconf


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

exit 0

