Blame SOURCES/0276-base-dracut-lib.sh-read-proc-cmdline-with-multiple-l.patch

712866
From 34b49be88219519f678f665987787784751b11bd Mon Sep 17 00:00:00 2001
712866
From: Harald Hoyer <harald@redhat.com>
712866
Date: Thu, 19 Mar 2015 12:33:03 +0100
712866
Subject: [PATCH] base/dracut-lib.sh: read /proc/cmdline with multiple lines
712866
712866
also parse cmdline files without an ending newline
712866
712866
(cherry picked from commit 9f0878540bdc8054dc2b45427eed957b9bd25f2d)
712866
---
712866
 modules.d/99base/dracut-lib.sh | 9 ++++++---
712866
 1 file changed, 6 insertions(+), 3 deletions(-)
712866
712866
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
5c6c2a
index 69f70799..3ffbb021 100755
712866
--- a/modules.d/99base/dracut-lib.sh
712866
+++ b/modules.d/99base/dracut-lib.sh
712866
@@ -115,6 +115,7 @@ getcmdline() {
712866
     local _i
712866
     local CMDLINE_ETC_D
712866
     local CMDLINE_ETC
712866
+    local CMDLINE_PROC
712866
     unset _line
712866
 
712866
     if [ -e /etc/cmdline ]; then
712866
@@ -124,13 +125,15 @@ getcmdline() {
712866
     fi
712866
     for _i in /etc/cmdline.d/*.conf; do
712866
         [ -e "$_i" ] || continue
712866
-        while read -r _line; do
712866
+        while read -r _line || [ -n "$_line" ]; do
712866
             CMDLINE_ETC_D="$CMDLINE_ETC_D $_line";
712866
         done <"$_i";
712866
     done
712866
     if [ -e /proc/cmdline ]; then
712866
-        read -r CMDLINE 
712866
-        CMDLINE="$CMDLINE_ETC_D $CMDLINE_ETC $CMDLINE"
712866
+        while read -r _line || [ -n "$_line" ]; do
712866
+            CMDLINE_PROC="$CMDLINE_PROC $_line"
712866
+        done 
712866
+        CMDLINE="$CMDLINE_ETC_D $CMDLINE_ETC $CMDLINE_PROC"
712866
     fi
712866
     printf "%s" "$CMDLINE"
712866
 }