summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/udev/mount-usb
diff options
context:
space:
mode:
authorBob Igo <bob@stormlogic.com>2009-08-25 16:17:55 (GMT)
committerBob Igo <bob@stormlogic.com>2009-08-25 16:17:55 (GMT)
commitac8a679dad17bc7448d4229f68f5e5c6c703e798 (patch)
treeddf72fcf8dd0e1e3600d3daa58305bbcea3be913 /abs/core-testing/udev/mount-usb
parent8a9438599b6a623814702b625d11a96e8bbdad69 (diff)
parent6ba090f1282f7a34d5ae396ef4b15610cd22f1c0 (diff)
downloadlinhes_pkgbuild-ac8a679dad17bc7448d4229f68f5e5c6c703e798.zip
linhes_pkgbuild-ac8a679dad17bc7448d4229f68f5e5c6c703e798.tar.gz
linhes_pkgbuild-ac8a679dad17bc7448d4229f68f5e5c6c703e798.tar.bz2
Merge branch 'master' of ssh://knoppmyth.net/mount/repository/LinHES-PKGBUILD
Diffstat (limited to 'abs/core-testing/udev/mount-usb')
-rw-r--r--abs/core-testing/udev/mount-usb51
1 files changed, 51 insertions, 0 deletions
diff --git a/abs/core-testing/udev/mount-usb b/abs/core-testing/udev/mount-usb
new file mode 100644
index 0000000..2d3b3f5
--- /dev/null
+++ b/abs/core-testing/udev/mount-usb
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+
+DIR=/media
+DEVICE=$2
+LABEL=`/lib/udev/vol_id -L /dev/$DEVICE`
+FS=`/lib/udev/vol_id -t /dev/$DEVICE`
+
+
+mount_device () {
+ if [ "$LABEL" == "" ];
+ then
+ mkdir -p $DIR/usb-$DEVICE
+ case $FS in
+ vfat) /bin/mount -t vfat -o rw,noauto,flush,quiet,nodev,nosuid,noexec,noatime,dmask=000,fmask=111 /dev/$DEVICE $DIR/usb-$DEVICE
+ ;;
+ *) /bin/mount -t auto -o rw,noauto,sync,dirsync,noexec,nodev,noatime /dev/$DEVICE $DIR/usb-$DEVICE
+ ;;
+ esac
+ else
+ mkdir -p $DIR/$LABEL
+ echo $LABEL >$DIR/.$DEVICE
+ case $FS in
+ vfat) /bin/mount -t vfat -o rw,noauto,flush,quiet,nodev,nosuid,noexec,noatime,dmask=000,fmask=111 /dev/$DEVICE $DIR/$LABEL
+ ;;
+ *) /bin/mount -t auto -o rw,noauto,sync,dirsync,noexec,nodev,noatime /dev/$DEVICE $DIR/$LABEL
+ ;;
+ esac
+ fi
+}
+
+umount_device () {
+ if [ -e $DIR/usb-$DEVICE ];
+ then
+ umount -l $DIR/usb-$DEVICE
+ rmdir $DIR/usb-$DEVICE;
+ else
+ ULABEL=`cat $DIR/.$DEVICE`
+ umount -l $DIR/$ULABEL
+ rmdir $DIR/$ULABEL
+ rm $DIR/.$DEVICE;
+ fi
+}
+
+case $1 in
+ mount) mount_device
+ ;;
+ umount) umount_device
+ ;;
+ *) echo "Usage: mount-usb mount/umount sdxY"
+esac