Ladies and Gentlemen, a tutorial on how to get Netatalk and Avahi running on your MyBook.
The MyBook unit used for this was a 1TB single disc version.
None of this would have been possible without Clifford Meece and his efforts in creating the Netatalk and Avahi builds (and his scripts).
Clifford website is cliffordmeece.com
The Tutorial:
NOTE: There are now Optware versions of avahi and netatalk available! This means you do not have to install libc-dev, however you will still need to create startup scripts.
Get Clifford's packages: See bottom of this screen under 'files' (you must be logged in to see this option).
Files: avahi, S90optware, netatalk_package.ipk, avahi_package.ipk
Put them in /shares/internal/Public
Do the following in your ssh shell.
ipkg install libc-dev
ldconfig
mv /shares/internal/Public/avahi /opt/etc/init.d
chmod u+x /opt/etc/init.d/avahi
ln -s /opt/etc/init.d/avahi /opt/etc/init.d/S99avahi
mv /shares/internal/Public/S90optware /etc/init.d
chmod u+x /etc/init.d/S90optware
S90optware is a script that will run on startup (make sure it is executable with chmod u+x). It will run from /etc/init.d and go into /opt/etc/init.d and run any startup scripts there. It makes optware easier to deal with.
ipkg install /shares/internal/Public/avahi_package.ipk
ldconfig
ipkg install /shares/internal/Public/netatalk_package.ipk
ldconfig
Have a look and make sure 'opt/lib' is in /etc/ld.so.conf
Add user 'avahi' to /etc/password - remember to give a unique user id (mine is 107)
Add group 'avahi' to /etc/group - copy the format of an existing line
Setting up netatalk
cd /opt/etc/netatalk/
nano netatalk.conf
Make these changes:-
# Set which daemons to run (papd is dependent upon atalkd):
ATALKD_RUN=no
PAPD_RUN=no
CNID_METAD_RUN=yes
AFPD_RUN=yes
TIMELORD_RUN=no
A2BOOT_RUN=no
Save it.
Optional (The default is to share home directories. I had already created a user and password in the WD web interface. I then modified that user's home directory in /etc/password. I made /shares/internal the home for my user, so when I 'connect as' from a mac, I can log in as my user and it goes straight to /shares/internal).
nano AppleVolumes.default (here you can specify exact directories and users. I didn't bother, but you can find info on google about this). Here is a great tutorial about setting up time machine to a remote disc and it covers in detail the options for netatalk shares.
http://www.kremalicious.com/2008/06/ubuntu-as-mac-file-server-and-time-machine-volume/
Setting up avahi to broadcast your box
cd /opt/etc/avahi/services
nano afpd.service
paste in this:-
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=Xserve</txt-record>
</service>
</service-group>
Save it.
This will get avahi to advertise your MyBook like it is an X-serve.
You'll see it in the Leopard side bar…..
But not until we quickly create a script in /etc/init.d in order to fire off afpd (the part of netatalk we are using) on boot up.
nano /opt/etc/init.d/S98afpd
paste in:-
#!/bin/sh
#
# Start afp daemon
#
start() {
echo "Starting afpd"
/opt/sbin/afpd -D
}
stop() {
echo "Stopping afpd"
#killall afpd > /dev/null 2>&1
/opt/sbin/afpd -k
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
cleanup)
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?
Save it.
Make it executable
chmod u+x /opt/etc/init.d/S98afpd
And finally…
nano /opt/etc/avahi-daemon.conf
Change the 'host-name' to something other than 'MyBookWorld'. If you don't and you are using Samba on your unit, things will get buggered up because the mDNS responder that advertises the Samba shares is trying to use 'MyBookWorld.local' by default, and so is avahi. Avahi wins and Smaba gets shafted.
That's it. Reboot and pray.
Works great here. Thanks again to Clifford.
Enjoy!














