]> git.meshlink.io Git - catta/blobdiff - initscript/fedora/avahi-daemon.in
pull fedora init script to prio 24
[catta] / initscript / fedora / avahi-daemon.in
index aead1be245a9ff7f84633c11788f50aced9d09f0..59f854e7e01da5428b675d0abcbc61b3d482a647 100644 (file)
@@ -2,32 +2,36 @@
 #
 # avahi-daemon:       Starts the Avahi Daemon
 #
-# chkconfig: 345 98 02
+# chkconfig: 345 24 02
 # description: This is a daemon which runs on client machines to perform \
 #              Zeroconf service discovery on a network. avahi-daemon must be \
 #              running on systems  that use Avahi for service discovery. \
 #              Avahi-daemon should not be running otherwise.
 # processname: avahi-daemon
-# config: 
+# config:
+
+AVAHI_BIN=@sbindir@/avahi-daemon
+
+if [ "$1" == 'status' ]; then
+    test -x $AVAHI_BIN || exit 4
+else
+    test -x $AVAHI_BIN || exit 5
+fi
 
 OTHER_AVAHI_OPTS=""
 
 # Source function library.
 . /etc/init.d/functions
-
 . /etc/sysconfig/network
 
-# Check that networking is configured.
-[ ${NETWORKING} = "no" ] && exit 0
-
-AVAHI_BIN=@sbindir@/avahi-daemon
-test -x $AVAHI_BIN || exit 5
-
 LOCKFILE=/var/lock/subsys/avahi-daemon
 
 base=${0##*/}
 
 start() {
+    # Check that networking is configured.
+    [ ${NETWORKING} = "no" ] && exit 1
+
        echo -n $"Starting Avahi daemon... "
        if [ -s /etc/localtime ]; then
            cp -fp /etc/localtime /etc/avahi/etc >/dev/null 2>&1
@@ -80,13 +84,14 @@ case "$1" in
        ;;
   status)
         $AVAHI_BIN -c
-       [ $? = 0 ] && echo $"Avahi daemon is running" || echo $"Avahi daemon is not running"
+       RETVAL=$?
+       [ $RETVAL = 0 ] && echo $"Avahi daemon is running" || echo $"Avahi daemon is not running"
        ;;
   restart)
        restart
        ;;
   reload)
-        reload 
+        reload
        ;;
   condrestart)
        if [ -f $LOCKFILE ]; then
@@ -95,8 +100,8 @@ case "$1" in
        ;;
   *)
        echo $"Usage: $0 {start|stop|status|restart|condrestart}"
-       exit 1
+       exit 2
+        ;;
 esac
 
-exit $?
-
+exit $RETVAL