summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--abs/core-testing/udev/PKGBUILD10
-rw-r--r--abs/core-testing/udev/__changelog1
-rw-r--r--abs/core-testing/udev/mount-usb51
-rw-r--r--abs/core-testing/udev/usb-storage.rules11
4 files changed, 63 insertions, 10 deletions
diff --git a/abs/core-testing/udev/PKGBUILD b/abs/core-testing/udev/PKGBUILD
index cd1a312..1acfb02 100644
--- a/abs/core-testing/udev/PKGBUILD
+++ b/abs/core-testing/udev/PKGBUILD
@@ -4,7 +4,7 @@
# Maintainer: Thomas Bächler <thomas@archlinux.org>
pkgname=udev
pkgver=135
-pkgrel=5
+pkgrel=6
pkgdesc="The userspace dev tools (udev)"
arch=(i686 x86_64)
url="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html"
@@ -24,7 +24,7 @@ conflicts=('initscripts<2008.02')
options=(!makeflags)
source=(http://www.kernel.org/pub/linux/utils/kernel/hotplug/$pkgname-$pkgver.tar.bz2
81-arch.rules load-modules.sh resolve-modalias.c cdsymlinks.sh root-link.sh
- arch-udev-rules.patch readme-udev-arch.txt usb-storage.rules udev-ntfs-3g.patch)
+ arch-udev-rules.patch readme-udev-arch.txt usb-storage.rules udev-ntfs-3g.patch mount-usb)
md5sums=('661b9df34e1304dad10f595d95b472bb'
'3a955ca8e2122a48a223f9d8adf87b70'
'f4951f61438d69894b728212dac7318b'
@@ -48,7 +48,11 @@ build() {
# Non-stock rules still go in /etc
install -D -m644 $srcdir/81-arch.rules $pkgdir/etc/udev/rules.d/81-arch.rules
-# install -D -m644 $srcdir/usb-storage.rules $pkgdir/etc/udev/rules.d/usb-storage.rules
+ install -D -m644 $srcdir/usb-storage.rules $pkgdir/etc/udev/rules.d/usb-storage.rules
+
+ # Scripts needed
+ mkdir $pkgdir/etc/udev/scripts
+ install -D -m744 $srcdir/mount-usb $pkgdir/etc/udev/scripts
# install our module loading subsystem
install -D -m755 $srcdir/load-modules.sh $pkgdir/lib/udev/load-modules.sh
diff --git a/abs/core-testing/udev/__changelog b/abs/core-testing/udev/__changelog
new file mode 100644
index 0000000..7e00323
--- /dev/null
+++ b/abs/core-testing/udev/__changelog
@@ -0,0 +1 @@
+Added usb-storage.rule and script to un/mount USB drives.
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
diff --git a/abs/core-testing/udev/usb-storage.rules b/abs/core-testing/udev/usb-storage.rules
index 97cdca3..86eca8e 100644
--- a/abs/core-testing/udev/usb-storage.rules
+++ b/abs/core-testing/udev/usb-storage.rules
@@ -1,7 +1,4 @@
-KERNEL=="sd[a-z]", NAME="%k", SYMLINK+="usb%m", GROUP="users", OPTIONS="last_rule"
-ACTION=="add", KERNEL=="sd[a-z][0-9]", SYMLINK+="usb%n", GROUP="users", NAME="%k"
-ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/bin/mkdir -p /media/usb%n"
-ACTION=="add", KERNEL=="sd[a-z][0-9]", PROGRAM=="/lib/udev/vol_id -t %N", RESULT=="vfat", RUN+="/bin/mount -t vfat -o rw,noauto,flush,quiet,nodev,nosuid,noexec,noatime,dmask=000,fmask=111 /dev/%k /media/usb%n", OPTIONS="last_rule"
-ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/bin/mount -t auto -o rw,noauto,sync,dirsync,noexec,nodev,noatime /dev/%k /media/usb%n", OPTIONS="last_rule"
-ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/bin/umount -l /media/usb%n"
-ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/bin/rmdir /media/usb%n", OPTIONS="last_rule"
+SUBSYSTEMS=="usb", KERNEL=="sd[b-z]", NAME="%k", SYMLINK+="usb-%k", GROUP="users", OPTIONS="last_rule"
+ACTION=="add", SUBSYSTEMS=="usb", KERNEL=="sd[b-z][0-9]", SYMLINK+="usb-%k", GROUP="users", NAME="%k"
+ACTION=="add", SUBSYSTEMS=="usb", KERNEL=="sd[b-z][0-9]", RUN+="/etc/udev/scripts/mount-usb mount %k", OPTIONS="last_rule"
+ACTION=="remove", SUBSYSTEMS=="usb", KERNEL=="sd[b-z][0-9]", RUN+="/etc/udev/scripts/mount-usb umount %k", OPTIONS="last_rule"#