chiark / gitweb /
document that nonce-based authentication is for the future
[hippotat.git] / debian / hippotat.hippotatd.init
index 640bd8f26a24a795fccab59c3c048f4557facb83..c8b3dc232670fbe99891f9b2d41090e9a2752980 100644 (file)
@@ -10,7 +10,7 @@
 # Description:          Asinine IP over HTTP server
 ### END INIT INFO
 
-DAEMON=/usr/sbin/hippotat
+DAEMON=/usr/sbin/hippotatd
 MASTER_CONFIG=/etc/hippotat/master.cfg
 USER=Debian-hippotat
 PIDFILE=/var/run/hippotat/hippotatd.pid
@@ -19,10 +19,13 @@ CHECK_FIREWALL=true
 # HIPPOTATD_ARGS
 AS_USER=as_user_userv
 DESCRIPTION='Asinine IP over HTTP server'
-if type -p authbind >/dev/null 2>&1; then AUTHBIND=authbind; fi
+if type authbind >/dev/null 2>&1; then AUTHBIND=authbind; fi
 
+test -e /etc/default/hippotatd &&
 . /etc/default/hippotatd
 
+set -e
+
 test -f $DAEMON || exit 0
 egrep '^[^     #]' $MASTER_CONFIG >/dev/null 2>&1 || exit 0
 
@@ -37,7 +40,7 @@ as_user_userv () {
 
 ssd () {
        set +e
-       start-stop-daemon --start --quiet --user $USER --pidfile=$PIDFILE "$@"
+       start-stop-daemon --quiet --user $USER --pidfile=$PIDFILE "$@"
        rc=$?
        set -e
 }
@@ -68,12 +71,13 @@ check_firewall () {
 do_start () {
        check_firewall
        ensure_dirs
-       ssd     --chuid $USER --startas                         \
+       ssd     --chuid $USER --start                           \
+               --startas /bin/sh -- -ec '"$@"' x               \
                $AUTHBIND $DAEMON --daemon --pidfile=$PIDFILE   \
                --syslog-facility=$LOGFACILITY $HIPPOTATD_ARGS
 }
 do_stop () {
-       ssd     --stop --retry 5
+       ssd     --stop --oknodo --retry 5
 }
 
 case "$1" in
@@ -81,12 +85,14 @@ start)
        log_daemon_msg "Starting $DESCRIPTION" hippotatd
        do_start
        log_end_msg $rc
+       exit $rc
        ;;
 
 stop)
        log_daemon_msg "Stopping $DESCRIPTION" hippotatd
        do_stop
        log_end_msg $rc
+       exit $rc
        ;;
 
 restart|force-reload)