remove debug code
[enigma2.git] / lib / python / Components / Network.py
index 6d28b19d3e6ea0595acba9544a7bfadaad8c4c0e..99afb75db93c7dd946fc95353fe59006c24bd595 100644 (file)
@@ -14,7 +14,6 @@ class Network:
                fp.write("auto eth0\n")
                if (config.network.dhcp.value == _("yes")):
                        fp.write("iface eth0 inet dhcp\n")
-                       fp.write("      address %d.%d.%d.%d\n" % tuple(config.network.ip.value))
                else:
                        fp.write("iface eth0 inet static\n")
                        fp.write("      address %d.%d.%d.%d\n" % tuple(config.network.ip.value))
@@ -121,12 +120,14 @@ class Network:
                #self.writeNetworkConfig()              
 
        def getCurrentIP(self):
-               ip = [0, 0, 0, 0]
-               try:
-                       print gethostbyname(gethostname())
-                       ip = gethostbyname(gethostname()).split('.')
-               except:
-                       print "[Network.py] Could not get current ip (not necessarily an error)"
+               ipstr = [0,0,0,0]
+               for x in os.popen("ifconfig eth0 | grep 'inet addr:'", "r").readline().split(' '):
+                       if x.split(':')[0] == "addr":
+                               ipstr = x.split(':')[1].split('.')
+               ip = []
+               for x in ipstr:
+                       ip.append(int(x))
+               print "[Network.py] got ip " + str(ip)
                return ip
 
 iNetwork = Network()