Saturday, November 22, 2008

autofs #2

Well, I'm back from vacation... the Aspire One survived the journey well, it really is light and compact enough, that you can travel with it without noticing it. The biggest hassle was the lack of a 'global' WiFi network. In Amsterdam it costs you 10 euro's to log in... Melbourne down to $5, in Kuala Lumpur free. At cafe's and hotels a similar story, sometimes free, sometimes expensive... but you find yourself wondering is it worthwhile digging out the credit card. A 3G modem would in an ideal world avoid these hassles. In the real world, there's still the cost of global roaming, and the fact that UMTS hasn't yet completely replaced GSM. Occasionally you'll find yourself barely getting 10kbps.

Anyway back to autofs... two annoyances remain -
- I don't have a dns or mdns or zeroconfig solution on my home network
- On linpus, /etc/hosts is replaced at each boot
- autofs needs the hostname for my NAS (could be avoided using the IP address I guess)
- for some reason autofs isn't starting automatically, although chkconfig shows it configured

Well here's my somewhat ugly solution to the host name problem

[user@localhost ~]$ cat /etc/NetworkManager/dispatcher.d/02-hosts
#!/bin/bash
if [ "$2" = "up" ];
then
FOUND=`grep dlink-EEF76A /etc/hosts | wc -l`

if [ $FOUND = "0" ];
then
echo "Updating /etc/hosts"
DATE=`date`
echo "#updated by $0 at ${DATE}" >> /etc/hosts
echo "192.168.1.10 dlink-EEF76A" >> /etc/hosts
fi;
fi