summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-config/systemconfig.py
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2017-12-05 20:33:02 (GMT)
committerBritney Fransen <brfransen@gmail.com>2017-12-05 20:33:02 (GMT)
commitb4cbf8341a0142ae3accedf7d1d4d9ae6b0e4060 (patch)
treed0efa85c39dac5e2252ab3850e488061d17e9021 /abs/core/LinHES-config/systemconfig.py
parent6f920153a05f27e1d50613a80534e1650355e0aa (diff)
downloadlinhes_pkgbuild-b4cbf8341a0142ae3accedf7d1d4d9ae6b0e4060.zip
linhes_pkgbuild-b4cbf8341a0142ae3accedf7d1d4d9ae6b0e4060.tar.gz
linhes_pkgbuild-b4cbf8341a0142ae3accedf7d1d4d9ae6b0e4060.tar.bz2
LinHES-config: systemconfig.py: change config_xml file location to /home/mythtv/.mythtv and link root and share.
myth_settings_wrapper.sh: add new mythtv 29 network setting mv_install.py: start mysql eariler for master backend installs so systemconfig will correct BackendIP and BackendAddr.
Diffstat (limited to 'abs/core/LinHES-config/systemconfig.py')
-rwxr-xr-xabs/core/LinHES-config/systemconfig.py74
1 files changed, 32 insertions, 42 deletions
diff --git a/abs/core/LinHES-config/systemconfig.py b/abs/core/LinHES-config/systemconfig.py
index ef5fef1..bd02408 100755
--- a/abs/core/LinHES-config/systemconfig.py
+++ b/abs/core/LinHES-config/systemconfig.py
@@ -1,6 +1,7 @@
#!/usr/bin/python2
# -*- coding: utf-8 -*-
import sys, os, commands, glob, time
+from time import time, localtime, strftime
import getopt, re, MySQLdb
import logging
import mv_common , mv_network
@@ -67,9 +68,9 @@ def setup_x(systemconfig):
if mv_common.read_config(mv_common.module_config,"xorg") == False :
logging.info("____Skipping of Xorg, config disabled____")
else:
- if not os.path.exists('/usr/share/icons/default'):
- if os.path.exists('/usr/share/icons/Vanilla-DMZ-AA'):
- os.symlink('/usr/share/icons/Vanilla-DMZ-AA','/usr/share/icons/default');
+ if not os.path.exists('/usr/share/icons/default'):
+ if os.path.exists('/usr/share/icons/Vanilla-DMZ-AA'):
+ mv_common.link_file('/usr/share/icons/Vanilla-DMZ-AA','/usr/share/icons/default');
if systemconfig.get("UseXLargeMouse") == "1" :
cmd = "echo Xcursor.size: 48 > %s/.Xdefaults" %data_config.MYTHHOME
else:
@@ -81,26 +82,8 @@ def setup_x(systemconfig):
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_t='''
- <Configuration>
+<Configuration>
<LocalHostName>my-unique-identifier-goes-here</LocalHostName>
<Database>
<PingHost>1</PingHost>
@@ -136,11 +119,16 @@ def gen_uuid():
def setup_config_xml(systemconfig):
#setup mysql.txt and config.xml
- logging.info(" setup 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"
+ #mythfrontend will delete and create config.xml in the mythhome dir
+ #this breaks the link to /usr/share/mythtv/config.xml and causes other
+ #users (root) to be out of sync mythtv user
+ configxml_file = data_config.MYTHHOME + "/.mythtv/config.xml"
+ configxml_share_link = "/usr/share/mythtv/config.xml"
+ configxml_root_link = "/root/.mythtv/config.xml"
templates = systemconfig.get("TEMPLATES")
mysqltemplate = templates + "/mysql.txt"
@@ -148,18 +136,29 @@ def setup_config_xml(systemconfig):
uuid = gen_uuid()
config_xml=generate_config_xml(uuid,dbhost)
mv_common.mkdir_mythhome(data_config.MYTHHOME,"mythtv","mythtv")
-
-
+ mv_common.mkdir_mythhome("/root","root","root")
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)
+
+ #backup config.xml files and delete
+ currenttime = strftime("%b-%d-%Y-%H:%M:%S", localtime())
+ for i in [ configxml_file , configxml_share_link, configxml_root_link ]:
+ if os.path.islink(i):
+ # path is a link, delete it
+ logging.info(" Removing link %s ", i)
+ mv_common.remove_file(i)
+ else:
+ # path is a file, backup and delete unless it is mythhome
+ if configxml_file != i:
+ cmd = "mv %s %s-%s" %(i,i,currenttime)
+ mv_common.runcmd_output(cmd)
+
+ #create config.xml
try:
+ logging.info(" Writing %s", configxml_file)
f = open(configxml_file, 'w')
for outline in config_xml:
@@ -168,18 +167,9 @@ def setup_config_xml(systemconfig):
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)
-
-
-
-
+ #link /usr/share/mythtv/config.xml and /root/.mythtv/config.xml
+ mv_common.link_file(configxml_file,configxml_share_link)
+ mv_common.link_file(configxml_file,configxml_root_link)