summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-config/mv_hostype.py
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/LinHES-config/mv_hostype.py')
-rwxr-xr-xabs/core/LinHES-config/mv_hostype.py91
1 files changed, 63 insertions, 28 deletions
diff --git a/abs/core/LinHES-config/mv_hostype.py b/abs/core/LinHES-config/mv_hostype.py
index 2cbd97a..5655986 100755
--- a/abs/core/LinHES-config/mv_hostype.py
+++ b/abs/core/LinHES-config/mv_hostype.py
@@ -104,6 +104,34 @@ def setup_mysql_connection(systemconfig):
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.link_file(configxml_file,home_xml_file)
+
+
+
if systemtype == "Master_backend":
logging.debug(" Setting dbhost to %s in systemconfig", mythip)
dbhost = mythip
@@ -112,7 +140,8 @@ def setup_mysql_connection(systemconfig):
logging.debug(" Changing dbhost in settings table for master_backend")
#cmd = '''%s/bin/restore_default_settings.sh -c BECONFIG -s master -a %s ''' %(mv_root, dbhost)
cmd = '''%s/bin/myth_settings_wrapper.sh -c BECONFIG -s master -a %s ''' %(mv_root, dbhost)
- mv_common.runcmd(cmd)
+ b=mv_common.runcmd_output(cmd)
+ logging.debug(b)
#mv_common.reloadfe(systemconfig.get("dbhost"),True)
if systemtype == "Slave_backend":
@@ -120,7 +149,9 @@ def setup_mysql_connection(systemconfig):
logging.debug(" Changing slave in settings: %s", slavehost)
cmd = '''%s/bin/myth_settings_wrapper.sh -c BECONFIG -s slave -a %s ''' %(mv_root, slavehost)
#cmd = '''%s/bin/restore_default_settings.sh -c BECONFIG -s slave -a %s ''' %(mv_root, slavehost)
- mv_common.runcmd(cmd)
+ b=mv_common.runcmd_output(cmd)
+ logging.debug(b)
+
if systemtype == "Standalone":
logging.debug(" changing mysql.txt file to use localhost")
@@ -130,36 +161,40 @@ def setup_mysql_connection(systemconfig):
#mv_common.reloadfe(systemconfig.get("dbhost"),True)
cmd = '''%s/bin/myth_settings_wrapper.sh -c BECONFIG -s standalone ''' %(mv_root)
- mv_common.runcmd(cmd)
+ b=mv_common.runcmd_output(cmd)
+ logging.debug(b)
+
#mv_common.reloadfe(systemconfig.get("dbhost"),True)
logging.debug(" Running beconfig a 2nd time")
cmd = '''%s/bin/myth_settings_wrapper.sh -c BECONFIG -s standalone ''' %(mv_root)
- mv_common.runcmd(cmd)
- else:
- logging.debug(" changing mysql.txt file to use %s", dbhost)
- cmd = '''sed -e "s/^DBHostName=.*$/DBHostName=%s/" %s > %s ''' %(dbhost, mysqltemplate, mysqltxt)
- mv_common.runcmd(cmd)
-
- 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)
+ #mv_common.runcmd(cmd)
+ b=mv_common.runcmd_output(cmd)
+ logging.debug(b)
+ #else:
+ #logging.debug(" changing mysql.txt file to use %s", dbhost)
+ #cmd = '''sed -e "s/^DBHostName=.*$/DBHostName=%s/" %s > %s ''' %(dbhost, mysqltemplate, mysqltxt)
+ #mv_common.runcmd(cmd)
+
+ #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)