#! /bin/sh
# Copyright (c) 2000-2002 SuSE GmbH Nuernberg, Germany.
#
# Author: Marc Heuse <marc@suse.de>
#
# /etc/init.d/SuSEfirewall2_init
#
### BEGIN INIT INFO
# Provides: SuSEfirewall2_init
# Required-Start: $local_fs boot.localnet
# Required-Stop: 
# Should-Stop: $network
# Default-Start: B
# Default-Stop:
# Short-Description: SuSEfirewall2 phase 1
# Description: SuSEfirewall2_init does some basic setup and is the
#	phase 1 of 2 of the SuSEfirewall initialization
### END INIT INFO

SUSEFWALL="/sbin/SuSEfirewall2"
BOOTLOCKFILE="/var/lock/SuSEfirewall2.booting"

test -x $SUSEFWALL || exit 5
test -r /etc/sysconfig/SuSEfirewall2 || exit 6

. /etc/rc.status

rc_reset

case "$1" in
    start)
	echo -n "Starting Firewall Initialization "
	echo -n '(phase 1 of 2) '
	$SUSEFWALL --bootlock -q close
	rc_status -v
	;;
    stop)
	rc_failed 0
	rc_status
	;;
    restart|force-reload)
	$0 start
	;;
    try-restart|reload)
	if ($0 status) >/dev/null 2>&1; then
	    $0 start
	else
	    rc_reset
	fi
	;;
    status)
	echo -n "Checking the status of SuSEfirewall2 "
	iptables -nL reject_func >/dev/null 2>&1 || rc_failed 3
	rc_status -v
	;;
    *)
	echo "Usage: $0 {start|stop|status|restart|reload|force-reload}"
	exit 1
	;;
esac

# Set exit status
rc_exit
