summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/LinHES-config/systemconfig.py
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2009-06-01 03:31:49 (GMT)
committerJames Meyer <james.meyer@operamail.com>2009-06-01 03:31:49 (GMT)
commit0275dd9b652a2bc4cce6011c49ee5a1595bb8fd0 (patch)
treeed3f8c3cd91edd93a2af8a0a3fb72e1625314eb9 /abs/core-testing/LinHES-config/systemconfig.py
parent45e93081254e4ff4a8da05b82e79e0645a40bcad (diff)
downloadlinhes_pkgbuild-0275dd9b652a2bc4cce6011c49ee5a1595bb8fd0.zip
linhes_pkgbuild-0275dd9b652a2bc4cce6011c49ee5a1595bb8fd0.tar.gz
linhes_pkgbuild-0275dd9b652a2bc4cce6011c49ee5a1595bb8fd0.tar.bz2
LinHES-config: adding more python modules.
Most things are not python, but network.sh is still used by install.
Diffstat (limited to 'abs/core-testing/LinHES-config/systemconfig.py')
-rwxr-xr-xabs/core-testing/LinHES-config/systemconfig.py116
1 files changed, 102 insertions, 14 deletions
diff --git a/abs/core-testing/LinHES-config/systemconfig.py b/abs/core-testing/LinHES-config/systemconfig.py
index 88961f6..1df4c39 100755
--- a/abs/core-testing/LinHES-config/systemconfig.py
+++ b/abs/core-testing/LinHES-config/systemconfig.py
@@ -3,8 +3,8 @@
import sys, os, commands, glob, time
import getopt, re, MySQLdb
import logging
-import hostype
-
+import mv_common , mv_network
+import inspect
#____________________________________________setup the logging______________________________________________________
LOG_FILENAME = '/tmp/systemconfig.log'
DEBUGLOG = '/tmp/systemconfig_debug.log'
@@ -12,10 +12,10 @@ logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
datefmt='%m-%d %H:%M',
filename=DEBUGLOG,
- filemode='a')
+ filemode='w')
# define a Handler which writes INFO messages or higher to the sys.stderr
console = logging.StreamHandler()
-console.setLevel(logging.DEBUG)
+console.setLevel(logging.INFO)
# set a format which is simpler for console use
#formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
formatter = logging.Formatter("%(message)s")
@@ -35,16 +35,28 @@ logging.getLogger('').addHandler(infofile)
def usage():
logging.info("tell people how to use this")
+def setup_x(systemconfig):
+ cmd = "%s/bin/xconfig.sh" %systemconfig["MVROOT"]
+ mv_common.runcmd(cmd)
+
def main(argv):
+ try:
+ MVROOT = os.environ["MV_ROOT"]
+ except:
+ logging.debug("MVROOT was not defined, using the default value")
+ MVROOT = "/usr/MythVantage"
+
global cmdmodule
+ global systemconfig
+ systemconfig["MVROOT"]=MVROOT
+ cmdmodule={"misc":False , "sleep":False , "hostype":False , "hostypec":False , "advanced":False , "audio":False , "network":False , "advancedX":False , "webuser":False , "restartfe":False , "reloadfe":False , "ddns":False , "screensaver":False , "ir":False , "this_is_install":False , "user":False, "software":False}
try:
opts, args = getopt.getopt(argv, 'c:hm:', ["help","modules" ] )
except getopt.GetoptError, why:
print why
usage()
- print "exception haappen"
+ print "exception happened"
sys.exit(2)
- cmdmodule = {"op": 'null'}
for opt, arg in opts:
if opt in ("-h", "--help"):
usage()
@@ -53,11 +65,77 @@ def main(argv):
for i in arg.split(","):
cmdmodule[i]=True
+ if cmdmodule["this_is_install"] or cmdmodule["hostypec"]:
+ systemconfig["hostypec"] = True
+
+ systemconfig["mythip"] = mv_network.setup_MYTH_IP(systemconfig)
+ systemconfig["mythdhcp"] = mv_network.setup_MYTH_DHCP(systemconfig)
+
if cmdmodule["hostype"]:
+ import hostype
+ cmdmodule["advancedX"] = False
+ setup_x(systemconfig)
+ cmdmodule["ir"] = True
hostype.hostypeprint(systemconfig)
+ if cmdmodule["network"]:
+ mv_network.setup_network(systemconfig)
+
+
+
+ if cmdmodule["ir"] == True:
+ import mv_ir
+ restartfe = mv_ir.setup_ir(systemconfig,data_config)
+ if restartfe == True:
+ logging.debug(" Setting the frontend to restart due to lirc change")
+ cmdmodule["restartfe"] = True
+
+ if cmdmodule["audio"] == True:
+ logging.debug("______Start of Audio Configuration______")
+ if not systemconfig["Audiotype"] == "tinker":
+ cmd="%s/bin/soundconfig.sh -t real -i %s -d %s" %(MVROOT,systemconfig["Audiotype"],systemconfig["SoundDevice"])
+ mv_common.runcmd(cmd)
+ else:
+ logging.debug(" Tinker mode(audio), not changing configuration")
+ logging.debug("__End of audio")
+
+ if cmdmodule["misc"]:
+ import mv_misc
+ mv_misc.setup_zip(MVROOT,systemconfig["zipcode"])
+ mv_misc.setup_tz(systemconfig["timezone"],systemconfig["TEMPLATES"])
+ mv_misc.setup_nfs(systemconfig)
+
+ if cmdmodule["sleep"]:
+ mv_misc.setup_sleep(systemconfig)
+
+ if cmdmodule["webuser"]:
+ import mv_webuser
+ mv_webuser.setup_web_auth(systemconfig["UseMythWEB_auth"])
+
+ if cmdmodule["screensaver"]:
+ import mv_screensaver
+ mv_screensaver.setup_screensaver(systemconfig, data_config)
+
+ if cmdmodule["advanced"]:
+ import mv_advanced
+ mv_advanced.setup_advanced(systemconfig, data_config)
+
+ if cmdmodule["software"]:
+ import mv_software
+ mv_software.setup_software(systemconfig, data_config)
+
+ if cmdmodule["advancedX"]:
+ setup_x(systemconfig)
+
+ if cmdmodule["restartfe"]:
+ mv_common.restartfe()
+
+ if cmdmodule["reloadfe"]:
+ mv_common.reloadfe()
+
if __name__ == "__main__":
+
config_file = "mv_config"
data_config = __import__(config_file, globals(), locals(), [])
#Read in systemconfig
@@ -76,13 +154,23 @@ if __name__ == "__main__":
var, val = line.rsplit("=", 1)
val = val.strip('"')
systemconfig[var.strip()] = val.strip()
-
+ systemconfig["TEMPLATES"] = os.environ["TEMPLATES"]
logging.debug("______START OF DEBUG______")
main(sys.argv[1:])
- logging.debug("______cmd line options______")
- for i in cmdmodule.items():
- logging.debug (i)
- logging.debug("______systemconfig______")
- for i in systemconfig.items():
- logging.debug(i)
- pass
+ #logging.debug("______cmd line options______")
+ #for i in cmdmodule.items():
+ #logging.debug (i)
+ #logging.debug("______systemconfig______")
+ #for i in systemconfig.items():
+ #logging.debug(i)
+ #pass
+
+
+
+
+
+
+
+
+
+