package/xfont_font-cronyx-cyrillic: add hash file
[buildroot-gz.git] / package / usbmount / 0002-use-udev-environment-instead-of-blkid.patch
blob27928b5d54c6ddf6f21101efc5a08ad9cc7c0eaa
1 udev can provide all the values that usbmount determined using the
2 blkid binary. This patch drops use of blkid in favor of using the
3 environment variables set by udev. Thus it removes the dependency
4 on blkid from usbmount.
6 Signed-off-by: Sven Neumann <s.neumann@raumfeld.com>
7 --- usbmount-0.0.22/usbmount.orig 2013-06-18 14:44:40.143096147 +0200
8 +++ usbmount-0.0.22/usbmount 2013-06-19 16:13:09.882434896 +0200
9 @@ -59,11 +59,6 @@
10 exit 0
13 -if [ ! -x /sbin/blkid ]; then
14 - log err "cannot execute /sbin/blkid"
15 - exit 1
16 -fi
18 # Per Policy 9.3.2, directories under /var/run have to be created
19 # after every reboot.
20 if [ ! -e /var/run/usbmount ]; then
21 @@ -83,15 +78,7 @@
22 trap '( lockfile-remove /var/run/usbmount/.mount )' 0
23 log debug "acquired lock /var/run/usbmount/.mount.lock"
25 - # Grab device information from device and "divide it"
26 - # FIXME: improvement: implement mounting by label (notice that labels
27 - # can contain spaces, which makes things a little bit less comfortable).
28 - DEVINFO=$(/sbin/blkid -p $DEVNAME)
29 - FSTYPE=$(echo "$DEVINFO" | sed 's/.*[[:blank:]]TYPE="\([^"]*\)".*/\1/g; s/[[:blank:]]*//g;')
30 - UUID=$(echo "$DEVINFO" | sed 's/.*[[:blank:]]UUID="\([^"]*\)".*/\1/g; s/[[:blank:]]*//g;')
31 - USAGE=$(echo "$DEVINFO" | sed 's/.*[[:blank:]]USAGE="\([^"]*\)".*/\1/g; s/[[:blank:]]*//g;')
33 - if ! echo $USAGE | egrep -q "(filesystem|disklabel)"; then
34 + if ! echo $ID_FS_USAGE | egrep -q "(filesystem|disklabel)"; then
35 log info "$DEVNAME does not contain a filesystem or disklabel"
36 exit 1
38 @@ -101,14 +88,14 @@
39 log info "executing command: mount $DEVNAME"
40 mount $DEVNAME || log err "mount by DEVNAME with $DEVNAME wasn't successful; return code $?"
42 - elif grep -q "^[[:blank:]]*UUID=$UUID" /etc/fstab; then
43 - log info "executing command: mount -U $UUID"
44 - mount -U $UUID || log err "mount by UUID with $UUID wasn't successful; return code $?"
45 + elif grep -q "^[[:blank:]]*UUID=$ID_FS_UUID" /etc/fstab; then
46 + log info "executing command: mount -U $ID_FS_UUID"
47 + mount -U $ID_FS_UUID || log err "mount by UUID with $ID_FS_UUID wasn't successful; return code $?"
49 else
50 - log debug "$DEVNAME contains filesystem type $FSTYPE"
51 + log debug "$DEVNAME contains filesystem type $ID_FS_TYPE"
53 - fstype=$FSTYPE
54 + fstype=$ID_FS_TYPE
55 # Test if the filesystem type is in the list of filesystem
56 # types to mount.
57 if in_list "$fstype" "$FILESYSTEMS"; then
58 @@ -176,11 +163,13 @@
60 # Run hook scripts; ignore errors.
61 export UM_DEVICE="$DEVNAME"
62 + export UM_UUID="$ID_FS_UUID"
63 export UM_MOUNTPOINT="$mountpoint"
64 export UM_FILESYSTEM="$fstype"
65 export UM_MOUNTOPTIONS="$options"
66 export UM_VENDOR="$vendor"
67 export UM_MODEL="$model"
68 + export UM_LABEL="$ID_FS_LABEL"
69 log info "executing command: run-parts /etc/usbmount/mount.d"
70 run-parts /etc/usbmount/mount.d || :
71 else