dracut/0078-dracut-lib-add-find_mount-use-it-to-implement-ismoun.patch
Harald Hoyer 811c04a7e9 dracut-022-97.git20120730
- moved crypt setup to systemd units
2012-07-30 21:53:48 +02:00

42 lines
1.2 KiB
Diff

From a5f01bbfb5374bd6c136a3d34bad021bf20b27ab Mon Sep 17 00:00:00 2001
From: Will Woods <wwoods@redhat.com>
Date: Fri, 27 Jul 2012 13:12:29 -0400
Subject: [PATCH] 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".
---
modules.d/99base/dracut-lib.sh | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 3a7be9a..813cead 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -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