diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-08-18 00:34:25 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-08-18 00:34:25 +0100 |
commit | 5b94e9ecc30e9f3b96c083e41235e4df2d0d75c9 (patch) | |
tree | 670fc8cc4db761308160fe6e9de6d27a7f0f65f9 /debian/bitlbee-common.init | |
parent | d20ea9f92f70fa9732baf4520582abfc45124548 (diff) |
Move scripts, debconf and /etc stuff to bitlbee-common and really have
*just* the binary in bitlbee{,-libpurple}. This should fix issues with
installing the package on a clean machine.
Diffstat (limited to 'debian/bitlbee-common.init')
-rw-r--r-- | debian/bitlbee-common.init | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/debian/bitlbee-common.init b/debian/bitlbee-common.init new file mode 100644 index 00000000..be1dcd66 --- /dev/null +++ b/debian/bitlbee-common.init @@ -0,0 +1,88 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: bitlbee +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 1 +### END INIT INFO +# +# Init script for BitlBee Debian package. Based on skeleton init script: +# +# Version: @(#)skeleton 2.85-23 28-Jul-2004 miquels@cistron.nl +# + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DESC="BitlBee IRC/IM gateway" +NAME=bitlbee +DAEMON=/usr/sbin/$NAME +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +# Gracefully exit if the package has been removed. +[ -x $DAEMON ] || exit 0 + +# Default value +BITLBEE_PORT=6667 +BITLBEE_OPTS=-F + +# Read config file if it is present. +if [ -r /etc/default/$NAME ]; then + . /etc/default/$NAME +fi + + +# +# Function that starts the daemon/service. +# +d_start() { + # Make sure BitlBee can actually write its PID... + touch $PIDFILE + chown bitlbee: $PIDFILE + + start-stop-daemon --start --quiet --pidfile $PIDFILE \ + --exec $DAEMON -- -p $BITLBEE_PORT -P $PIDFILE $BITLBEE_OPTS +} + +# +# Function that stops the daemon/service. +# +d_stop() { + start-stop-daemon --stop --quiet --pidfile $PIDFILE \ + --name $NAME +} + + +case "$1" in + start) + [ "$BITLBEE_DISABLED" = "1" ] && exit 0 + + echo -n "Starting $DESC: $NAME" + d_start + echo "." + ;; + stop) + echo -n "Stopping $DESC: $NAME" + d_stop + echo "." + ;; + #reload) + # + # No reload target, but there's a REHASH command which we + # might use later... + # + #;; + restart|force-reload) + echo -n "Restarting $DESC: $NAME" + d_stop + sleep 1 + d_start + echo "." + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 |