]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut.sh: Fix UUID= fstab parsing in case --mount option is passed
authorThomas Renninger <trenn@suse.de>
Thu, 11 Dec 2014 14:46:16 +0000 (15:46 +0100)
committerHarald Hoyer <harald@redhat.com>
Tue, 16 Dec 2014 12:29:36 +0000 (13:29 +0100)
Dracut parses /etc/fstab when --mount is option is passed (e.g. kdump).

In host_devs variable the real block device must be stored, not UUID=
There are other /etc/fstab syntax possibilities we now warn that they
are not correctly parsed. This will be fixed by another patch
when there is time to test this properly.

Signed-off-by: Thomas Renninger <trenn@suse.de>
dracut.sh

index a4c7ce5d587152e7766f71b69e2f3ab5b0e476f9..2eba19ba7a2038307a38a9ae2bbd224423ee7eff 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -1071,9 +1071,25 @@ declare -A host_fs_types
 
 for line in "${fstab_lines[@]}"; do
     set -- $line
+    dev="$1"
     #dev mp fs fsopts
-    push_host_devs "$1"
-    host_fs_types["$1"]="$3"
+    case "$dev" in
+        UUID=*)
+            dev=$(blkid -l -t UUID=${dev#UUID=} -o device)
+            ;;
+        LABEL=*)
+            dev=$(blkid -l -t LABEL=${dev#LABEL=} -o device)
+            ;;
+        PARTUUID=*)
+            dev=$(blkid -l -t PARTUUID=${dev#PARTUUID=} -o device)
+            ;;
+        PARTLABEL=*)
+            dev=$(blkid -l -t PARTLABEL=${dev#PARTLABEL=} -o device)
+            ;;
+    esac
+    [ -z "$dev" ] && dwarn "Bad fstab entry $@" && continue
+    push_host_devs "$dev"
+    host_fs_types["$dev"]="$3"
 done
 
 for f in $add_fstab; do