diff options
author | Harald Hoyer <harald@redhat.com> | 2010-08-05 18:59:51 +0200 |
---|---|---|
committer | Harald Hoyer <harald@redhat.com> | 2010-08-05 18:59:51 +0200 |
commit | 029f2691f8d0d521e9344ad111f43caa0500ea4f (patch) | |
tree | b6f9e9cf98eaa8b3422e5739f83aeabb2ed034e3 /dracut-functions | |
parent | 0493f9c8491fc31e7b08b55183b2f6decdc98f97 (diff) | |
download | dracut-029f2691f8d0d521e9344ad111f43caa0500ea4f.tar.gz dracut-029f2691f8d0d521e9344ad111f43caa0500ea4f.tar.bz2 dracut-029f2691f8d0d521e9344ad111f43caa0500ea4f.zip |
dracut-functions: use /proc/self/mountinfo, instead of /proc/mounts
1. it's easier to get the major:minor
2. it's more failsafe in a chroot() (rescue CD case)
Diffstat (limited to 'dracut-functions')
-rwxr-xr-x | dracut-functions | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/dracut-functions b/dracut-functions index c9affc74..f53d5e34 100755 --- a/dracut-functions +++ b/dracut-functions @@ -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 /; } |