home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- ### BEGIN INIT INFO
- # Provides: avahi
- # Required-Start: $remote_fs dbus
- # Required-Stop: $remote_fs dbus
- # Should-Start: $syslog
- # Should-Stop: $syslog
- # Default-Start: 2 3 4 5
- # Default-Stop: 1
- # Short-Description: Avahi mDNS/DNS-SD Daemon
- # Description: Zeroconf daemon for configuring your network
- # automatically
- ### END INIT INFO
-
- #set -e
-
- PATH=/sbin:/bin:/usr/sbin:/usr/bin
- DESC="Avahi mDNS/DNS-SD Daemon"
- NAME="avahi-daemon"
- DAEMON="/usr/sbin/$NAME"
- SCRIPTNAME=/etc/init.d/$NAME
-
- # Gracefully exit if the package has been removed.
- test -x $DAEMON || exit 0
-
- . /lib/lsb/init-functions
-
- # Include avahi-daemon defaults if available.
- test -f /etc/default/avahi-daemon && . /etc/default/avahi-daemon
-
- DISABLE_TAG="/var/run/avahi-daemon/disabled-for-unicast-local"
-
- if [ -n "$AVAHI_DAEMON_START" ]; then
- log_warning_msg "The AVAHI_DAEMON_START option in /etc/default/$NAME has been deprecated."
- log_warning_msg "Please remove this setting from the configuration file."
- log_warning_msg "To disable the service use a runlevel editor like sysv-rc-conf or bum instead."
- fi
-
- #
- # Function that starts the daemon/service.
- #
- d_start() {
- modprobe capability >/dev/null 2>&1 || true
-
- $DAEMON -c && return 0
-
- if [ -e ${DISABLE_TAG} ]; then
- # Disabled because of the existance of an unicast .local domain
- log_warning_msg "avahi-daemon disabled because there is a unicast .local domain"
- exit 0;
- fi;
-
- $DAEMON -D
- }
-
- #
- # Function that stops the daemon/service.
- #
- d_stop() {
- if $DAEMON -c ; then
- $DAEMON -k
- fi
- }
-
- #
- # Function that reload the config file for the daemon/service.
- #
- d_reload() {
- $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)
- log_daemon_msg "Starting $DESC" "$NAME"
- d_start
- log_end_msg $?
- ;;
- stop)
- log_daemon_msg "Stopping $DESC" "$NAME"
- d_stop
- log_end_msg $?
- ;;
- reload)
- log_daemon_msg "Reloading services for $DESC" "$NAME"
- d_reload
- log_end_msg $?
- ;;
- restart|force-reload)
- log_daemon_msg "Restarting $DESC" "$NAME"
- $DAEMON -c && d_stop
- d_start
- log_end_msg $?
- ;;
- status)
- d_status
- ;;
- *)
- echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|reload}" >&2
- exit 1
- ;;
- esac
-
- exit 0
-