From: Jonathan McDowell Date: Sat, 16 Apr 2011 17:04:45 +0000 (-0700) Subject: Add Debian init.d file for keyd X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/commitdiff_plain/bccee9f66efda51a5e900ea57b5a130f2e99faf1?ds=sidebyside Add Debian init.d file for keyd Add an init.d file to start up/shut down keyd on Debian machines if it's configured in onak.conf. --- diff --git a/debian/onak.init b/debian/onak.init new file mode 100755 index 0000000..34d0348 --- /dev/null +++ b/debian/onak.init @@ -0,0 +1,67 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: pgp-keyserver +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: onak init script +# Description: onak is a PGP keyserver with an optional persistent +# backend daemon which this script starts. +### END INIT INFO + +# Author: Jonathan McDowell + +# Do NOT "set -e" + +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="PGP Keyserver backend" +NAME=keyd +DAEMON=/usr/sbin/$NAME +DAEMON_ARGS="" +SCRIPTNAME=/etc/init.d/onak + +# Exit if the package is not installed +[ -x "$DAEMON" ] || exit 0 + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.2-14) to ensure that this file is present +# and status_of_proc is working. +. /lib/lsb/init-functions + +if ! grep -q -E '^use_keyd *(true|yes|1)$' /etc/onak.conf; then + exit 0 +fi + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + start-stop-daemon --start --oknodo --user onak --chuid onak \ + --exec $DAEMON + case "$?" in + 0) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 1) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + /usr/bin/keydctl quit + start-stop-daemon --stop --oknodo --user onak --exec $DAEMON + case "$?" in + 0) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 1) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|status}" >&2 + exit 3 + ;; +esac + +: