From: Fabian Vogt Date: Mon, 21 Sep 2015 13:15:07 +0000 (+0200) Subject: Fix parsing of "-i" and "--include" X-Git-Tag: 047~44^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F339%2Fhead;p=thirdparty%2Fdracut.git 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 Adjusted to not support "dracut -ifoo bar", as this breaks expected upstream behavior. --- diff --git a/dracut.sh b/dracut.sh index 635fdb1c3..cdd71c3a8 100755 --- 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" \