#! /bin/sh

# quit if this is runlevel 0 or 6 (shutdown)
RUNLEVEL=/sbin/runlevel
RL=`${RUNLEVEL} | sed 's/.*\ //'`
if [ "x${RL}" = "x0" ] || [ "x${RL}" = "x6" ]; then
    exit 0
fi

# quit if we're called for the loopback
if [ "x$IFACE" = "xlo" ]; then
	exit 0
fi

# quit if the configuration does not exist
if [ ! -r  /etc/firestarter/configuration ]; then
	exit 0
fi

# Retrieve the configured interface value (IF and INIF)
. /etc/firestarter/configuration

# Check if we have the values we need to proceed
if [ -z "$IF" ] || [ -z "$INIF" ] ; then
	exit 0
fi

# Are we being called for the same interfaces we are configured with?
if [ "$IFACE" != "$IF" ] ; then
	exit 0
fi

# If all the other checks succeed, then restart the firewall
invoke-rc.d firestarter restart

