]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Fix parsing of "-i" and "--include" 339/head
authorFabian Vogt <fvogt@suse.com>
Mon, 21 Sep 2015 13:15:07 +0000 (15:15 +0200)
committerDaniel Molkentin <dmolkentin@suse.com>
Mon, 8 Jan 2018 09:43:46 +0000 (10:43 +0100)
- 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>
Adjusted to not support "dracut -ifoo bar", as this breaks expected
upstream behavior.

dracut.sh

index 635fdb1c3fa8686ad474d1778666f9c46971d1d7..cdd71c3a86183044150b6ec3727a17b79787bb79 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -286,11 +286,15 @@ 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" ]] || [[ $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" \