#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2         
# $Header: /var/cvsroot/gentoo-x86/app-admin/bastille/files/bastille-2.1.1-firewall.init,v 1.2 2004/07/14 21:09:15 agriffis Exp $

opts="start stop"

depend() {
        need logger
}

start() {
	# "Borrowed" from the original bastille-firewall init script ((c) P. Watkins)
	REALSCRIPT=/sbin/bastille-ipchains
	if [ -n "$(uname -r | awk -F. ' $1 == 2 && $2 > 2 {print}')" ]; then
	        # We are using Linux 2.3 or newer; use the netfilter script if available
	        if [ -x /sbin/bastille-netfilter ]; then
	                REALSCRIPT=/sbin/bastille-netfilter
	        fi
	fi
	
        ebegin "Starting bastille-firewall"
        $REALSCRIPT start
        eend $? "Failed to start bastille-firewall"
}

stop() {
	# "Borrowed" from the original bastille-firewall init script ((c) P. Watkins)
	REALSCRIPT=/sbin/bastille-ipchains
	if [ -n "$(uname -r | awk -F. ' $1 == 2 && $2 > 2 {print}')" ]; then
	        # We are using Linux 2.3 or newer; use the netfilter script if available
	        if [ -x /sbin/bastille-netfilter ]; then
	                REALSCRIPT=/sbin/bastille-netfilter
	        fi
	fi
	
	ebegin "Stopping bastille-firewall"
	$REALSCRIPT stop
	eend $? "Failed to stop bastille-firewall"
}