[Usbmount-commit] r18 - in trunk/usbmount: . debian

Martin Dickopp mdickopp-guest@costa.debian.org
Thu, 07 Apr 2005 17:07:13 +0000


Author: mdickopp-guest
Date: 2005-04-07 17:07:12 +0000 (Thu, 07 Apr 2005)
New Revision: 18

Modified:
   trunk/usbmount/debian/changelog
   trunk/usbmount/usbmount
Log:
* When a partition (as opposed to a partition-less device) is mounted,
  an underscore and the partition number are appended to the model
  symlink.
* Acquire lock before 'udev_volume_id' is called. This causes the
  partitions (on a device with more than one partition) to be mounted in
  the right order.
* Fixed typos in log messages.


Modified: trunk/usbmount/debian/changelog
===================================================================
--- trunk/usbmount/debian/changelog	2005-04-07 09:03:16 UTC (rev 17)
+++ trunk/usbmount/debian/changelog	2005-04-07 17:07:12 UTC (rev 18)
@@ -1,3 +1,15 @@
+usbmount (0.0.10) unstable; urgency=low
+
+  * When a partition (as opposed to a partition-less device) is mounted,
+    an underscore and the partition number are appended to the model
+    symlink.
+  * Acquire lock before 'udev_volume_id' is called. This causes the
+    partitions (on a device with more than one partition) to be mounted in
+    the right order.
+  * Fixed typos in log messages.
+
+ --
+
 usbmount (0.0.9) unstable; urgency=low
 
   * Upload sponsored by Rafael Laboissiere.

Modified: trunk/usbmount/usbmount
===================================================================
--- trunk/usbmount/usbmount	2005-04-07 09:03:16 UTC (rev 17)
+++ trunk/usbmount/usbmount	2005-04-07 17:07:12 UTC (rev 18)
@@ -55,25 +55,26 @@
 	|| readlink "/sys$DEVPATH/../device" | grep -q /usb; then
 	log debug "$DEVNAME is a USB device"
 
+	# Acquire lock.
+	log debug "trying to acquire lock /var/run/usbmount/.mount.lock"
+	lockfile-create --retry 3 /var/run/usbmount/.mount || \
+	    { log err "cannot acquire lock /var/run/usbmount/.mount.lock"; exit 1; }
+	trap '( lockfile-remove /var/run/usbmount/.mount )' 0
+	log debug "acquired lock /var/run/usbmount/.mount.lock"
+
 	# Test if the device contains a filesystem.  If it doesn't, no
 	# further action is required, but calling udev_volume_id has the
 	# side effect that the partition table is read and partition
 	# devices are created.
 	if /sbin/udev_volume_id "$DEVNAME" | egrep -q '^F:(filesystem|disklabel)$'; then
-	    log debug "$DEVNAME containes a filesystem or disklabel"
+	    log debug "$DEVNAME contains a filesystem or disklabel"
 
 	    fstype="`/sbin/udev_volume_id -t \"$DEVNAME\"`"
-	    log debug "$DEVNAME containes filesystem type $fstype"
+	    log debug "$DEVNAME contains filesystem type $fstype"
 
 	    # Test if the filesystem type is in the list of filesystem
 	    # types to mount.
 	    if in_list "$fstype" "$FILESYSTEMS"; then
-		# Acquire lock.
-		log debug "trying to acquire lock /var/run/usbmount/.mount.lock"
-		lockfile-create --retry 3 /var/run/usbmount/.mount || \
-		    { log error "cannot acquire lock /var/run/usbmount/.mount.lock"; exit 1; }
-		trap '( lockfile-remove /var/run/usbmount/.mount )' 0
-		log debug "acquired lock /var/run/usbmount/.mount.lock"
 
 		# Search an available mountpoint.
 		for v in $MOUNTPOINTS; do
@@ -112,8 +113,13 @@
 		    elif test -r "/sys$DEVPATH/../device/model"; then
 			model="`cat \"/sys$DEVPATH/../device/model\"`"
 		    fi
-		    model="`echo \"$model\" | sed 's/^[ 	]*//; s/[ 	]*$//; s/[ 	]/_/g; s/[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-]//g'`"
-		    if test "$model" != ""; then
+		    model="`echo \"$model\" | sed 's/^[ 	]*//; s/[ 	]*$//; s/[ 	]/_/g; s/[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-]//g; s/^\.*//'`"
+		    if test -n "$model" && test -r "/sys$DEVPATH/../device/model"; then
+			# Append partition number to model name.
+			partnumber="`echo \"$DEVNAME\" | sed 's/^.*[^0123456789]\([0123456789]*\)$/\1/'`"
+			model="$model${partnumber:+_$partnumber}"
+		    fi
+		    if test -n "$model"; then
 			if ! test -e "/var/run/usbmount/$model"; then
 			    log info "creating symlink /var/run/usbmount/$model -> $mountpoint"
 			    ln -sf "$mountpoint" "/var/run/usbmount/$model"