Sure :)
I have gentoo. Scripts are for USB, though when I tested them with "udevadm
trigger", it mounted hdd partitions as well, because of non effective match
part.

1. In /lib/udev 2 scripts:
script "usb_mount"
#!/bin/sh
[ "$ACTION" = "add" -a "$DEVTYPE" = "partition" ] || exit 0
#did not work for me
#[ "x$ACTION" = "xadd" -a "x$DEVTYPE" = "xpartition" -a "x$ID_BUS" = "xusb"
] || exit 0
#[ "x$ACTION" = "xadd" -a "x$DEVTYPE" = "xpartition" -a "x$SUBSYSTEMS" =
"xusb" ] || exit 0
MNTDIR=/mnt/usb/$(echo "$DEVNAME" | sed 's,\/dev\/,,')
#for tests
echo "$MNTDIR" >> /root/udev.usb
echo "$ID_BUS" >> /root/udev.usb
echo "$DEVNAME" >> /root/udev.usb
echo "$ID_FS_LABEL_ENC" >> /root/udev.usb
echo "-------" >> /root/udev.usb
chown root:disk "$DEVNAME"
chmod 0660 "$DEVNAME"
mkdir $MNTDIR
/bin/mount -t $ID_FS_TYPE  $DEVNAME $MNTDIR -o
noatime,noexec,nosuid,nodev,nodiratime,nosuid,ro,umask=0,dmask=0,fmask=111,uid=65534,gid=65534

script usb_unmount
#!/bin/sh
#[ "$ACTION" = "remove" ] && (grep -q "^$DEVNAME" /proc/mounts || grep -q
"^$DEVNAME" /etc/mtab) || exit 0
[ "$ACTION" = "remove" ] || exit 0
#device name with 2 // - e.g. //dev/ubb1
MNTDEV=$(echo "$DEVNAME" | sed 's,\/\/,\/,')
MNTDIR=/mnt/usb/$(echo "$DEVNAME" | sed 's,\/dev\/,,')
#echo "Unmount" >> /root/udev.usb
#echo "$MNTDEV" >>  /root/udev.usb
#echo "$MNTDIR" >>  /root/udev.usb
#echo "-------" >>  /root/udev.usb
/bin/umount -l "$MNTDEV"
rmdir "$MNTDIR"

2. modify /lib/udev/rules.d/60-persistent-storage.rules - I commented out
original line and added extra line
#ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*",
SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"
ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*",
SYMLINK+="disk/by-path/$env{ID_PATH}-part%n", RUN+="/lib/udev/usb_mount",
ENV{REMOVE_CMD}="/lib/udev/usb_unmount"

3. I added /mnt/usb in Freevo music/movie etc parts.

Lines with comments can be removed. Echos just for tests.
I believe there should be more effective match in ACTION part, but I'm not
really udev guru :) If you find something which works, post it back, it
would be interesting.

Reggie
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Freevo-users mailing list
Freevo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-users

Reply via email to