SVN: geninitrd/trunk/functions

glen glen at pld-linux.org
Wed Jul 27 08:34:34 CEST 2011


Author: glen
Date: Wed Jul 27 08:34:34 2011
New Revision: 12272

Modified:
   geninitrd/trunk/functions
Log:
use stat(1) instead of ls(1) to figure out device minor node number

Modified: geninitrd/trunk/functions
==============================================================================
--- geninitrd/trunk/functions	(original)
+++ geninitrd/trunk/functions	Wed Jul 27 08:34:34 2011
@@ -108,7 +108,7 @@
 # which they got from blkid program fs was specifed as UUID= in fstab
 dm_lvm2_name() {
 	local node="$1"
-	local dm_minor
+	local dm_minor stat
 
 	if [ ! -b "$node" ]; then
 		echo >&2 "dm_lvm2_name: $node is not a block device"
@@ -120,7 +120,8 @@
 		dm_minor=${node#/dev/dm-}
 		;;
 	/dev/mapper/*)
-		dm_minor=$(ls -lL $node | awk '{print $6}')
+		stat=$(stat -L --format=%T "$node") || die "stat failed: $node"
+		dm_minor=$((0x$stat))
 	;;
 	esac
 


More information about the pld-cvs-commit mailing list