Package: usbmount
Version: 0.0.17.1
Severity: wishlist
Tags: patch

Hi,

it would be very handy if usbmount supported mounting devices
by its UUID, if an appropriate fstab entry exists. This way
static mount points can be defined by something more meaningful
as the device node. I've attached a patch against the latest
source package.

Best Regards,
Patrick

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (x86_64)

Kernel: Linux 2.6.30-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages usbmount depends on:
ii  lockfile-progs                0.1.13     Programs for locking and unlocking
ii  udev                          146-3      /dev/ and hotplug management daemo

usbmount recommends no packages.

usbmount suggests no packages.

-- no debconf information

-- 
Patrick Schönfeld
Tel.: +49 (0)21 61 / 46 43-170

credativ GmbH, HRB Mönchengladbach 12080
Hohenzollernstr. 133, 41061 Mönchengladbach
Geschäftsführung: Dr. Michael Meskes, Jörg Folz
--- usbmount	2009-10-20 14:50:22.000000000 +0200
+++ ../usbmount.new	2009-10-20 15:16:47.348793236 +0200
@@ -93,7 +93,7 @@
 	exit 1
     fi
 
-    log debug "$DEVNAME"
+    UUID="`/sbin/blkid $DEVNAME|sed 's/.*UUID="\([^"]*\)".*/\1/g'`"
     # Test if the device has an /etc/fstab entry. In that case, we will
     # mount it using the regular mount command.
     if grep -q "^[ 	]*$DEVNAME" /etc/fstab; then
@@ -103,6 +103,14 @@
 	log info "executing command: mount $DEVNAME"
 	mount "$DEVNAME"
 
+    # Test if the device has an /etc/fstab entry with its UUID, in this
+    # case we will mount it with a mount command on the mount point
+    elif grep -q $UUID /etc/fstab; then
+        log debug "$DEVNAME has an /etc/fstab entry, with its UUID $UUID, using that"
+
+        MOUNT_POINT="`grep $UUID /etc/fstab|awk '{print $2}'`"
+        log info "executing command: mount $MOUNT_POINT"
+
     # Test if the device contains a filesystem.  If it doesn't, no
     # further action is required, but calling vol_id has the side effect
     # that the partition table is read and partition devices are created.

Reply via email to