]> 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>
Fri, 3 Jul 2015 12:17:51 +0000 (14:17 +0200)
also parse cmdline files without an ending newline

(cherry picked from commit 9f0878540bdc8054dc2b45427eed957b9bd25f2d)

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

index 69f70799163598fc34abab8aedfe99ffd29de936..3ffbb02172491097856791ef8b24b9cf82d1a023 100755 (executable)
@@ -115,6 +115,7 @@ getcmdline() {
     local _i
     local CMDLINE_ETC_D
     local CMDLINE_ETC
+    local CMDLINE_PROC
     unset _line
 
     if [ -e /etc/cmdline ]; then
@@ -124,13 +125,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"
 }