The only relevant linux UPnP-client is djmount, also used in GeexBox. It is quite primitive: the UPnP devices are mounted as a filesystem. There are no debian packages available for djmount; you have to build it from the sources. The best copy/paste scenario for installing djmount on ubuntu is http://linuxowns.wordpress.com/2008/06/05/accessing-upnp-server-from-ubuntu/.
Unfortunately the last step '6', ie. autorunning djmount at logon doesn't work -- at least under Ubuntu 8.04. If you have a wlan, djmount fails when no network is up. As a comment by 'anonymous' points out, the Ubuntu NetworkManager fires the /etc/NetworkManager/dispatcher.d/01ifupdown script that runs (with run-parts) all scripts in /etc/network/if-up.d under root.
The following steps do work for autostarting djmount under ubuntu:
cd /etc/network/if-up.dDjmount is now (re)mounted whenever the network is up. As stated previously, djmount is a very rudimentary solution because Rhythmbox for example will parse and analyse all mp3s again. Maybe the linux mediaplayers will integrate some of the existing UPnP Libraries in the future. This would be a welcome addition. I'm still hesitating between using djmount or using regular samba-mounts on my laptop.
gksudo gedit ./djmountcontents of script:sudo chmod 755 ./djmount
#!/bin/sh
# Not for loopback!
[ "$IFACE" != "lo" ] || exit 0
modprobe fuse
fusermount -u /media/upnp
djmount -o allow_other /media/upnp
sudo chown root ./djmount
sudo chgrp root ./djmount
update 7/7/2008 : This fixed version runs djmount after the network is connected. No need for setuid or "sleep 30" anymore. (*)
(*) to remove the old version of the scripts this post in its first form suggested, you must:
- remove the upnp action from the System/Preferences/Sessions
- sudo rm -f /usr/local/bin/djmount.sh
- sudo chmod u-s /usr/local/bin/djmount
- sudo chmod g-s /usr/local/bin/djmount
look at/etc/NetworkManager/dispatcher.d/01ifupdown for network event hooks
ReplyDeleteGreat tip. I suspect I'll have to put the djmount script in /etc/network/if-up.d/.
ReplyDeleteI'll try it out & report back.