dracut-lib: add find_mount, use it to implement ismounted

find_mount is really the same thing as ismounted with two additions:

  1) uses "readlink" so "ismounted /dev/disk/by-label/LABEL" works
  2) returns the mountpoint of the device

And ismounted is now just "find_mount $dev >/dev/null".
master
Will Woods 2012-07-27 13:12:29 -04:00 committed by Harald Hoyer
parent 7e2285a48a
commit a5f01bbfb5
1 changed files with 8 additions and 3 deletions

View File

@ -452,13 +452,18 @@ udevproperty() {
fi
}

ismounted() {
while read a m a; do
[ "$m" = "$1" ] && return 0
find_mount() {
local dev mnt etc wanted_dev="$(readlink -e -q $1)"
while read dev mnt etc; do
[ "$dev" = "$wanted_dev" ] && echo "$dev" && return 0
done < /proc/mounts
return 1
}

ismounted() {
find_mount "$1" > /dev/null
}

wait_for_if_up() {
local cnt=0
local li