summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-config/systemconfig.py
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2012-09-29 20:10:02 (GMT)
committerJames Meyer <james.meyer@operamail.com>2012-09-29 20:10:02 (GMT)
commit822ebc824685b558d6baa1fe81d2ce58e2235808 (patch)
tree3b1d87f0954420908590e2be793c71c178d55382 /abs/core/LinHES-config/systemconfig.py
parent95144ae80ab0a96d02c11d4219f6841f59acf5fa (diff)
downloadlinhes_pkgbuild-822ebc824685b558d6baa1fe81d2ce58e2235808.zip
linhes_pkgbuild-822ebc824685b558d6baa1fe81d2ce58e2235808.tar.gz
linhes_pkgbuild-822ebc824685b558d6baa1fe81d2ce58e2235808.tar.bz2
LinHES config: several changes here
- added modules config_xml calling this will setup config.xml for mythtv and root user - install_db_chroot.sh will now generate the default settings and load them into a table - mv_install now calles myth_settings_wrapper.sh to load the default db
Diffstat (limited to 'abs/core/LinHES-config/systemconfig.py')
-rwxr-xr-xabs/core/LinHES-config/systemconfig.py86
1 files changed, 85 insertions, 1 deletions
diff --git a/abs/core/LinHES-config/systemconfig.py b/abs/core/LinHES-config/systemconfig.py
index 59df527..d65a1c6 100755
--- a/abs/core/LinHES-config/systemconfig.py
+++ b/abs/core/LinHES-config/systemconfig.py
@@ -51,6 +51,84 @@ def setup_x(systemconfig):
cmd = "%s/bin/xconfig.sh" %systemconfig.get("MVROOT")
mv_common.runcmd(cmd)
+
+def generate_config_xml(uuid,dbhost):
+ configxml_t ='''
+<Configuration>
+ <UPnP>
+ <UDN>
+ <MediaRenderer>%s</MediaRenderer>
+ </UDN>
+ <MythFrontend>
+ <DefaultBackend>
+ <DBHostName>%s</DBHostName>
+ <DBUserName>mythtv</DBUserName>
+ <DBPassword>mythtv</DBPassword>
+ <DBName>mythconverg</DBName>
+ <DBPort>0</DBPort>
+ </DefaultBackend>
+ </MythFrontend>
+ </UPnP>
+</Configuration>
+ '''
+ configxml= configxml_t %(uuid,dbhost)
+ return configxml
+
+def gen_uuid():
+ cmd = "/usr/bin/uuidgen"
+ uuid = mv_common.runcmd_output(cmd)
+ return uuid
+
+def setup_config_xml(systemconfig):
+ #setup mysql.txt and config.xml
+ logging.info(" setup config xml")
+
+ mv_root = systemconfig.get("MVROOT")
+ mysqltxt = "/usr/share/mythtv/mysql.txt"
+ configxml_file = "/usr/share/mythtv/config.xml"
+
+ templates = systemconfig.get("TEMPLATES")
+ mysqltemplate = templates + "/mysql.txt"
+ dbhost = systemconfig.get("dbhost")
+ uuid = gen_uuid()
+ config_xml=generate_config_xml(uuid,dbhost)
+ mv_common.mkdir_mythhome(data_config.MYTHHOME,"mythtv","mythtv")
+
+
+
+ delfile = data_config.MYTHHOME + "/.mythtv/mysql.txt"
+ mv_common.remove_file(delfile)
+ delfile = mv_root + "/bin/mythtv/.mythtv/mysql.txt"
+ mv_common.remove_file(delfile)
+ filecheck = data_config.MYTHHOME + "/templates/mysql.txt"
+ if os.path.exists(filecheck):
+ logging.info(" Scrapping all the previous work and using %s for mysql.txt", filecheck)
+ mv_common.cp_and_log(filecheck, mysqltxt)
+ try:
+ f = open(configxml_file, 'w')
+
+ for outline in config_xml:
+ f.write(outline)
+ f.close()
+ except:
+ logging.debug(" Couldn't write config.xml")
+
+ home_xml_file=data_config.MYTHHOME + "/.mythtv/config.xml"
+ mv_common.link_file(configxml_file,home_xml_file)
+
+ #setup link for root user
+ mv_common.mkdir_mythhome("/root","root","root")
+ home_xml_file="/root/.mythtv/config.xml"
+ mv_common.remove_file(home_xml_file)
+ mv_common.link_file(configxml_file,home_xml_file)
+
+
+
+
+
+
+
+
def main(argv):
try:
MVROOT = os.environ["MV_ROOT"]
@@ -74,7 +152,8 @@ def main(argv):
"plugins":False, "smolt":False,
"all":False, "dhcp_request":False ,
"func":False, "supplemental":False,
- "vnc":False, "fileshare":False }
+ "vnc":False, "fileshare":False,
+ "config_xml":False }
try:
opts, args = getopt.getopt(argv, 'c:hm:d:', ["help","modules" ] )
except getopt.GetoptError, why:
@@ -121,6 +200,7 @@ def main(argv):
cmdmodule["user"] = True
cmdmodule["vnc"] = True
cmdmodule["fileshare"] = True
+ cmdmodule["config_xml"] = True
##putting this here until I can create the seperate share module
#if cmdmodule["fileshare"]:
@@ -139,6 +219,10 @@ def main(argv):
logging.debug(" Setting the frontend to restart due to network change")
cmdmodule["restartfe"] = True
+ if cmdmodule["config_xml"]:
+ setup_config_xml(systemconfig)
+
+
if cmdmodule["func"]:
from mv_hostype import setup_func_minion
setup_func_minion(systemconfig.get("dbhost"),systemconfig.get("hostname"))