[Usbmount-commit] r68 - usbmount/trunk

Rogério Brito rbrito-guest at alioth.debian.org
Mon Oct 26 17:47:58 UTC 2009


Author: rbrito-guest
Date: 2009-10-26 17:47:57 +0000 (Mon, 26 Oct 2009)
New Revision: 68

Modified:
   usbmount/trunk/usbmount
Log:
More use of character classes.


Modified: usbmount/trunk/usbmount
===================================================================
--- usbmount/trunk/usbmount	2009-10-26 17:34:36 UTC (rev 67)
+++ usbmount/trunk/usbmount	2009-10-26 17:47:57 UTC (rev 68)
@@ -68,7 +68,7 @@
     exit 1
 fi
 
-# Per Policy 9.3.2, directories under /var/run/usbmount have to be checked
+# Per Policy 9.3.2, directories under /var/run have to be created
 # after every reboot.
 if [ ! -e /var/run/usbmount ]; then
     mkdir -p /var/run/usbmount
@@ -90,9 +90,9 @@
     #   FIXME: improvement: implement mounting by label (notice that labels
     #   can contain spaces, which makes things a little bit less comfortable).
     DEVINFO=$(/sbin/blkid -p $DEVNAME)
-    FSTYPE=$(echo "$DEVINFO" | sed -e 's/.*TYPE="\([^"]*\)".*/\1/g; s/\s*//g;')
-    UUID=$(echo "$DEVINFO"   | sed -e 's/.*UUID="\([^"]*\)".*/\1/g; s/\s*//g;')
-    USAGE=$(echo "$DEVINFO"  | sed -e 's/.*USAGE="\([^"]*\)".*/\1/g; s/\s*//g;')
+    FSTYPE=$(echo "$DEVINFO" | sed 's/.*TYPE="\([^"]*\)".*/\1/g; s/[[:space:]]*//g;')
+    UUID=$(echo "$DEVINFO"   | sed 's/.*UUID="\([^"]*\)".*/\1/g; s/[[:space:]]*//g;')
+    USAGE=$(echo "$DEVINFO"  | sed 's/.*USAGE="\([^"]*\)".*/\1/g; s/[[:space:]]*//g;')
 
     if ! echo $USAGE | egrep -q "(filesystem|disklabel)"; then
 	log info "$DEVNAME does not contain a filesystem or disklabel"
@@ -152,7 +152,7 @@
 		elif [ -r "/sys$DEVPATH/../device/../manufacturer" ]; then
 		    vendor="`cat \"/sys$DEVPATH/../device/../manufacturer\"`"
 		fi
-		vendor="`echo \"$vendor\" | sed 's/^ *//; s/ *$//'`"
+		vendor="$(echo "$vendor" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')"
 		
 		model=
 		if [ -r "/sys$DEVPATH/device/model" ]; then
@@ -164,7 +164,7 @@
 		elif [ -r "/sys$DEVPATH/../device/../product" ]; then
 		    model="`cat \"/sys$DEVPATH/../device/../product\"`"
 		fi
-		model="`echo \"$model\" | sed 's/^ *//; s/ *$//'`"
+		model="$(echo "$model" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')"
 		
 		# Run hook scripts; ignore errors.
 		export UM_DEVICE="$DEVNAME"




More information about the Usbmount-commit mailing list