--- /cipc/llefolgoc/Desktop/firestarter 2005-05-29 03:10:55.000000000 +0200 +++ firestarter 2006-03-23 15:04:58.000000000 +0100 @@ -1,96 +1,69 @@ -#!/bin/sh +#! /bin/sh # -# Init file for the Firestarter firewall -# -# chkconfig: 2345 11 92 -# -# description: Starts, stops, and lock the firewall -# -# Script Authors: -# Tomas Junnonen -# Paul Drain +# Debian init.d script for the Firestarter firewall # # config: /etc/firestarter/configuration -FS_CONTROL="/etc/firestarter/firestarter.sh" +set -e + +. /lib/lsb/init-functions -[ -x /usr/sbin/firestarter ] || exit 0 -[ -x $FS_CONTROL ] || exit 0 -[ -s /etc/firestarter/configuration ] || exit 0 - -RETVAL=0 - -start() { - echo -n "Starting the Firestarter firewall: " - $FS_CONTROL start > /dev/null - RETVAL=$? - if [ $RETVAL -eq 0 ]; then - echo done. - else - echo failed. - fi - return $RETVAL +FS=/usr/sbin/firestarter +NAME=firestarter +DESC="the Firestarter firewall" +FS_CONTROL=/etc/firestarter/firestarter.sh + +test -x $FS || exit 0 +test -x $FS_CONTROL || exit 0 +test -s /etc/firestarter/configuration || exit 0 + +start_it_up() +{ + log_begin_msg "Starting $DESC..." + start-stop-daemon --start --quiet --exec $FS_CONTROL -- start > /dev/null + log_end_msg $? } -stop() { - echo -n "Stopping the Firestarter firewall:" - $FS_CONTROL stop > /dev/null - RETVAL=$? - if [ $RETVAL -eq 0 ]; then - echo done. - else - echo failed. - fi - return $RETVAL +shut_it_down() +{ + log_begin_msg "Stopping $DESC..." + start-stop-daemon --start --quiet --exec $FS_CONTROL -- stop > /dev/null + log_end_msg $? } -lock() { - echo -n "Locking the Firestarter firewall:" - $FS_CONTROL lock > /dev/null - RETVAL=$? - if [ $RETVAL -eq 0 ]; then - echo done. - else - echo failed. - fi - return $RETVAL +lock_it() +{ + log_begin_msg "Locking $DESC..." + start-stop-daemon --start --quiet --exec $FS_CONTROL -- lock > /dev/null + log_end_msg $? } -# See how we were called. case "$1" in - start) - start - RETVAL=$? - ;; - stop) - stop - RETVAL=$? - ;; - restart) - stop - start - RETVAL=$? - ;; - force-reload) - stop - start - RETVAL=$? - ;; - lock) - lock - RETVAL=$? - ;; - status) - if [ -e /var/lock/subsys/firestarter -o -e /var/lock/firestarter ]; then - echo "Firestarter is running..." - else - echo "Firestarter is stopped" - fi - RETVAL=$? - ;; - *) - echo "Usage: firestarter {start|stop|restart|force-reload|lock|status}" - exit 1 + start) + start_it_up +;; + stop) + shut_it_down +;; + restart|force-reload) + shut_it_down + sleep 1 + start_it_up +;; + lock) + lock_it +;; + status) + if [ -e /var/lock/subsys/firestarter -o -e /var/lock/firestarter ]; then + log_success_msg "$NAME is running..." + else + log_success_msg "$NAME is stopped." + fi +;; + *) + echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload|lock|status}" >&2 + exit 1 +;; esac -exit $RETVAL +exit 0