File 0017-45ifcfg-use-distro-specific-scripts.patch of Package dracut.12460

From afc08d7bbee93db0b81d20aef00f538fde3209e3 Mon Sep 17 00:00:00 2001
From: Pawel Wieczorkiewicz <pwieczorkiewicz@suse.de>
Date: Tue, 8 Apr 2014 08:48:27 +0200
Subject: 45ifcfg: use distro-specific scripts

Detect the system flavor and write the ifcfg files accordingly.

  - Do not move ifcfg to -suse and -redhat files to avoid re-diffing after
    each upgrade. Handle this in the spec file and a separate
    write-ifcfg-suse.sh source file

  - Also revert upstream commit f34e1d6, to not forcibly include 45ifcfg
    and thus the whole network stack (bsc#960669)

Signed-off-by: Hannes Reinecke <hare@suse.de>
Modified-by: Thomas Rennigner <trenn@suse.de>
Modified-by: Fabian Vogt <fvogt@suse.com>
---
 modules.d/40network/ifup.sh         | 1 +
 modules.d/40network/module-setup.sh | 7 +++++++
 modules.d/45ifcfg/module-setup.sh   | 1 -
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
index 92e4b38..347c7f7 100755
--- a/modules.d/40network/ifup.sh
+++ b/modules.d/40network/ifup.sh
@@ -189,6 +189,7 @@ do_dhcp() {
     $dhclient --test $netif > /tmp/leaseinfo.${netif}.dhcp.ipv${1:1:1}
     dhcp_apply $1 || return $?
 
+    echo $netif > /tmp/net.${netif}.did-setup
     echo $netif > /tmp/setup_net_${netif}.ok
     return 0
 }
diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh
index 2252995..fa6c7fc 100755
--- a/modules.d/40network/module-setup.sh
+++ b/modules.d/40network/module-setup.sh
@@ -15,6 +15,13 @@ check() {
 # called by dracut
 depends() {
     echo "kernel-network-modules"
+    local link=$(readlink $moddir/write-ifcfg.sh)
+    [[ "$link" = "write-ifcfg-suse.sh" ]] && \
+    [[ -d /etc/sysconfig/network ]] && \
+        echo "ifcfg"
+    [[ "$link" = "write-ifcfg-redhat.sh" ]] && \
+    [[ -d /etc/sysconfig/network-scripts ]] && \
+        echo "ifcfg"
     return 0
 }
 
diff --git a/modules.d/45ifcfg/module-setup.sh b/modules.d/45ifcfg/module-setup.sh
index 6791985..60ed92b 100755
--- a/modules.d/45ifcfg/module-setup.sh
+++ b/modules.d/45ifcfg/module-setup.sh
@@ -2,7 +2,6 @@
 
 # called by dracut
 check() {
-    [[ -d /etc/sysconfig/network-scripts ]] && return 0
     return 255
 }
 
-- 
2.6.6