summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-config/mv_hostype.py
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2012-09-23 18:44:08 (GMT)
committerJames Meyer <james.meyer@operamail.com>2012-09-23 18:44:08 (GMT)
commit048e83695f2b4cb9ddc118e128a7d08f7d48e651 (patch)
tree2a4844ed9e01a42f5a7d344f531a71b6d30a1b20 /abs/core/LinHES-config/mv_hostype.py
parente36902486689cd6a12947fb1c8d3e01712b726b8 (diff)
downloadlinhes_pkgbuild-048e83695f2b4cb9ddc118e128a7d08f7d48e651.zip
linhes_pkgbuild-048e83695f2b4cb9ddc118e128a7d08f7d48e651.tar.gz
linhes_pkgbuild-048e83695f2b4cb9ddc118e128a7d08f7d48e651.tar.bz2
LinHES-config: ensure that xymonserver is installed after upgrades. This requires a --dbonly pacman call and then later a normal pacman install. This was needed because after upgrades /home/xymon is still on the FS and the xymonserver package failed to to install because of it
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)