File 0182-fix-include-parsing.patch of Package dracut.12460

From 11d6560d7bbd8a4c4610a39c0985e50d728920fb Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fvogt@suse.com>
Date: Mon, 21 Sep 2015 15:15:07 +0200
Subject: [PATCH] Fix parsing of "-i" and "--include"

- dracut replaced every instance of "-i" in the cmdline,
  even if it was part of a kernel image name, e.g. "vmlinuz-i"
- Fixes boo#908452

Signed-off-by: Fabian Vogt <fvogt@suse.com>
---
 dracut.sh | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Index: dracut-044/dracut.sh
===================================================================
--- dracut-044.orig/dracut.sh
+++ dracut-044/dracut.sh
@@ -279,11 +279,17 @@ dropindirs_sort()
 rearrange_params()
 {
     # Workaround -i, --include taking 2 arguments
-    set -- "${@/--include/++include}"
-
-    # This prevents any long argument ending with "-i"
-    # -i, like --opt-i but I think we can just prevent that
-    set -- "${@/%-i/++include}"
+    newat=()
+    for i in "$@"; do
+        if [[ $i =~ ^-i(.*) ]]; then
+            newat+=("++include" "${BASH_REMATCH[1]}") # Replace -i by ++include
+        elif [[ $i == "--include" ]]; then
+            newat+=("++include") # Replace --include by ++include
+        else
+            newat+=("$i")
+        fi
+    done
+    set -- "${newat[@]}" # Set new $@
 
     TEMP=$(unset POSIXLY_CORRECT; getopt \
         -o "a:m:o:d:I:k:c:L:fvqlHhMN" \
openSUSE Build Service is sponsored by