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

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