3 # This file is part of avahi.
5 # avahi is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU Lesser General Public License as
7 # published by the Free Software Foundation; either version 2 of the
8 # License, or (at your option) any later version.
10 # avahi is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 # License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with avahi; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 # Authors: <sebastien.estienne@gmail.com>
27 if [ -f /lib/lsb/init-functions ]
29 . /lib/lsb/init-functions
31 # int log_begin_message (char *message)
39 # int log_end_message (int exitstatus)
42 # If no arguments were passed, return
43 [ -z "$1" ] && return 1
45 # Only do the fancy stuff if we have an appropriate terminal
46 # and if /usr is already mounted
49 if [ -x $TPUT ] && [ -x $EXPR ] && $TPUT hpa 60 >/dev/null 2>&1; then
51 if [ -n "$COLS" ]; then
64 echo -e "$UP$START $RED*$NORMAL$END[${RED}fail${NORMAL}]"
77 if log_use_fancy_output; then
78 YELLOW=`$TPUT setaf 3`
80 echo "$YELLOW*$NORMAL $@"
90 PATH=/sbin:/bin:/usr/sbin:/usr/bin
91 DESC="Avahi mDNS/DNS-SD Daemon"
93 DAEMON="@sbindir@/$NAME"
94 SCRIPTNAME=/etc/init.d/$NAME
96 # Gracefully exit if the package has been removed.
97 test -x $DAEMON || exit 0
99 # don't start if /etc/default/avahi-daemon says so.
101 test -f /etc/default/avahi-daemon && . /etc/default/avahi-daemon
103 if [ "$AVAHI_DAEMON_START" != "1" -a "$1" != "stop" ]; then
104 log_warning_msg "Not starting $DESC $NAME, disabled via /etc/default/$NAME"
109 # Function that starts the daemon/service.
112 modprobe capability >/dev/null 2>&1 || true
114 $DAEMON -c && return 0
116 if [ -s /etc/localtime ]; then
117 if [ ! -d /etc/avahi/etc ]; then
118 mkdir -p @sysconfdir@/avahi/etc >/dev/null 2>&1
120 cp -fp /etc/localtime @sysconfdir@/avahi/etc >/dev/null 2>&1
127 # Function that stops the daemon/service.
130 $DAEMON -c && $DAEMON -k
134 # Function that reload the config file for the daemon/service.
137 $DAEMON -c && $DAEMON -r
141 # Function that check the status of the daemon/service.
144 $DAEMON -c && echo "$DESC is running" || echo "$DESC is not running"
149 log_begin_msg "Starting $DESC: $NAME"
154 log_begin_msg "Stopping $DESC: $NAME"
159 log_begin_msg "Reloading services for $DESC: $NAME"
163 restart|force-reload)
164 log_begin_msg "Restarting $DESC: $NAME"
173 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|reload}" >&2