Difference between revisions of "Avahi"

From CBLFS
Jump to navigationJump to search
(Required)
Line 145: Line 145:
 
=== Bootscript ===
 
=== Bootscript ===
  
There currently isn't a pre-written bootscript for any of the 3 daemons Avahi provides. '''avahi-daemon''' must start after udev.
+
{{Note|This script is currently in development. It may not work correctly.}}
 +
 
 +
Create the bootscript:
 +
 
 +
cat > /etc/rc.d/init.d/avahi-daemon << "EOF"
 +
#!/bin/bash
 +
# Begin $rc_base/init.d/avahi-daemon
 +
 +
. /etc/sysconfig/rc
 +
. ${rc_functions}
 +
 +
AVAHI_BIN=/usr/sbin/avahi-daemon
 +
LOCKFILE=/var/lock/subsys/avahi-daemon
 +
 +
start() {
 +
boot_mesg "Starting Avahi daemon..."
 +
if [ -s /etc/localtime ]; then
 +
    cp -fp /etc/localtime /etc/avahi/etc >/dev/null 2>&1
 +
fi;
 +
        $AVAHI_BIN -D
 +
RETVAL=$?
 +
  if [ $RETVAL = 0 ]; then
 +
touch $LOCKFILE
 +
echo_ok "$base startup"
 +
else
 +
echo_failure "$base startup"
 +
fi
 +
echo
 +
  return $RETVAL
 +
  }
 +
 
 +
  stop() {
 +
          boot_mesg "Shutting down Avahi daemon... "
 +
          $AVAHI_BIN -k
 +
  RETVAL=$?
 +
  [ $RETVAL = 0 ] && echo_ok "$base shutdown" || echo_failure "$base shutdown"
 +
  rm -f $LOCKFILE
 +
  echo
 +
  return $RETVAL
 +
  }
 +
 
 +
  reload() {
 +
          boot_mesg "Reloading Avahi daemon... "
 +
          $AVAHI_BIN -r
 +
  RETVAL=$?
 +
  [ $RETVAL = 0 ] && echo_ok "$base reload" || echo_failure "$base reload"
 +
  echo
 +
return $RETVAL
 +
  }
 +
 +
  restart() {
 +
stop
 +
start
 +
  }
 +
 +
  RETVAL=0
 +
 +
  case "$1" in
 +
  start)
 +
start
 +
;;
 +
  stop)
 +
stop
 +
;;
 +
  status)
 +
        $AVAHI_BIN -c
 +
    RETVAL=$?
 +
    [ $RETVAL = 0 ] && echo $"Avahi daemon is running" || echo $"Avahi daemon is not running"
 +
;;
 +
  restart)
 +
restart
 +
;;
 +
  reload)
 +
        reload
 +
;;
 +
  condrestart)
 +
  if [ -f $LOCKFILE ]; then
 +
restart
 +
fi
 +
;;
 +
  *)
 +
echo "Usage: $0 {start|stop|status|restart|condrestart}"
 +
exit 2
 +
        ;;
 +
  esac
 +
 +
  exit $RETVAL
 +
 +
# End $rc_base/init.d/avahi-daemon
 +
EOF
 +
chmod -v 754 /etc/rc.d/init.d/avahi-daemon
 +
 
 +
for link in /etc/rc.d/rc{{0,1,6}.d/K20,{2,3,4,5}.d/S21}avahi-daemon; do
 +
  ln -sfv ../init.d/avahi-daemon $link;
 +
done
 +
 
 +
There currently isn't a pre-written bootscript for avahi-autoipd and avahi-dnsconfd. Help to write it.
  
 
* '''avahi-daemon''' -  The Avahi mDNS/DNS-SD daemon.
 
* '''avahi-daemon''' -  The Avahi mDNS/DNS-SD daemon.
 
* '''avahi-autoipd''' - IPv4LL network address configuration daemon. For use in an ad-hoc network where there is a lack of a DHCP server.
 
* '''avahi-autoipd''' - IPv4LL network address configuration daemon. For use in an ad-hoc network where there is a lack of a DHCP server.
 
* '''avahi-dnsconfd''' - Unicast DNS server from mDNS/DNS-SD configuration daemon. Connects to a running avahi-daemon and runs the script /etc/avahi/dnsconfd.action for each unicast DNS server that is announced on the local LAN.
 
* '''avahi-dnsconfd''' - Unicast DNS server from mDNS/DNS-SD configuration daemon. Connects to a running avahi-daemon and runs the script /etc/avahi/dnsconfd.action for each unicast DNS server that is announced on the local LAN.

Revision as of 05:51, 28 June 2008

Download Source: http://avahi.org/download/avahi-0.6.25.tar.gz

Introduction to Avahi

According to Avahi's site: Avahi is a system which facilitates service discovery on a local network. This means that you can plug your laptop or computer into a network and instantly be able to view other people who you can chat with, find printers to print to or find files being shared. This kind of technology is already found in Apple MacOS X (branded Rendezvous, Bonjour and sometimes Zeroconf) and is very convenient. Avahi is mainly based on Lennart Poettering's flexmdns mDNS implementation for Linux which has been discontinued in favour of Avahi.

Project Homepage: http://www.avahi.org/

Dependencies

See http://www.avahi.org/wiki/DownloadAvahi#Requirements for more information.

Required

Recommended

Optional

Avahi Users/Groups

The avahi user is running the Avahi daemon:

groupadd -g 20 avahi &&
useradd -c "Avahi Daemon User" -d /dev/null \
        -u 20 -g avahi -s /bin/false avahi

The avahi-autoipd user/group is for running the avahi-autoipd daemon:

groupadd -g 21 avahi-autoipd &&
useradd -c "Avahi AutoIP Daemon User" -d /dev/null \
        -u 21 -g avahi-autoipd -s /bin/false avahi-autoipd

The netdev group is a priviliged access group for Avahi clients:

groupadd -g 22 netdev

Configure Options

If you do not have any of following packages installed pass the appropriate options to configure:

--disable-glib
--disable-qt3
--disable-qt4
--disable-gtk
--disable-dbus
--disable-expat
--disable-mono --disable-monodoc

If you want to enable the HOWL compat layer:

--enable-compat-howl

If you want to enable to libdns_sd compat layer:

--enable-compat-libdns_sd

Non-Multilib

Compile the package:

./configure --prefix=/usr --sysconfdir=/etc \
    --localstatedir=/var --with-distro=none &&
make

Install the package

make install

Multilib

32Bit

Compile the package:

CC="gcc ${BUILD32}" CXX="g++ ${BUILD32}" \
PKG_CONFIG_PATH="${PKG_CONFIG_PATH32}" USE_ARCH=32 \
./configure --prefix=/usr --sysconfdir=/etc \
    --localstatedir=/var --with-distro=none &&
make

Install the package

make install

N32

Compile the package:

CC="gcc ${BUILDN32}" CXX="g++ ${BUILDN32}" \
PKG_CONFIG_PATH="${PKG_CONFIG_PATHN32}" USE_ARCH=n32 \
./configure --prefix=/usr --sysconfdir=/etc \
    --localstatedir=/var --libdir=/usr/lib32 \
    --with-distro=none &&
make

Install the package

make install

64Bit

Compile the package:

CC="gcc ${BUILD64}" CXX="g++ ${BUILD64}" \
PKG_CONFIG_PATH="${PKG_CONFIG_PATH64}" USE_ARCH=64 \
./configure --prefix=/usr --sysconfdir=/etc \
    --localstatedir=/var --libdir=/usr/lib64 \
    --with-distro=none &&
make

Install the package

make install

Contents

Installed Directories: /usr/include/avahi-ui, /etc/avahi, /usr/include/avahi-compat-howl, /usr/include/avahi-compat-libdns_sd, /usr/share/avahi, /usr/lib/python2.5/site-packages/avahi, /usr/include/avahi-client, /usr/include/avahi-qt3, /usr/include/avahi-core, /usr/include/avahi-glib, usr/include/avahi-common
Installed Programs: bssh, avahi-autoipd, avahi-bookmarks, avahi-discover, avahi-browse, avahi-resolve, avahi-publish, avahi-set-host-name, avahi-dnsconfd, avahi-daemon, avahi-discover-standalone
Installed Libraries: libavahi-ui.{a,la,so}, libhowl.{a,la,so}, libdns_sd.{a,la,so}, libavahi-client.{a,la,so}, libavahi-qt3.{a,la,so}, libavahi-core.{a,la,so}, libavahi-glib.{a,la,so}, libavahi-common.{a,la,so}

Configuring

Bootscript

Caution.png

Note

This script is currently in development. It may not work correctly.

Create the bootscript:

cat > /etc/rc.d/init.d/avahi-daemon << "EOF"
#!/bin/bash
# Begin $rc_base/init.d/avahi-daemon

. /etc/sysconfig/rc
. ${rc_functions}

AVAHI_BIN=/usr/sbin/avahi-daemon
LOCKFILE=/var/lock/subsys/avahi-daemon

start() {
	boot_mesg "Starting Avahi daemon..."
	if [ -s /etc/localtime ]; then
	    cp -fp /etc/localtime /etc/avahi/etc >/dev/null 2>&1
	fi;
        $AVAHI_BIN -D
	RETVAL=$?
 	if [ $RETVAL = 0 ]; then
		touch $LOCKFILE
		echo_ok "$base startup"
	else
		echo_failure "$base startup"
	fi
	echo
 	return $RETVAL
  }
 
  stop() {
         boot_mesg "Shutting down Avahi daemon... "
         $AVAHI_BIN -k
 	RETVAL=$?
 	[ $RETVAL = 0 ] && echo_ok "$base shutdown" || echo_failure "$base shutdown"
 	rm -f $LOCKFILE
 	echo
 	return $RETVAL
  }
 
  reload() {
         boot_mesg "Reloading Avahi daemon... "
         $AVAHI_BIN -r
 	RETVAL=$?
 	[ $RETVAL = 0 ] && echo_ok "$base reload" || echo_failure "$base reload"
 	echo
	return $RETVAL
 }

 restart() {
	stop
	start
 }

 RETVAL=0

 case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
        $AVAHI_BIN -c
    	RETVAL=$?
    	[ $RETVAL = 0 ] && echo $"Avahi daemon is running" || echo $"Avahi daemon is not running"
	;;
  restart)
	restart
	;;
  reload)
        reload 
	;;
  condrestart)
  	if [ -f $LOCKFILE ]; then
		restart
	fi
	;;
  *)
	echo "Usage: $0 {start|stop|status|restart|condrestart}"
	exit 2
        ;;
 esac

 exit $RETVAL

# End $rc_base/init.d/avahi-daemon
EOF
chmod -v 754 /etc/rc.d/init.d/avahi-daemon
for link in /etc/rc.d/rc{{0,1,6}.d/K20,{2,3,4,5}.d/S21}avahi-daemon; do
  ln -sfv ../init.d/avahi-daemon $link;
done

There currently isn't a pre-written bootscript for avahi-autoipd and avahi-dnsconfd. Help to write it.

  • avahi-daemon - The Avahi mDNS/DNS-SD daemon.
  • avahi-autoipd - IPv4LL network address configuration daemon. For use in an ad-hoc network where there is a lack of a DHCP server.
  • avahi-dnsconfd - Unicast DNS server from mDNS/DNS-SD configuration daemon. Connects to a running avahi-daemon and runs the script /etc/avahi/dnsconfd.action for each unicast DNS server that is announced on the local LAN.