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
21 # avahi-dnsconfd avahi dns configuration daemon
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 Unicast DNS Configuration 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-dnsconfd says so.
100 AVAHI_DNSCONFD_START=1
101 test -f /etc/default/avahi-dnsconfd && . /etc/default/avahi-dnsconfd
103 if [ "$AVAHI_DNSCONFD_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.
115 if [ -s /etc/localtime ]; then
116 if [ ! -d /etc/avahi/etc ]; then
117 mkdir -p @sysconfdir@/avahi/etc >/dev/null 2>&1
119 cp -fp /etc/localtime @sysconfdir@/avahi/etc >/dev/null 2>&1
126 # Function that stops the daemon/service.
130 [ $? != 0 ] && exit 0
136 # Function that reload the config file for the daemon/service.
140 [ $? != 0 ] && exit 0
146 # Function that check the status of the daemon/service.
150 [ $? = 0 ] && echo "$DESC is running" || echo "$DESC is not running"
155 log_begin_msg "Starting $DESC: $NAME"
160 log_begin_msg "Stopping $DESC: $NAME"
165 log_begin_msg "Refreshing $DESC: $NAME"
169 reload|restart|force-reload)
170 log_begin_msg "Restarting $DESC: $NAME"
179 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|reload}" >&2