From dcacd2b072c301a51c114256e8bb696346879a2b Mon Sep 17 00:00:00 2001 From: Fabian Vogt 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 Adjusted to not support "dracut -ifoo bar", as this breaks expected upstream behavior. --- dracut.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/dracut.sh b/dracut.sh index 635fdb1c..cdd71c3a 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" \