From 864870e814560a7f0915444fb23d4a223dddc25e Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Tue, 23 Jun 2009 21:11:53 -0700
Subject: Allows for auto mounting of USB storage devices in /media/usb%.

---
 abs/core-testing/udev/PKGBUILD          | 8 +++++---
 abs/core-testing/udev/usb-storage.rules | 7 +++++++
 2 files changed, 12 insertions(+), 3 deletions(-)
 create mode 100644 abs/core-testing/udev/usb-storage.rules

diff --git a/abs/core-testing/udev/PKGBUILD b/abs/core-testing/udev/PKGBUILD
index f24e308..bd4c394 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=1
+pkgrel=2
 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)
+        arch-udev-rules.patch readme-udev-arch.txt usb-storage.rules)
 md5sums=('661b9df34e1304dad10f595d95b472bb'
          '3a955ca8e2122a48a223f9d8adf87b70'
          'f4951f61438d69894b728212dac7318b'
@@ -32,7 +32,8 @@ md5sums=('661b9df34e1304dad10f595d95b472bb'
          '8424b78e9dd772e75b4ef90814807815'
          '2d6dc6842464f107bccc68cd505a6c31'
          'ae216c26a6a5cae4a3ef9c0e1f7bfaa6'
-         '7fc6d33bb218e752302eef0a80ff0a89')
+         '7fc6d33bb218e752302eef0a80ff0a89'
+	 '11eaec41b77746f50975d4ef834c8f83')
 
 build() {
   cd $srcdir/$pkgname-$pkgver
@@ -46,6 +47,7 @@ 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 our module loading subsystem
   install -D -m755 $srcdir/load-modules.sh $pkgdir/lib/udev/load-modules.sh
diff --git a/abs/core-testing/udev/usb-storage.rules b/abs/core-testing/udev/usb-storage.rules
new file mode 100644
index 0000000..97cdca3
--- /dev/null
+++ b/abs/core-testing/udev/usb-storage.rules
@@ -0,0 +1,7 @@
+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"
-- 
cgit v0.12

