X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=initscript%2Fdebian%2Favahi-daemon.in;h=553db781513c055e9ef21e76e086ad15f45efdb1;hb=13c8a680f9685baba470123aa7bee015cb890438;hp=66aaee7fb141fccf1534afb733883064c85c1394;hpb=78c4d691610a48ac2c2f12172ae24c3d096b415e;p=catta diff --git a/initscript/debian/avahi-daemon.in b/initscript/debian/avahi-daemon.in index 66aaee7..553db78 100755 --- a/initscript/debian/avahi-daemon.in +++ b/initscript/debian/avahi-daemon.in @@ -83,14 +83,34 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin DESC="Avahi mDNS/DNS-SD Daemon" NAME="avahi-daemon" DAEMON="@sbindir@/$NAME" +SCRIPTNAME=/etc/init.d/$NAME # Gracefully exit if the package has been removed. test -x $DAEMON || exit 0 +# don't start if /etc/default/avahi-daemon says so. +AVAHI_DAEMON_START=1 +test -f /etc/default/avahi-daemon && . /etc/default/avahi-daemon + +if [ "$AVAHI_DAEMON_START" != "1" -a "$1" != "stop" ]; then + exit 0 +fi + # # Function that starts the daemon/service. # d_start() { + modprobe capability >/dev/null 2>&1 || true + + $DAEMON -c && return 0 + + if [ -s /etc/localtime ]; then + if [ ! -d /etc/avahi/etc ]; then + mkdir -p @sysconfdir@/avahi/etc >/dev/null 2>&1 + fi + cp -fp /etc/localtime @sysconfdir@/avahi/etc >/dev/null 2>&1 + fi; + $DAEMON -D } @@ -98,16 +118,22 @@ d_start() { # Function that stops the daemon/service. # d_stop() { - $DAEMON -k || /bin/true + $DAEMON -c && $DAEMON -k } # # Function that reload the config file for the daemon/service. # d_reload() { - $DAEMON -r + $DAEMON -c && $DAEMON -r } +# +# Function that check the status of the daemon/service. +# +d_status() { + $DAEMON -c && echo "$DESC is running" || echo "$DESC is not running" +} case "$1" in start) @@ -127,12 +153,14 @@ case "$1" in ;; restart|force-reload) log_begin_msg "Restarting $DESC: $NAME" - d_stop - sleep 1 + $DAEMON -c && d_stop d_start log_end_msg $? ;; - *) + status) + d_status + ;; + *) echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|reload}" >&2 exit 1 ;;