I stumbled across this bug today and dug around a bit. Apparently, the
way that System Settings interacts with Avahi is rather broken. I'm not
going to point fingers, but just read the changelog for avahi; it seems
as though the left hand doesn't know what the right hand is doing, as
one developer applies patches so that the control module interacts one
way, while another developer changes the fundamental way that avahi
checks itself, so that you get the resulting bug.

I haven't bothered to read up on the design policy, but the old
enable_avahi script's way of doing things appears to have been
deprecated, except someone forgot to remove the checkbox when removing
the script. I found a copy of the script (for entertainment purposes,
see frode.kde.no/misc/avahi-dapper/enable_avahi and frode.kde.no/misc
/avahi-dapper/avahi_status (the other script that was removed)), but
those don't work because, as I said, that's now deprecated.

But, we still have that annoying checkbox. So let's make it work, shall we? Of 
course, clicking on the checkbox doesn't make a permanent change, but it does 
give instructions on how to make
those changes permanent.

Script 1: /usr/share/avahi/avahi_status
#!/bin/sh -e
# This is thrown into the public domain; do as thou wilt.
# Save (as root, or via sudo) this file as /usr/share/avahi/avahi_status
# and set it as executable (sudo chmod a+x /usr/share/avahi/avahi_status)

# Simple but effective way to see if Avahi is running:
if ps ax | grep "avahi-daemon: running" | grep -v grep 1> /dev/null; then
  exit 1 # Avahi is running
else
  exit 0 # Avahi is not running
fi


Script 2: /usr/share/avahi/enable_avahi
#!/bin/sh
# This is thrown into the public domain; all copyright is disavowed; do as thou 
wilt.
# Save (as root, or via sudo) this file as /usr/share/avahi/enable_avahi
# and set it as executable (sudo chmod a+x /usr/share/avahi/enable_avahi)

/usr/share/avahi/avahi_status 2> /dev/null; case "$?" in
    0)
        kdialog --title "Starting Zeroconf" --msgbox "Zeroconf is started; to 
always start Zeroconf on login, make sure that avahi-daemon is set to start at 
boot in System Settings -> Advanced -> System Services" &&
        /usr/sbin/invoke-rc.d avahi-daemon start
        ;;
    1)
        kdialog --title "Starting Zeroconf" --msgbox "Zeroconf is stopped; to 
always prevent Zeroconf from starting on login, make sure that avahi-daemon is 
set to not start at boot in System Settings -> Advanced -> System Services" &&
        /usr/sbin/invoke-rc.d avahi-daemon stop
        ;;
esac

-- 
zeroconf service discovery does not work
https://bugs.launchpad.net/bugs/226707
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to