Author: glen
Date: Tue Oct 23 21:30:13 2007
New Revision: 8843

Modified:
   geninitrd/trunk/functions
Log:
- we can grab the proper lvm path from lvdisplay output

Modified: geninitrd/trunk/functions
==============================================================================
--- geninitrd/trunk/functions   (original)
+++ geninitrd/trunk/functions   Tue Oct 23 21:30:13 2007
@@ -77,25 +77,9 @@
 # which they got from blkid program fs was specifed as UUID= in fstab
 dm_lvm2_name() {
        local node="$1"
-
-       # redirect output to tmpfile so we won't get subshell
-       local tmp ret
-       tmp=$(mktemp) || return 1
-
-       /sbin/lvdisplay -c 2>/dev/null | awk -F: '{print $1}' > $tmp
-       while read dev; do
-               count=$(ls -Ll $dev $node | awk '{print $5, $6}' | sort -u | wc 
-l)
-               if [ "$count" = 1 ]; then
-                       ret="$dev"
-                       break
-               fi
-       done < $tmp
-       rm -f $tmp
-
-       if [ -z "$ret" ]; then
-               ret=$node
-       fi
-       echo "$ret"
+       local dm_minor=${node#/dev/dm-}
+       local lvm_path=$(/sbin/lvdisplay -c 2>/dev/null | awk -F: -vn=$dm_minor 
'{node=$1; major=$12; minor=$13; if (n == minor) print node}')
+       echo $lvm_path
 }
 
 # try to resolve /dev/dm-0 to item from /dev/mapper dir
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to