Topic: Automatically copy music to Chumby One's flash card
Hi,
I realised I have a lot of unused flash space on my Chumby One, that I wanted to fill in some easy way. My idea was that when I inserted a usb stick with a folder named "Music" on root, it would automatically copy all music to the flash card and remove possible old music there. For this, I created the following script that I stored as /root/copymusic.sh
#!/bin/sh
FOLDER="Music"
if [ -d /mnt/usb/$FOLDER ]
then
/usr/bin/btplay /root/startsound.wav
rm -rf /mnt/storage/$FOLDER
cp -dpR /mnt/usb/$FOLDER /mnt/storage/
umount /mnt/usb
/usr/bin/btplay /root/endsound.wav
fi
and added the following udev rule to /etc/udev/rules.d/98-copymusic.rules
SUBSYSTEMS=="usb", RUN+="/root/copymusic.sh"
I also borrowed Windows XP's "Hardware Insert.wav" and "Hardware Remove.wav" (they seemed appropriate) and put them as /root/startsound.wav and endsound.wav
Now, when I insert my usb stick, I get a ding-dong, the files are copied over and then I get a dong-ding and can remove the stick again. Success!