File 0095-95iscsi-use-static-configuration-for-software-iscsi.patch of Package dracut.244

From d62ee7be6309c4f5e3f8b0d3c6e825da03095ed7 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 2 Jul 2014 11:56:29 +0200
Subject: 95iscsi: use static configuration for software iscsi

When using software iscsi we should be using the existing
configuration from the system for the time being.

References: bnc#884768

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 modules.d/95iscsi/module-setup.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index e9bed24..81ffb18 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -76,9 +76,11 @@ install_iscsiroot() {
         esac
     done
 
-    local_address=$(ip -o route get to $iscsi_address | cut -f 1 -d ' ')
-    ifname=$(ip addr show to $local_address | head -1 | sed -n 's/[0-9]*: \(.*\): .*/\1/p')
-    if [ -d /sys/class/net/$ifname/address ] ; then
+    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}
+
+    if [ -e /sys/class/net/$ifname/address ] ; then
         ifmac=$(cat /sys/class/net/$ifname/address)
         printf 'ifname=%s:%s ' ${ifname} ${ifmac}
     fi
-- 
1.8.4.5

openSUSE Build Service is sponsored by