diff options
Diffstat (limited to 'packages/udev/files/mount.sh')
-rw-r--r-- | packages/udev/files/mount.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/packages/udev/files/mount.sh b/packages/udev/files/mount.sh new file mode 100644 index 0000000000..7e641b08d7 --- /dev/null +++ b/packages/udev/files/mount.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# +# Called from udev +# Attemp to mount any added block devices +# and remove any removed devices +# + +MOUNT="/bin/mount" +PMOUNT="/usr/bin/pmount" +UMOUNT="/bin/umount" + +if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ]; then + if [ -x "$PMOUNT" ]; then + $PMOUNT $DEVNAME 2> /dev/null + elif [ -x $MOUNT ]; then + $MOUNT $DEVNAME 2> /dev/null + fi +fi + +if [ "$ACTION" = "remove" ] && [ -x "$UMOUNT" ] && [ -n "$DEVNAME" ]; then + for mnt in `cat /proc/mounts | grep "$DEVNAME" | cut -f 2 -d " " ` + do + $UMOUNT $mnt + done +fi |