File kdump-net-0015-config-in-kdump_netif.patch of Package kdump.2364

From: Petr Tesarik <ptesarik@suse.com>
Date: Mon, 12 Sep 2016 17:25:49 +0200
Subject: Store iface configuration in global variable kdump_netif
References: bsc#980328
Patch-mainline: v0.8.16
Git-commit: 4e266df9f73481bc412c9ce3a983ea7c87b72a88

Using standard output does not allow the caller to capture both the
configuration and additional output variables, because standard
output can be saved into a variable only using a sub-shell.

Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
 init/module-setup.sh       |  1 +
 init/setup-kdump.functions | 20 ++++++++------------
 2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/init/module-setup.sh b/init/module-setup.sh
index aefaece..cde31a6 100755
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -80,6 +80,7 @@ kdump_cmdline_ip() {
     [ "$_mode" = "auto" ] && _mode=$(kdump_netdev_mode "$_if")
 
     kdump_ifname_config "$_if"
+    echo -n "$kdump_netif"
 
     case "$_mode" in
 	static)
diff --git a/init/setup-kdump.functions b/init/setup-kdump.functions
index a63dc9d..f97b498 100644
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -250,9 +250,8 @@ function kdump_list_slaves()						   # {{{
 #
 # Parameters:
 #   1) iface  device name
-# Output:
-#   corresponding bridge= initrd parameter and dependencies
 # Output variables:
+#   kdump_netif  corresponding bridge= initrd parameter added
 #   kdump_iface  device name in initrd
 function kdump_bridge_config()						   # {{{
 {
@@ -280,7 +279,7 @@ function kdump_bridge_config()						   # {{{
     [ -n "$slaves" ] || return 1
 
     slaves="${slaves# }"
-    echo -n " bridge=$kdump_iface:${slaves// /,}"
+    kdump_netif="$kdump_netif bridge=$kdump_iface:${slaves// /,}"
 }									   # }}}
 
 #
@@ -288,9 +287,8 @@ function kdump_bridge_config()						   # {{{
 #
 # Parameters:
 #   1) iface  device name
-# Output:
-#   corresponding bond= initrd parameter and dependencies
 # Output variables:
+#   kdump_netif  corresponding bond= initrd parameter added
 #   kdump_iface  device name in initrd
 function kdump_bond_config()						   # {{{
 {
@@ -394,7 +392,7 @@ function kdump_bond_config()						   # {{{
     [ -n "$slaves" ] || return 1
     slaves="${slaves# }"
 
-    echo -n " bond=$kdump_iface:${slaves// /,}:${opts#,}"
+    kdump_netif="$kdump_netif bond=$kdump_iface:${slaves// /,}:${opts#,}"
 }									   # }}}
 
 #
@@ -414,9 +412,8 @@ function kdump_link2vlan()                                                # {{{{
 #
 # Parameters:
 #   1) iface  device name
-# Output:
-#   corresponding vlan= initrd parameter and dependencies
 # Output variables:
+#   kdump_netif  corresponding vlan= initrd parameter added
 #   kdump_iface  device name in initrd
 #
 # Because of dracut limitations for vlan interface naming, the initrd
@@ -443,16 +440,15 @@ function kdump_vlan_config()						   # {{{
 
     kdump_ifname_config "$if"
     kdump_iface="$if.$vid"
-    echo -n " vlan=$kdump_iface:$if"
+    kdump_netif="$kdump_netif vlan=$kdump_iface:$if"
 }									   # }}}
 
 # Get the ifname parameter for a given device
 #
 # Parameters:
 #   1) device  device name
-# Output:
-#   ifname corresponding ifname= initrd parameter (or empty)
 # Output variables:
+#   kdump_netif  corresponding ifname= initrd parameter added
 #   kdump_iface  device name in initrd
 function kdump_ifname_config()						   # {{{
 {
@@ -469,7 +465,7 @@ function kdump_ifname_config()						   # {{{
 	else
 	    hwaddr=$(ethtool -P "$kdump_iface" | sed 's/^[^:]*: *//')
 	fi
-	[ -n "$hwaddr" ] && echo -n " ifname=$kdump_iface:$hwaddr"
+	[ -n "$hwaddr" ] && kdump_netif="$kdump_netif ifname=$kdump_iface:$hwaddr"
     else
 	case "$ifkind" in
 	    bridge)
-- 
2.6.6


openSUSE Build Service is sponsored by