]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut-lib: add find_mount, use it to implement ismounted
authorWill Woods <wwoods@redhat.com>
Fri, 27 Jul 2012 17:12:29 +0000 (13:12 -0400)
committerHarald Hoyer <harald@redhat.com>
Mon, 30 Jul 2012 10:23:32 +0000 (12:23 +0200)
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

index 3a7be9a839d16abd0d82e20e097816c29cf11533..813cead1ac7e88f4060872f1c5fedb697adb744d 100755 (executable)
@@ -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