#!/bin/bash
# $Source: /cvsroot/devil-linux/build/scripts/scripts/cipe,v $
# $Revision: 1.1 $
# $Date: 2003/05/15 00:00:29 $
#
# http://www.devil-linux.org
#
# CIPE added by: Bruce Smith <devil-linux@reddog.org> for Devil Linux 0.6
### BEGIN INIT INFO
# Provides: cipe
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: CIPE daemon
### END INIT INFO
# settings
source /etc/sysconfig/config
# parameters
NAME="CIPE - Crypto IP Encapsulation"
CONFIGNAME=CIPE
DAEMON=/usr/sbin/ciped-cb
PARAMETER=
PACKAGE_NAME=CIPE
SUBSYS=/var/run/cipcb0.pid
# source function library
source /etc/init.d/functions
eval START=\$START_$CONFIGNAME
# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}
# Force execution if not called by a runlevel directory.
test $link = $base && START=yes
test "$START" = "yes" || exit 0
if [ ! -e $DAEMON ]; then
echo
echo "$DAEMON not found. Did you install the package?"
exit 1
fi
case "$1" in
start)
modprobe cipcb
echo -n "Starting $NAME: "
for c in `ls /etc/cipe/options.cipcb* 2> /dev/null`; do
echo -n "($c) "
loadproc $DAEMON -o $c
# RETVAL=$?
# [ $RETVAL = 0 ] && touch $SUBSYS
done
;;
stop)
echo -n "Shutting down $NAME: "
for c in `ls /etc/cipe/options.cipcb* 2> /dev/null`; do
echo -n "($c) "
done
killproc $DAEMON
sleep 1
modprobe -r cipcb
;;
restart | reload)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
;;
esac