Zaurus SD Autostart
Posted by Trejkaz Tue, 11 Jan 2005 06:32:00 GMT
I wanted to set up stuff to run automatically when the SD card is inserted. One of the reasons for this was a Zaurus Wikipedia install, as I wanted it to mount the wikipedia when the card was inserted and unmount it as it was ejected.
The modifications in question need to be done to /etc/sdcontrol. So fire up vi, and make the following changes:
The following goes right after the swapfile handling in the ‘insert’ section:
if [ -d ${MOUNT_POINT}/.autostart/ ]; then
for f in ${MOUNT_POINT}/.autostart/* ; do
if [ -x $f ]; then
$f start
fi
done
fi
And the following does right before the swapfile handling in the ‘eject’ section:
if [ -d ${MOUNT_POINT}/.autostart/ ]; then
for f in ${MOUNT_POINT}/.autostart/* ; do
if [ -x $f ]; then
$f stop
fi
done
fi
As you can probably gather from the code, this looks for a directory called “.autostart” in the root of the SD card. When the “.autostart” directory has been found, it looks for executable files in that directory. I would have used run-parts here, only it doesn’t seem to be provided with the default Busybox.
On a FAT filesystem on the Zaurus, everything is executable, which can be trouble