diff options
author | Cecil Hugh Watson <knoppmyth@gmail.com> | 2009-09-26 01:57:08 (GMT) |
---|---|---|
committer | Cecil Hugh Watson <knoppmyth@gmail.com> | 2009-09-26 01:57:08 (GMT) |
commit | 7b29169fff9e7c624890c5edffe85def8a293136 (patch) | |
tree | 47753889faa3a2063b66d1c7e7681e703eb1b39a /abs/core/udev/mount-usb | |
parent | c491dea779dac29afff3578bf8245943817c2339 (diff) | |
download | linhes_pkgbuild-7b29169fff9e7c624890c5edffe85def8a293136.zip linhes_pkgbuild-7b29169fff9e7c624890c5edffe85def8a293136.tar.gz linhes_pkgbuild-7b29169fff9e7c624890c5edffe85def8a293136.tar.bz2 |
LinHES 6.01.00
Diffstat (limited to 'abs/core/udev/mount-usb')
-rw-r--r-- | abs/core/udev/mount-usb | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/abs/core/udev/mount-usb b/abs/core/udev/mount-usb new file mode 100644 index 0000000..2d3b3f5 --- /dev/null +++ b/abs/core/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 |