File 0192-iscsi_set_boot_protocol_from_ifcfg.patch of Package dracut.6430

From: Thomas Blume <thomas.blume@suse.com>
Subject: set boot protocol for iscsi from ifcfg file

References: bsc#919179

Signed-off-by: Thomas Blume <thomas.blume@suse.com>

Index: dracut-044/modules.d/95iscsi/module-setup.sh
===================================================================
--- dracut-044.orig/modules.d/95iscsi/module-setup.sh	2016-04-14 14:12:39.693392427 +0200
+++ dracut-044/modules.d/95iscsi/module-setup.sh	2016-04-14 14:53:00.630227712 +0200
@@ -104,7 +104,14 @@ install_iscsiroot() {
     [ -z "$iscsi_address" ] && return
     local_address=$(ip -o route get to $iscsi_address | sed -n 's/.*src \([0-9a-f.:]*\).*/\1/p')
     ifname=$(ip -o route get to $iscsi_address | sed -n 's/.*dev \([^ ]*\).*/\1/p')
-    printf 'ip=%s:static ' ${ifname}
+
+    #follow ifcfg settings for boot protocol
+    bootproto=$(sed -n "/BOOTPROTO/s/BOOTPROTO='\([[:alpha:]]*6\?\)4\?'/\1/p" /etc/sysconfig/network/ifcfg-$ifname)
+    if [ $bootproto ]; then
+        printf 'ip=%s:%s ' ${ifname} ${bootproto}
+    else
+        printf 'ip=%s:static ' ${ifname}
+    fi
 
     if [ -e /sys/class/net/$ifname/address ] ; then
         ifmac=$(cat /sys/class/net/$ifname/address)
openSUSE Build Service is sponsored by