I recently became reinterested in pogoplug devices when they seemed to have come down to a fairly reliable ten to twenty dollars for the latest models, the kind with an SD slot. They're nice little ARM-based machines with a lovely case and pads for a 3.3 volt serial port. Now I wanted to add a little basic functionality to them when running Debian.
Not long ago, I worked out the finer details of running Debian on the Pogoplug Mobile, a Series 4 pogoplug with USB 2 and no SATA. They're regularly available with the wall wart for ten dollars, so they're still a nice buy if you want to hang some USB devices out in your house someplace. The party piece of Sheevaplug-based computers is the gigabit ethernet, and even the cheapest Pogos have that. The full-fledged pogo with USB3 and SATA can be had for a mere twenty dollars now, and you can even solder a SATA connector (or cable) on to the mobile.
One of the pieces of functionality you'll miss from the otherwise generally pathetic stock pogoplug firmware is automount-and-share, a common feature for cheap consumer network-attached storage (NAS) equipment. The pogoplug is sort of the absolute lowest acceptable rung on the NAS ladder, but only if you replace the stock firmware so that you can just get down to the metal and run something real, like Debian. You could install a package to handle automounting, but you'd still need to add more configuration files to the system to get automatic file sharing via samba. If you have to do that, why not skip using usbmount or autofs and just let udev trigger scripts directly?
Searching about got me to a fairly complete auto-sharing solution based around this idea, but I decided I needed to make additional tweaks. I started with those scripts wholesale, and then added in some bits of scripts cobbled from a page on using usbmount for this task. Et voila, a working solution.
The biggest changes I made were to the samba configuration and to search for a file (called
.share) on mounted volumes before sharing them.
NOTE: This is largely untested and may cause you any sort of problems. It works here but that is not a guarantee that it will work for you.
Installation is relatively simple. Untar/gzip the archive to the root, then either move your
/etc/samba/smb.conf.master and run
/etc/samba/mkconf, or just add
include = /etc/samba/smb.include.conf to the end of your
tar xvfz automount-scripts.tar_.gz
mv /etc/samba/smb.conf /etc/samba/smb.conf.master
echo "include = /etc/samba/smb.include.conf" >> /etc/samba/smb.conf
Finally, you'll need to make sure the
/etc/samba/include.d directory is cleared on each boot.
update-rc.d auto-share-clean defaults
Now, when you insert a device with a formatted partition, it should be mounted to /media/label and if it contains (in the root) a file called ".share" then it shall also be shared via samba. Samba is reloaded when a device is added and restarted when a device is removed; see my source links for more information on the difference.