LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] mounting a camera to the desktop

[ILUG] mounting a camera to the desktop

Kae Verens kae at verens.com
Sat Sep 18 08:57:17 IST 2004


Here's an adaptation of Kevin's camera mounting script, which creates a 
unique (ish) directory on your desktop and dumps the files there.

Blogged here: 
http://verens.com/archives/2004/09/17/automatically-dumping-your-camera-contents-to-the-desktop/

Assumes you use KDE, and have a /mnt/sda1 directory. Adapt as needed.

#!/bin/sh

logger -t usb-storage "Starting"

case x"$ACTION" in

     xadd)
         # from usb/usbcam
         # new code, using GNU style parameters
         if [ -f /var/run/console.lock ]; then
             CONSOLEOWNER=`cat /var/run/console.lock`
         elif [ -f /var/lock/console.lock ]; then
             CONSOLEOWNER=`cat /var/lock/console.lock`
         else
             logger -t usb-storage No console owner found
             exit
         fi

         logger -t usb-storage "Mounting camera"
         mount -t vfat /dev/sda1 /mnt/sda1
         logger -t usb-storage "Camera mounted, copying files"

         # generate a unique-ish directory
         suffix=$(date +%Y.%m.%d-%H.%M)
         prefix="camera_"
         NEWDIR=$prefix$suffix

         mkdir /home/$CONSOLEOWNER/Desktop/$NEWDIR -p
         find /mnt/sda1/dcim -type f -print0 | xargs -0i mv '{}' 
/home/$CONSOLEOWNER/Desktop/$NEWDIR
         chown $CONSOLEOWNER.$CONSOLEOWNER 
/home/$CONSOLEOWNER/Desktop/$NEWDIR -R
         umount /mnt/sda1

         echo -e '\007' > /dev/console; sleep 1
         echo -e '\007' > /dev/console; sleep 1
         echo -e '\007' > /dev/console

         test -d /var/run/usb || mkdir /var/run/usb
         ( echo '#!/bin/sh' ; echo rmmod usb-storage ) > $REMOVER
         chmod 755 $REMOVER
         ;;

esac

logger -t usb-storage "Finishing"



More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell