Blame 0078-dracut-lib-add-find_mount-use-it-to-implement-ismoun.patch
|
Harald Hoyer |
811c04 |
From a5f01bbfb5374bd6c136a3d34bad021bf20b27ab Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
811c04 |
From: Will Woods <wwoods@redhat.com>
|
|
Harald Hoyer |
811c04 |
Date: Fri, 27 Jul 2012 13:12:29 -0400
|
|
Harald Hoyer |
811c04 |
Subject: [PATCH] dracut-lib: add find_mount, use it to implement ismounted
|
|
Harald Hoyer |
811c04 |
|
|
Harald Hoyer |
811c04 |
find_mount is really the same thing as ismounted with two additions:
|
|
Harald Hoyer |
811c04 |
|
|
Harald Hoyer |
811c04 |
1) uses "readlink" so "ismounted /dev/disk/by-label/LABEL" works
|
|
Harald Hoyer |
811c04 |
2) returns the mountpoint of the device
|
|
Harald Hoyer |
811c04 |
|
|
Harald Hoyer |
811c04 |
And ismounted is now just "find_mount $dev >/dev/null".
|
|
Harald Hoyer |
811c04 |
---
|
|
Harald Hoyer |
811c04 |
modules.d/99base/dracut-lib.sh | 11 ++++++++---
|
|
Harald Hoyer |
811c04 |
1 file changed, 8 insertions(+), 3 deletions(-)
|
|
Harald Hoyer |
811c04 |
|
|
Harald Hoyer |
811c04 |
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
|
|
Harald Hoyer |
811c04 |
index 3a7be9a..813cead 100755
|
|
Harald Hoyer |
811c04 |
--- a/modules.d/99base/dracut-lib.sh
|
|
Harald Hoyer |
811c04 |
+++ b/modules.d/99base/dracut-lib.sh
|
|
Harald Hoyer |
811c04 |
@@ -452,13 +452,18 @@ udevproperty() {
|
|
Harald Hoyer |
811c04 |
fi
|
|
Harald Hoyer |
811c04 |
}
|
|
Harald Hoyer |
811c04 |
|
|
Harald Hoyer |
811c04 |
-ismounted() {
|
|
Harald Hoyer |
811c04 |
- while read a m a; do
|
|
Harald Hoyer |
811c04 |
- [ "$m" = "$1" ] && return 0
|
|
Harald Hoyer |
811c04 |
+find_mount() {
|
|
Harald Hoyer |
811c04 |
+ local dev mnt etc wanted_dev="$(readlink -e -q $1)"
|
|
Harald Hoyer |
811c04 |
+ while read dev mnt etc; do
|
|
Harald Hoyer |
811c04 |
+ [ "$dev" = "$wanted_dev" ] && echo "$dev" && return 0
|
|
Harald Hoyer |
811c04 |
done < /proc/mounts
|
|
Harald Hoyer |
811c04 |
return 1
|
|
Harald Hoyer |
811c04 |
}
|
|
Harald Hoyer |
811c04 |
|
|
Harald Hoyer |
811c04 |
+ismounted() {
|
|
Harald Hoyer |
811c04 |
+ find_mount "$1" > /dev/null
|
|
Harald Hoyer |
811c04 |
+}
|
|
Harald Hoyer |
811c04 |
+
|
|
Harald Hoyer |
811c04 |
wait_for_if_up() {
|
|
Harald Hoyer |
811c04 |
local cnt=0
|
|
Harald Hoyer |
811c04 |
local li
|