Hello I'm using udev+hotplug+simple script to mount/umount devices (camera and 
usb-key) on gentoo base freevo box for automount/unmount. 

see 
http://forums.gentoo.org/viewtopic-t-113911-highlight-remove+usbstorage+hotplug.html
where I starts to, but I changed scripts a bit ....

With help of udev every time I put in usb-key  /dev/key is created 
(or /dev/foto for camera) no matter in which order.

in
/etc/udev/rules.d/10-udev.rules
I have
BUS="usb", SYSFS{serial}="Y-364^^^^^020528XFJX0011009253", KERNEL="sd?1", 
NAME="+%k", SYMLINK="foto"
BUS="usb", SYSFS{product}="USB Mass Storage Device", KERNEL="sd?1", NAME="%k", 
SYMLINK="key"

use udevinfo on device you want to create symlink  - will help you to find 
specific values which you have to write to the file
#udevinfo -a -p /sys/block/sda/sda1


with help of hotplug when usb-storage module is used 
script  /usr/hotplug/usb/usb-storage is started, then I case which device was 
added, mount it and crete the script which will unmount device when removed
>>>>>
#!/bin/bash
logger "$0: usb-key - ACTION $ACTION REMOVER $REMOVER PRODUCT $PRODUCT DEVPATH 
$DEVPATH INTERFACE $INTERFACE TYPE $TYPE DEVFS $DEV+FS DEVICE $DEVICE"

case "$PRODUCT" in
   4cb/10a/1000) # Fuji camera
   logger "`basename $0`: Mounting Fuji camera"
   MOUNTPOINT="/mnt/foto"
   MOUNTDEV="/dev/foto"
   ;;
esac
case "$PRODUCT" in
   67b/2517/1) # USB stick
   logger "`basename $0`: Mounting Agenie USB stick"
   MOUNTPOINT="/mnt/key"
   MOUNTDEV="/dev/key"
   ;;
esac

#mounter - I must run in in background
/usr/local/bin/usb-udev-mount $MOUNTDEV $MOUNTPOINT &

#creating REMOVER
echo "#!/bin/bash" > $REMOVER
echo "logger \"\`basename $0\`: unmounting $MOUNTDEV \"" >>$REMOVER
echo "/bin/umount $MOUNTPOINT" >> $REMOVER

chmod +x $REMOVER
<<<<
/usr/local/bin/usb-udev-mount contains
>>>>>>>
#!/bin/bash
MOUNTDEV=$1
MOUNTPOINT=$2
FS=auto

logger "`basename $0`: $MOUNTDEV $MOUNTPOINT "

#wait for the dev/sd* to be created
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13
do
   if [ -e $MOUNTDEV ]
      then
         logger "`basename $0`: $I s to found $MOUNTDEV "
         break
   fi
   sleep 1
   #logger "`basename $0`: $I"
done

if [ -e $MOUNTDEV ]
   then
      logger "`basename $0`: Mounting $MOUNTDEV at $MOUNTPOINT "
   else
      logger "`basename $0`: ERROR $MOUNTDEV not found "
   exit
fi

mkdir -p $MOUNTPOINT

CMD="mount $MOUNTDEV  $MOUNTPOINT -t $FS -o 
uid=freevo,gid=users,sync,fmask=113,dmask=002"
logger "`basename $0`: $CMD"
`$CMD`
<<<<<<<<

and finaly I have to change one line in /etc/hotplug/usb.agent
(found here 
http://forums.gentoo.org/viewtopic-t-267145-highlight-remove+usbstorage+hotplug.html)

So my devices are mounted every time in correct places, no matter in which 
order connected/disconnected, and unmounted after remove.

That freevo/gentoo independed, but very usable :-). The freevo plugin 
usbstorage works with only one problem - it shows both directoris when one 
device is connected..

Bye Tonous

On Thursday 03 of March 2005 18:46, Eric Jorgensen wrote:
> On Thu, 03 Mar 2005 06:52:59 +0000
>
> Karl Lattimer <[EMAIL PROTECTED]> wrote:
> > I'm gonna be writing ipod sync scripts anyway just to make my life
> > easier so there's my contribution. I'm not sure about the automounter,
> > although would magicdev do this?? or is it closer to hal?
>
>    the hotplug daemon can do this sort of thing. you could also use a
> kernel automounter.
>
>    In life, you find it's not the mount but the umount that gets ya.
>
>    Let me know what you come up with, I've considered doing something like
> this for my cheezy MuVo2, which has the crummiest UI on earth, and thus
> needs a static playlist - something I've never bothered to use with my
> iriver slim-x.
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Freevo-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/freevo-users


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Freevo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-users

Reply via email to