#!/bin/sh
### BEGIN INIT INFO
-# Provides: gopherd
-# Required-Start: $network
-# Required-Stop: $network
-# Default-Start: 2 3 4 5
-# Default-Stop:
-# Short-Description: Start gopher server
+# Provides: gogopherd
+# Required-Start: $local_fs $remote_fs $network $named
+# Required-Stop: $local_fs $remote_fs $network $named
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: gogopherd gopher server
+# Description: Start and stop the gogopherd gopher server using start-stop-daemon.
### END INIT INFO
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-
-. /lib/lsb/init-functions
-
PREFIX=/usr/local
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
DAEMON="$PREFIX/bin/gogopherd"
CFGFILE="$PREFIX/etc/gogopherd.cfg"
+DFLTFILE="$PREFIX/etc/default/gogopherd"
+GOGOPTS="-c $CFGFILE"
+DESC="gogopher server"
+NAME=gogopherd
PIDFILE=/var/run/gogopherd.pid
-GOGOPTS="$GOGOPTS -c $CFGFILE"
+LOCKFILE=/run/lock/gogopherd
-test -x $DAEMON || exit 5
-test -f $CFGFILE || exit 5
+[ -x "$DAEMON" ] || exit 5
+[ -r "$CFGFILE" ] || exit 5
+[ -r "$DFLTFILE" ] && . "$DFLTFILE"
-LOCKFILE=/run/lock/gogopherd
+. /lib/lsb/init-functions
case $1 in
start)