]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
ddf tests: fix get_rootdev
authorNeilBrown <neilb@suse.de>
Tue, 19 Nov 2013 05:40:09 +0000 (16:40 +1100)
committerNeilBrown <neilb@suse.de>
Tue, 19 Nov 2013 05:40:09 +0000 (16:40 +1100)
Getting the major number from the hex device number should take
all-but-the-last-two digits, rather than just the first two digits.

Signed-off-by: NeilBrown <neilb@suse.de>
tests/env-ddf-template

index c0a4b71364451dceccc7c856f64d69c3fa9d3d72..90d7272f9cd52c1969f73de3ac25335c12bc262f 100644 (file)
@@ -4,7 +4,7 @@ sha1_sum() {
 
 get_rootdev() {
     local dev=$(stat -c %D /)
-    local maj=$(expr $dev : '\(..\)')
+    local maj=$(expr $dev : '\(..*\)..')
     local min=${dev#$maj}
     local bd=/dev/$(basename $(readlink /sys/dev/block/$((0x$maj)):$((0x$min))))
     [ -b $bd ] || exit 1