summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/LinHES-config
diff options
context:
space:
mode:
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_hostype.py20
-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
5 files changed, 68 insertions, 16 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_hostype.py b/abs/core-testing/LinHES-config/mv_hostype.py
index b3899ff..5d033fa 100755
--- a/abs/core-testing/LinHES-config/mv_hostype.py
+++ b/abs/core-testing/LinHES-config/mv_hostype.py
@@ -138,15 +138,15 @@ def hostypeprint(systemconfig):
run_mysqlnetwork = True
if systemconfig["hostypec"]:
setup_db()
- install_list=("mysql", "mythdb-initial", "avahi", "portmap", "nfs-utils", "local-website", "myth2ipod", "mythtv-status")
- daemon_list=("mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd")
+ install_list=["mysql", "mythdb-initial", "avahi", "portmap", "nfs-utils", "local-website", "myth2ipod", "mythtv-status"]
+ daemon_list=["mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd"]
elif systemconfig["SystemType"] == "Master_backend":
logging.info("Master backend system being configured")
setup_ntp(False,"null")
setup_avahi(systemconfig["TEMPLATES"])
- install_list=("mysql", "mythdb-initial", "avahi", "portmap", "nfs-utils", "local-website", "myth2ipod", "mythtv-status")
- daemon_list=("mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd")
+ install_list=["mysql", "mythdb-initial", "avahi", "portmap", "nfs-utils", "local-website", "myth2ipod", "mythtv-status"]
+ daemon_list=["mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd"]
EnableNetwork = True
run_mysqlnetwork = True
if data_config.SYSTEMTYPE == "MythVantage":
@@ -160,8 +160,8 @@ def hostypeprint(systemconfig):
remove_avahi_service()
if systemconfig["hostypec"]:
setup_db()
- install_list=("portmap", "nfs-utils", "local-website", "avahi", 'libmysqlclient')
- daemon_list=("mythbackend", "portmap", "nfs-utils", "netfs", "lighttpd", "avahi")
+ install_list = ["portmap", "nfs-utils", "local-website", "avahi", "libmysqlclient" ]
+ daemon_list = ["mythbackend", "portmap", "nfs-utils", "netfs", "lighttpd", "avahi" ]
daemon_remove_list=('mysql')
if data_config.SYSTEMTYPE == "MythVantage":
install_list.remove("local-website")
@@ -175,9 +175,9 @@ def hostypeprint(systemconfig):
logging.info("Frontend only system being configured")
setup_ntp(True,systemconfig["dbhost"])
remove_avahi_service()
- install_list=("mysql-clients", "libmysqlclient", "avahi", "portmap", "nfs-utils", "local-website")
- remove_list=("mysql")
- daemon_list=("mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd")
+ install_list=["mysql-clients", "libmysqlclient", "avahi", "portmap", "nfs-utils", "local-website"]
+ remove_list=["mysql"]
+ daemon_list=["mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd"]
daemon_remove_list=("mysql", "mythbackend")
if data_config.SYSTEMTYPE == "MythVantage":
install_list.remove("local-website")
@@ -213,7 +213,7 @@ def hostypeprint(systemconfig):
setup_mysql_connection(systemconfig)
if data_config.SYSTEMTYPE == "MythVantage":
- setup_func_minion(dbhost)
+ setup_func_minion(systemconfig["dbhost"])
setup_func_key()
setup_syslog(systemconfig["dbhost"])
logging.info("__End of hostype config\n")
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 ***")