File 0073-Don-t-create-lots-of-empty-cmdline-files-for-hostonl.patch of Package dracut.892

From 706f28a7bc193455fcd0656f70adaee442f12ff8 Mon Sep 17 00:00:00 2001
From: Thorsten Behrens <tbehrens@suse.com>
Date: Wed, 18 Jun 2014 02:09:38 +0200
Subject: Don't create lots of empty cmdline files for hostonly-cmdline case

This aligns other places piping cmdline() output to cmdline.d files
with the earlier fix for 95rootfs-block.

Signed-off-by: Thorsten Behrens <tbehrens@suse.com>
---
 modules.d/90crypt/module-setup.sh  | 4 ++--
 modules.d/90dmraid/module-setup.sh | 4 ++--
 modules.d/90lvm/module-setup.sh    | 4 ++--
 modules.d/90mdraid/module-setup.sh | 4 ++--
 modules.d/95resume/module-setup.sh | 5 ++---
 5 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh
index 5707404..e423a95 100755
--- a/modules.d/90crypt/module-setup.sh
+++ b/modules.d/90crypt/module-setup.sh
@@ -52,8 +52,8 @@ cmdline() {
 install() {
 
     if [[ $hostonly_cmdline == "yes" ]]; then
-        cmdline >> "${initdir}/etc/cmdline.d/90crypt.conf"
-        echo >> "${initdir}/etc/cmdline.d/90crypt.conf"
+        local _cryptconf=$(cmdline)
+        [[ $_cryptconf ]] && printf "%s\n" "$_cryptconf" >> "${initdir}/etc/cmdline.d/90crypt.conf"
     fi
 
     inst_multiple cryptsetup rmdir readlink umount
diff --git a/modules.d/90dmraid/module-setup.sh b/modules.d/90dmraid/module-setup.sh
index aebb28d..3769dd0 100755
--- a/modules.d/90dmraid/module-setup.sh
+++ b/modules.d/90dmraid/module-setup.sh
@@ -66,8 +66,8 @@ install() {
     local _i
 
     if [[ $hostonly_cmdline == "yes" ]]; then
-        cmdline >> "${initdir}/etc/cmdline.d/90dmraid.conf"
-        echo >> "${initdir}/etc/cmdline.d/90dmraid.conf"
+        local _raidconf=$(cmdline)
+        [[ $_raidconf ]] && printf "%s\n" "$_raidconf" >> "${initdir}/etc/cmdline.d/90dmraid.conf"
     fi
 
     inst_multiple dmraid
diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh
index 5b810b9..2a5b392 100755
--- a/modules.d/90lvm/module-setup.sh
+++ b/modules.d/90lvm/module-setup.sh
@@ -51,8 +51,8 @@ install() {
     inst lvm
 
     if [[ $hostonly_cmdline == "yes" ]]; then
-        cmdline >> "${initdir}/etc/cmdline.d/90lvm.conf"
-        echo >> "${initdir}/etc/cmdline.d/90lvm.conf"
+        local _lvmconf=$(cmdline)
+        [[ $_lvmconf ]] && printf "%s\n" "$_lvmconf" >> "${initdir}/etc/cmdline.d/90lvm.conf"
     fi
 
     inst_rules "$moddir/64-lvm.rules"
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh
index 4963537..da464b8 100755
--- a/modules.d/90mdraid/module-setup.sh
+++ b/modules.d/90mdraid/module-setup.sh
@@ -73,8 +73,8 @@ install() {
     inst $(command -v mdadm) /sbin/mdadm
 
     if [[ $hostonly_cmdline == "yes" ]]; then
-        cmdline  >> "${initdir}/etc/cmdline.d/90mdraid.conf"
-        echo  >> "${initdir}/etc/cmdline.d/90mdraid.conf"
+        local _raidconf=$(cmdline)
+        [[ $_raidconf ]] && printf "%s\n" "$_raidconf" >> "${initdir}/etc/cmdline.d/90mdraid.conf"
     fi
 
     # <mdadm-3.3 udev rule
diff --git a/modules.d/95resume/module-setup.sh b/modules.d/95resume/module-setup.sh
index 7f3cf24..b1044ed 100755
--- a/modules.d/95resume/module-setup.sh
+++ b/modules.d/95resume/module-setup.sh
@@ -33,9 +33,8 @@ cmdline() {
 # called by dracut
 install() {
     local _bin
-
-    cmdline  >> "${initdir}/etc/cmdline.d/95resume.conf"
-    echo  >> "${initdir}/etc/cmdline.d/95resume.conf"
+    local _resumeconf=$(cmdline)
+    [[ $_resumeconf ]] && printf "%s\n" "$_resumeconf" >> "${initdir}/etc/cmdline.d/95resume.conf"
 
     # Optional uswsusp support
     for _bin in /usr/sbin/resume /usr/lib/suspend/resume /usr/lib/uswsusp/resume
-- 
1.8.4.5