From c05281ffd36f9089a84e3f672e5a1bce9b659679 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Tue, 22 Nov 2016 20:14:05 +0000
Subject: LinHES-config: mv_network.py: fix upgrade when not connected to
 network

---
 abs/core/LinHES-config/PKGBUILD      |  4 ++--
 abs/core/LinHES-config/mv_network.py | 18 ++++++++++++------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index ed6cca9..eea1dfa 100755
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=8.4.2
-pkgrel=1
+pkgrel=2
 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev LinHes-config )
 pkgdesc="Install and configure your system"
 depends=('bc' 'libstatgrab' 'mysql-python' 'expect' 'curl' 'dnsutils' 'parted'
@@ -166,7 +166,7 @@ md5sums=('97b810ddc35d1f441dbe8cdd6886e2af'
          'b845de3e05c1734cce4b9ac5e8f1baaf'
          '02b4378b17bca6bebdcc2258a80dfc6b'
          '8b7dce4a3a0a281fa6656aa8781a648e'
-         '4b10fff21a0274f950f97f2b61e92463'
+         '3ef3f589f46d0b59603226fef325e611'
          '824e49d9b01fed295c704ab68908b464'
          'fe5e31b833cc6707209e9d656b6eb53c'
          '336f08aed2e3c0b9fd09563933d54735'
diff --git a/abs/core/LinHES-config/mv_network.py b/abs/core/LinHES-config/mv_network.py
index a4ad0c9..559a226 100755
--- a/abs/core/LinHES-config/mv_network.py
+++ b/abs/core/LinHES-config/mv_network.py
@@ -53,17 +53,23 @@ def get_ip(ifname):
         logging.debug("    Found %s in all_interfaces", ifname)
     else:
         logging.critical("*     Couldn't find %s in list", ifname)
-        ifname = all_if[0]
+        try:
+            ifname = all_if[0]
+        except:
+            ifname = ifname
         logging.critical("*     Using %s for interface name", ifname)
 
 
     s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
 
-    ip = socket.inet_ntoa(fcntl.ioctl(
-        s.fileno(),
-        0x8915,  # SIOCGIFADDR
-        struct.pack('256s', ifname[:15])
-    )[20:24])
+    try:
+        ip = socket.inet_ntoa(fcntl.ioctl(
+            s.fileno(),
+            0x8915,  # SIOCGIFADDR
+            struct.pack('256s', ifname[:15])
+            )[20:24])
+    except:
+        ip = "127.0.0.1"
 
     logging.debug("    get_ip ip address is %s", ip)
     return ip
-- 
cgit v0.12

