From: Harald Hoyer Date: Mon, 18 May 2015 11:25:08 +0000 (+0200) Subject: 51-dracut-rescue.install: fix kernel cmdline parsing X-Git-Tag: 042~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10e59202c78e8203b772134dfb806ce29cbde8ef;p=thirdparty%2Fdracut.git 51-dracut-rescue.install: fix kernel cmdline parsing filter out any "initrd=" option --- diff --git a/51-dracut-rescue.install b/51-dracut-rescue.install index 0f262d58a..60d737283 100755 --- a/51-dracut-rescue.install +++ b/51-dracut-rescue.install @@ -44,10 +44,18 @@ if [[ -f /etc/kernel/cmdline ]]; then elif [[ -f /usr/lib/kernel/cmdline ]]; then read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline fi + if ! [[ "${BOOT_OPTIONS[@]}" ]]; then - read -r -d '' -a BOOT_OPTIONS < /proc/cmdline + read -r -d '' -a line < /proc/cmdline + for i in "${line[@]}"; do + [[ "${i#initrd=*}" != "$i" ]] && continue + BOOT_OPTIONS+=("$i") + done fi -if ! [[ $BOOT_OPTIONS ]]; then + +if ! [[ ${BOOT_OPTIONS[*]} ]]; then + echo "Could not determine the kernel command line parameters." >&2 + echo "Please specify the kernel command line in /etc/kernel/cmdline!" >&2 exit 1 fi