]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut-functions: use /proc/self/mountinfo, instead of /proc/mounts
authorHarald Hoyer <harald@redhat.com>
Thu, 5 Aug 2010 16:59:51 +0000 (18:59 +0200)
committerHarald Hoyer <harald@redhat.com>
Thu, 5 Aug 2010 16:59:51 +0000 (18:59 +0200)
1. it's easier to get the major:minor
2. it's more failsafe in a chroot() (rescue CD case)

dracut-functions

index c9affc7448079c4a18683d64bc4b1d6cd8d9525e..f53d5e343ce28e0a7d0b5b3df30677a467dd3c07 100755 (executable)
@@ -118,15 +118,10 @@ get_fs_uuid() (
 
 # finds the major:minor of the block device backing the root filesystem.
 find_block_device() {
-    local rootdev blkdev fs type opts misc
-    while read blkdev fs type opts misc; do
-       [[ $blkdev = rootfs ]] && continue # skip rootfs entry
-       [[ $fs = $1 ]] && { rootdev=$blkdev; break; } # we have a winner!
-    done < /proc/mounts
-    [[ -b $rootdev ]] || return 1 # oops, not a block device.
-    # get major/minor for the device
-    ls -nLl "$rootdev" | \
-       (read x x x x maj min x; maj=${maj//,/}; echo $maj:$min)
+    local majmin rootdev blkdev fs type opts misc
+    while read a b majmin c mpt opts d fs type opts misc; do
+       [[ $mpt = $1 ]] && { echo $majmin; break; } # we have a winner!
+    done < /proc/self/mountinfo
 }
 
 find_root_block_device() { find_block_device /; }