Blame 0034-Write-BOOTPROTO-ibft-for-ip-ibft-to-ifcfg-files.patch

Harald Hoyer 61c497
From fd8e4aef9092a5daeeeb55e90105fef8d32ce56d Mon Sep 17 00:00:00 2001
Harald Hoyer 61c497
From: Radek Vykydal <rvykydal@redhat.com>
Harald Hoyer 61c497
Date: Thu, 14 Mar 2013 09:51:07 +0100
Harald Hoyer 61c497
Subject: [PATCH] Write BOOTPROTO=ibft for ip=ibft to ifcfg files
Harald Hoyer 61c497
Harald Hoyer 61c497
---
Harald Hoyer 61c497
 modules.d/40network/net-lib.sh   |  1 +
Harald Hoyer 61c497
 modules.d/45ifcfg/write-ifcfg.sh | 20 ++++++++++++++------
Harald Hoyer 61c497
 2 files changed, 15 insertions(+), 6 deletions(-)
Harald Hoyer 61c497
Harald Hoyer 61c497
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
Harald Hoyer 61c497
index 4a4d7e7..f9b461b 100644
Harald Hoyer 61c497
--- a/modules.d/40network/net-lib.sh
Harald Hoyer 61c497
+++ b/modules.d/40network/net-lib.sh
Harald Hoyer 61c497
@@ -159,6 +159,7 @@ ibft_to_cmdline() {
Harald Hoyer 61c497
                 hostname=$(read a < ${iface}/hostname; echo $a)
Harald Hoyer 61c497
                 echo "ip=$ip::$gw:$mask:$hostname:$dev:none"
Harald Hoyer 61c497
             fi
Harald Hoyer 61c497
+            echo $mac > /tmp/net.${dev}.has_ibft_config
Harald Hoyer 61c497
         done
Harald Hoyer 61c497
     ) >> /etc/cmdline.d/40-ibft.conf
Harald Hoyer 61c497
     # reread cmdline
Harald Hoyer 61c497
diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
Harald Hoyer 61c497
index 79c1987..773dc51 100755
Harald Hoyer 61c497
--- a/modules.d/45ifcfg/write-ifcfg.sh
Harald Hoyer 61c497
+++ b/modules.d/45ifcfg/write-ifcfg.sh
Harald Hoyer 61c497
@@ -106,7 +106,11 @@ for netif in $IFACES ; do
Harald Hoyer 61c497
         [ -n "$mtu" ] && echo "MTU=$mtu"
Harald Hoyer 61c497
         if [ -f /tmp/net.$netif.lease ]; then
Harald Hoyer 61c497
             strstr "$ip" '*:*:*' && echo "IPV6INIT=yes"
Harald Hoyer 61c497
-            echo "BOOTPROTO=dhcp"
Harald Hoyer 61c497
+            if [ -f /tmp/net.$netif.has_ibft_config ]; then
Harald Hoyer 61c497
+                echo "BOOTPROTO=ibft"
Harald Hoyer 61c497
+            else
Harald Hoyer 61c497
+                echo "BOOTPROTO=dhcp"
Harald Hoyer 61c497
+            fi
Harald Hoyer 61c497
             cp /tmp/net.$netif.lease /tmp/ifcfg-leases/dhclient-$uuid-$netif.lease
Harald Hoyer 61c497
         else
Harald Hoyer 61c497
             # If we've booted with static ip= lines, the override file is there
Harald Hoyer 61c497
@@ -116,12 +120,16 @@ for netif in $IFACES ; do
Harald Hoyer 61c497
                 echo "IPV6_AUTOCONF=no"
Harald Hoyer 61c497
                 echo "IPV6ADDR=$ip/$mask"
Harald Hoyer 61c497
             else
Harald Hoyer 61c497
-                echo "BOOTPROTO=none"
Harald Hoyer 61c497
-                echo "IPADDR=$ip"
Harald Hoyer 61c497
-                if strstr "$mask" "."; then
Harald Hoyer 61c497
-                    echo "NETMASK=$mask"
Harald Hoyer 61c497
+                if [-f /tmp/net.$netif.has_ibft_config ]; then
Harald Hoyer 61c497
+                    echo "BOOTPROTO=ibft"
Harald Hoyer 61c497
                 else
Harald Hoyer 61c497
-                    echo "PREFIX=$mask"
Harald Hoyer 61c497
+                    echo "BOOTPROTO=none"
Harald Hoyer 61c497
+                    echo "IPADDR=$ip"
Harald Hoyer 61c497
+                    if strstr "$mask" "."; then
Harald Hoyer 61c497
+                        echo "NETMASK=$mask"
Harald Hoyer 61c497
+                    else
Harald Hoyer 61c497
+                        echo "PREFIX=$mask"
Harald Hoyer 61c497
+                    fi
Harald Hoyer 61c497
                 fi
Harald Hoyer 61c497
             fi
Harald Hoyer 61c497
             if strstr "$gw" '*:*:*'; then