File 0074-More-empty-cmdline-fixes.patch of Package dracut.892

From c323ff844931d7b9d171d3c11f8c3152c346a62a Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 18 Jun 2014 09:59:22 +0200
Subject: More empty cmdline fixes

This fixes up some more modules which might print out empty
commandline files.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 modules.d/81cio_ignore/module-setup.sh |  5 +++--
 modules.d/95fcoe/module-setup.sh       |  4 ++--
 modules.d/95iscsi/module-setup.sh      | 13 +++++++------
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/modules.d/81cio_ignore/module-setup.sh b/modules.d/81cio_ignore/module-setup.sh
index 42ae2f9..37b414b 100644
--- a/modules.d/81cio_ignore/module-setup.sh
+++ b/modules.d/81cio_ignore/module-setup.sh
@@ -30,8 +30,9 @@ cmdline() {
 
 # called by dracut
 install() {
-    if [[ $hostonly_cmdline == "yes" ]];then
-	cmdline >> "${initdir}/etc/cmdline.d/01cio_accept.conf"
+    if [[ $hostonly_cmdline == "yes" ]] ; then
+        local _cio_accept=$(cmdline)
+        [[ $_cio_accept ]] && printf "%s\n" "$_cio_accept" >> "${initdir}/etc/cmdline.d/01cio_accept.conf"
     fi
 
     inst_hook cmdline 20 "$moddir/parse-cio_accept.sh"
diff --git a/modules.d/95fcoe/module-setup.sh b/modules.d/95fcoe/module-setup.sh
index 57d5c1e..9ca4c67 100755
--- a/modules.d/95fcoe/module-setup.sh
+++ b/modules.d/95fcoe/module-setup.sh
@@ -74,8 +74,8 @@ install() {
     mkdir -m 0755 -p "$initdir/var/lib/lldpad"
 
     if [[ $hostonly_cmdline == "yes" ]] ; then
-        cmdline >> "${initdir}/etc/cmdline.d/95fcoe.conf"
-        echo >> "${initdir}/etc/cmdline.d/95fcoe.conf"
+        local _fcoeconf=$(cmdline)
+        [[ $_fcoeconf ]] && printf "%s\n" "$_fcoeconf" >> "${initdir}/etc/cmdline.d/95fcoe.conf"
     fi
     inst "$moddir/fcoe-up.sh" "/sbin/fcoe-up"
     inst "$moddir/fcoe-edd.sh" "/sbin/fcoe-edd"
diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index e94e913..b90e298 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -78,12 +78,6 @@ depends() {
 installkernel() {
     local _arch=$(uname -m)
 
-    # Detect iBFT and perform mandatory steps
-    if [[ $hostonly_cmdline == "yes" ]] ; then
-        install_ibft > "${initdir}/etc/cmdline.d/95iscsi.conf"
-        echo >> "${initdir}/etc/cmdline.d/95iscsi.conf"
-    fi
-
     instmods bnx2i qla4xxx cxgb3i cxgb4i be2iscsi
     hostonly="" instmods iscsi_tcp iscsi_ibft crc32c iscsi_boot_sysfs
     iscsi_module_filter() {
@@ -133,6 +127,13 @@ install() {
     inst_multiple umount iscsistart hostname iscsi-iname
     inst_multiple -o iscsiuio
     inst_libdir_file 'libgcc_s.so*'
+
+    # Detect iBFT and perform mandatory steps
+    if [[ $hostonly_cmdline == "yes" ]] ; then
+        local _ibftconf=$(install_ibft)
+        [[ $_ibftconf ]] && printf "%s\n" "$_ibftconf" >> "${initdir}/etc/cmdline.d/95iscsi.conf"
+    fi
+
     inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
     inst_hook cleanup 90 "$moddir/cleanup-iscsi.sh"
     inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot"
-- 
1.8.4.5