summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/LinHES-config
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2009-08-17 17:15:12 (GMT)
committerJames Meyer <james.meyer@operamail.com>2009-08-17 17:15:12 (GMT)
commitda98b0f401f135cb5a04270dbfc46c5dafc43d9d (patch)
tree88a1b4ca7f84ac655635e98de99e643252067ff7 /abs/core-testing/LinHES-config
parent620cb6800d15e6b2b0738b6cdd29080d2685f70b (diff)
downloadlinhes_pkgbuild-da98b0f401f135cb5a04270dbfc46c5dafc43d9d.zip
linhes_pkgbuild-da98b0f401f135cb5a04270dbfc46c5dafc43d9d.tar.gz
linhes_pkgbuild-da98b0f401f135cb5a04270dbfc46c5dafc43d9d.tar.bz2
LinHESconfig: remove debugging code, finish myth vars in network
Diffstat (limited to 'abs/core-testing/LinHES-config')
-rwxr-xr-xabs/core-testing/LinHES-config/mv_advanced.py3
-rwxr-xr-xabs/core-testing/LinHES-config/mv_install.py3
-rwxr-xr-xabs/core-testing/LinHES-config/mv_network.py56
-rwxr-xr-xabs/core-testing/LinHES-config/systemconfig.py2
4 files changed, 58 insertions, 6 deletions
diff --git a/abs/core-testing/LinHES-config/mv_advanced.py b/abs/core-testing/LinHES-config/mv_advanced.py
index d7c65f1..2b53d04 100755
--- a/abs/core-testing/LinHES-config/mv_advanced.py
+++ b/abs/core-testing/LinHES-config/mv_advanced.py
@@ -369,9 +369,6 @@ def setup_advanced(systemconfig,data_config):
setup_evrouter(systemconfig["UseEvrouter"],
systemconfig["EvrouterConfig"],
systemconfig["TEMPLATES"])
- systemconfig["mythip"]="192.168.100.myip"
- systemconfig["mythgw"]="192.168.100.mygw"
- systemconfig["mythdns"]="192.168.100.100"
setup_DNSmasq(systemconfig["RunDHCP"],
systemconfig["mythip"],
diff --git a/abs/core-testing/LinHES-config/mv_install.py b/abs/core-testing/LinHES-config/mv_install.py
index 2f2d1c2..56118c1 100755
--- a/abs/core-testing/LinHES-config/mv_install.py
+++ b/abs/core-testing/LinHES-config/mv_install.py
@@ -137,14 +137,13 @@ def copy_updates():
cp_and_log2(MVROOT+"/bin/", data_config.MOUNTPOINT+MVROOT+"/bin", "*.py")
def timezone_to_db(timefile):
- logging.info("importing timezone needs")
+ logging.info("importing timezone")
try:
f = open(timefile)
timezonecontents = f.readline().strip()
f.close()
except:
logging.debug("Couldn't open /tmp/etc/timezone, will not set the timezone")
- updatedb("HostTimeZone", "Unknown");
return
update_db("HostTimeZone", timezonecontents);
tzsplit = timezonecontents.partition('/')
diff --git a/abs/core-testing/LinHES-config/mv_network.py b/abs/core-testing/LinHES-config/mv_network.py
index 855940f..3f8de3b 100755
--- a/abs/core-testing/LinHES-config/mv_network.py
+++ b/abs/core-testing/LinHES-config/mv_network.py
@@ -3,7 +3,7 @@ import sys , os, commands , glob, time, re
import logging
import mv_common
import socket, fcntl, struct, array
-import netifaces
+import netifaces, iplib
global etcnetdir
etcnetdir = "/etc/net/ifaces"
@@ -49,6 +49,25 @@ def get_ip(ifname):
struct.pack('256s', ifname[:15])
)[20:24])
+def get_default_route(iface):
+ rcroute = "127.0.0.1"
+ f = open ('/proc/net/route', 'r')
+ for line in f:
+ words = string.split (line)
+ netiface = words[0]
+ route = words[2]
+ flags = words[3]
+ try:
+ if ( netiface == iface ) and ( flags == "0003") :
+ route = iplib.IPv4Address(route, notation="hex")
+ t = str(route.get_dot())
+ s = t.split(".")
+ rcroute = s[3] + "." + s[2] + "." + s[1] + "." + s[0]
+ break
+ except ValueError:
+ pass
+ return rcroute
+
def setup_MYTH_IP(systemconfig):
default_interface = systemconfig["default_interface"]
#check for dhcp in use
@@ -64,6 +83,41 @@ def setup_MYTH_IP(systemconfig):
logging.debug(" Using %s as default ip", defaultip)
return defaultip
+
+def setup_MYTH_GW(systemconfig):
+ default_interface = systemconfig["default_interface"]
+ #check for dhcp in use
+ if setup_MYTH_DHCP(systemconfig) == "0":
+ logging.debug(" dhcp is in use, finding dhcp ip")
+ defaultgw = get_default_route(default_interface)
+ else:
+ try:
+ defaultgw = systemconfig["Hostgw"+default_interface]
+ except:
+ logging.debug(" Error occured finding the defaultgw")
+ defaultgw = "127.0.0.1"
+ logging.debug(" Using %s as default gw", defaultgw)
+ return defaultgw
+
+
+def setup_MTYH_DNS():
+ returndns = "127.0.0.1"
+ try:
+ f = open ('/etc/resolv.conf', 'r')
+ for line in f:
+ if line.startswith("nameserver"):
+ print line
+ returndns = line.split()[1]
+ break
+ except:
+ logging.debug(" Couldn't open /etc/resolv.conf for myth_dns")
+ logging.debug(" using %s for myth_dns", returndns)
+ return returndns
+
+
+
+
+
def flush(netdev):
logging.debug(" Flushing %s",netdev)
cmd = '''ip address flush dev %s''' %netdev
diff --git a/abs/core-testing/LinHES-config/systemconfig.py b/abs/core-testing/LinHES-config/systemconfig.py
index b2f8529..c559e09 100755
--- a/abs/core-testing/LinHES-config/systemconfig.py
+++ b/abs/core-testing/LinHES-config/systemconfig.py
@@ -75,6 +75,8 @@ def main(argv):
systemconfig["mythip"] = mv_network.setup_MYTH_IP(systemconfig)
systemconfig["mythdhcp"] = mv_network.setup_MYTH_DHCP(systemconfig)
+ systemconfig["mythgw"] = mv_network.setup_MYTH_DHCP(systemconfig)
+ systemconfig["mythdns"] = mv_network.setup_MYTH_DHCP(systemconfig)
if cmdmodule["all"]:
logging.info("*** WILL RUN ALL MODULES ***")