]> git.pld-linux.org Git - projects/geninitrd.git/commitdiff
use stat(1) instead of ls(1) to figure out device minor node number
authorElan Ruusamäe <glen@pld-linux.org>
Wed, 27 Jul 2011 06:34:34 +0000 (06:34 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Wed, 27 Jul 2011 06:34:34 +0000 (06:34 +0000)
svn-id: @12272

functions

index 504356175d82495a2c309135e615599075d0210a..41a522f61040dd0bfdf1588e86b36c71007b469a 100644 (file)
--- a/functions
+++ b/functions
@@ -108,7 +108,7 @@ find_root() {
 # 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_lvm2_name() {
                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
 
This page took 0.034178 seconds and 4 git commands to generate.