]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
base/dracut-lib.sh: read /proc/cmdline with multiple lines
authorHarald Hoyer <harald@redhat.com>
Thu, 19 Mar 2015 11:33:03 +0000 (12:33 +0100)
committerHarald Hoyer <harald@redhat.com>
Thu, 19 Mar 2015 15:40:38 +0000 (16:40 +0100)
also parse cmdline files without an ending newline

modules.d/99base/dracut-lib.sh

index 079c9a21ecad4d7941119cb0f97df1330f1eb24c..259e2057b67eab7060fea882f5aa043161b7c0f6 100755 (executable)
@@ -127,6 +127,7 @@ getcmdline() {
     local _i
     local CMDLINE_ETC_D
     local CMDLINE_ETC
+    local CMDLINE_PROC
     unset _line
 
     if [ -e /etc/cmdline ]; then
@@ -136,13 +137,15 @@ getcmdline() {
     fi
     for _i in /etc/cmdline.d/*.conf; do
         [ -e "$_i" ] || continue
-        while read -r _line; do
+        while read -r _line || [ -n "$_line" ]; do
             CMDLINE_ETC_D="$CMDLINE_ETC_D $_line";
         done <"$_i";
     done
     if [ -e /proc/cmdline ]; then
-        read -r CMDLINE </proc/cmdline;
-        CMDLINE="$CMDLINE_ETC_D $CMDLINE_ETC $CMDLINE"
+        while read -r _line || [ -n "$_line" ]; do
+            CMDLINE_PROC="$CMDLINE_PROC $_line"
+        done </proc/cmdline;
+        CMDLINE="$CMDLINE_ETC_D $CMDLINE_ETC $CMDLINE_PROC"
     fi
     printf "%s" "$CMDLINE"
 }