Blame 0055-dracut.sh-Fix-UUID-fstab-parsing-in-case-mount-optio.patch

Harald Hoyer b94732
From 6df523517f364882c51bbcc5b3245dd568eca3b3 Mon Sep 17 00:00:00 2001
Harald Hoyer b94732
From: Thomas Renninger <trenn@suse.de>
Harald Hoyer b94732
Date: Thu, 11 Dec 2014 15:46:16 +0100
Harald Hoyer b94732
Subject: [PATCH] dracut.sh: Fix UUID= fstab parsing in case --mount option is
Harald Hoyer b94732
 passed
Harald Hoyer b94732
Harald Hoyer b94732
Dracut parses /etc/fstab when --mount is option is passed (e.g. kdump).
Harald Hoyer b94732
Harald Hoyer b94732
In host_devs variable the real block device must be stored, not UUID=
Harald Hoyer b94732
There are other /etc/fstab syntax possibilities we now warn that they
Harald Hoyer b94732
are not correctly parsed. This will be fixed by another patch
Harald Hoyer b94732
when there is time to test this properly.
Harald Hoyer b94732
Harald Hoyer b94732
Signed-off-by: Thomas Renninger <trenn@suse.de>
Harald Hoyer b94732
---
Harald Hoyer b94732
 dracut.sh | 20 ++++++++++++++++++--
Harald Hoyer b94732
 1 file changed, 18 insertions(+), 2 deletions(-)
Harald Hoyer b94732
Harald Hoyer b94732
diff --git a/dracut.sh b/dracut.sh
Harald Hoyer b94732
index a4c7ce5..2eba19b 100755
Harald Hoyer b94732
--- a/dracut.sh
Harald Hoyer b94732
+++ b/dracut.sh
Harald Hoyer b94732
@@ -1071,9 +1071,25 @@ declare -A host_fs_types
Harald Hoyer b94732
 
Harald Hoyer b94732
 for line in "${fstab_lines[@]}"; do
Harald Hoyer b94732
     set -- $line
Harald Hoyer b94732
+    dev="$1"
Harald Hoyer b94732
     #dev mp fs fsopts
Harald Hoyer b94732
-    push_host_devs "$1"
Harald Hoyer b94732
-    host_fs_types["$1"]="$3"
Harald Hoyer b94732
+    case "$dev" in
Harald Hoyer b94732
+        UUID=*)
Harald Hoyer b94732
+            dev=$(blkid -l -t UUID=${dev#UUID=} -o device)
Harald Hoyer b94732
+            ;;
Harald Hoyer b94732
+        LABEL=*)
Harald Hoyer b94732
+            dev=$(blkid -l -t LABEL=${dev#LABEL=} -o device)
Harald Hoyer b94732
+            ;;
Harald Hoyer b94732
+        PARTUUID=*)
Harald Hoyer b94732
+            dev=$(blkid -l -t PARTUUID=${dev#PARTUUID=} -o device)
Harald Hoyer b94732
+            ;;
Harald Hoyer b94732
+        PARTLABEL=*)
Harald Hoyer b94732
+            dev=$(blkid -l -t PARTLABEL=${dev#PARTLABEL=} -o device)
Harald Hoyer b94732
+            ;;
Harald Hoyer b94732
+    esac
Harald Hoyer b94732
+    [ -z "$dev" ] && dwarn "Bad fstab entry $@" && continue
Harald Hoyer b94732
+    push_host_devs "$dev"
Harald Hoyer b94732
+    host_fs_types["$dev"]="$3"
Harald Hoyer b94732
 done
Harald Hoyer b94732
 
Harald Hoyer b94732
 for f in $add_fstab; do