[PATCH f17-branch 2/2] make dev_is_mounted more reliable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If /dev/sda1 was mounted at /mnt, and it had the label FUNK, you might
reasonably expect this to return "/mnt":

  dev_is_mounted /dev/disk/by-label/FUNK

Since /proc/mounts uses the kernel name for the devices, and the
symlinks in /dev are (basically) always linked to the kernel
device name, all we have to do is follow the symlinks to find the name
that should be in /proc/mounts.
---
 dracut/anaconda-lib.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dracut/anaconda-lib.sh b/dracut/anaconda-lib.sh
index de8d317..115456d 100755
--- a/dracut/anaconda-lib.sh
+++ b/dracut/anaconda-lib.sh
@@ -90,9 +90,9 @@ disk_to_dev_path() {
 }
 
 dev_is_mounted() {
-    local dev mnt etc
+    local dev mnt etc wanted_dev="$(readlink -e -q $1)"
     while read dev mnt etc; do
-        [ "$dev" = "$1" ] && echo $mnt && return 0
+        [ "$dev" = "$wanted_dev" ] && echo $mnt && return 0
     done < /proc/mounts
     return 1
 }
-- 
1.7.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux