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

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