summaryrefslogtreecommitdiffstats
path: root/abs
diff options
context:
space:
mode:
Diffstat (limited to 'abs')
-rw-r--r--abs/core/LinHES-config/PKGBUILD8
-rwxr-xr-xabs/core/LinHES-config/mv_common.py47
-rwxr-xr-xabs/core/LinHES-config/mv_hostype.py203
-rwxr-xr-xabs/core/LinHES-config/mv_install.py4
4 files changed, 229 insertions, 33 deletions
diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index 3d727cb..1f9f50b 100644
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=LinHES-config
pkgver=2.3
-pkgrel=47
+pkgrel=50
conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev LinHes-config )
pkgdesc="Install and configure your system"
depends=('bc' 'libstatgrab' 'mysql-python' 'expect' 'curl' 'dnsutils' 'parted'
@@ -101,7 +101,7 @@ build() {
install -m 0755 issue $startdir/pkg/etc/issue
}
-md5sums=('6c0cbf0207f39a961d78861215109044'
+md5sums=('f6bca2af75ddb0902f0fa9ff4b6e4fd7'
'16b98fcb3753ef6cfc35075c326d30e4'
'e36da536dd651ef182e7642337889e77'
'985891a43f7c4c983eb2a362162f1a0f'
@@ -123,7 +123,7 @@ md5sums=('6c0cbf0207f39a961d78861215109044'
'3d1e4a119f38cff0498bf8a67e94e4b3'
'71fd2d0d448fc2fcd15415a1beed7109'
'5f3259afe031fda189edae41dd1458f0'
- '252ae3a088948a0d125ea6e8daa211f5'
+ 'c50dc0d6e103b16ccf8c41eb83991441'
'b845de3e05c1734cce4b9ac5e8f1baaf'
'4d0464a1bef1819f6f9c100609eb55ad'
'5e69839659d65ddda35b8a9982dc29e9'
@@ -132,7 +132,7 @@ md5sums=('6c0cbf0207f39a961d78861215109044'
'fe5e31b833cc6707209e9d656b6eb53c'
'f0988a801216b44c96bf17e24a23e3a9'
'23d0e12b7ca1cc6ea6b993c1d7ff20b9'
- '8a713ce49211eb0b91c84ba0b9cf52fe'
+ '3deb6a41a6b4e9f4f125678fa26078c6'
'5e3e06b31c40fe6b0e74860a8137b720'
'2596460462cf6c889cf8f95485537b20'
'a63ff9ef5250965aeabc74bfa8e43981')
diff --git a/abs/core/LinHES-config/mv_common.py b/abs/core/LinHES-config/mv_common.py
index 5257a5a..0f78312 100755
--- a/abs/core/LinHES-config/mv_common.py
+++ b/abs/core/LinHES-config/mv_common.py
@@ -2,6 +2,7 @@
import logging, os, time
import commands
import ConfigParser
+import urllib2
config_file = "mv_config"
data_config = __import__(config_file, globals(), locals(), [])
@@ -11,6 +12,38 @@ try:
except:
logging.info("couldn't read mythvantage.cfg")
+class config_extra_reader(object):
+ def __init__(self,url):
+ self.url=url
+ self.Config = ConfigParser.ConfigParser()
+ req = urllib2.Request(url)
+ response = urllib2.urlopen(req)
+ self.Config.readfp(response)
+
+ def print_url(self):
+ print self.url
+
+
+ def print_sections(self):
+ print self.Config.sections()
+
+
+ def read_config(self,data):
+ rvalue = True
+ section = "extra"
+ try:
+ rvalue = self.Config.get(section, data)
+ if rvalue == "False":
+ rvalue = False
+ if rvalue == "no":
+ rvalue = False
+ except:
+ logging.debug("Couldn't read config_file")
+ rvalue = True
+
+ return rvalue
+
+
def read_config(module_config,data):
rvalue = True
@@ -61,6 +94,20 @@ def cp_and_log(srcfile,destfile):
cmd = ("rsync -arhp %s %s") %(srcfile,destfile)
runcmd(cmd)
+def link_file(srcfile,link_name):
+ logging.info(" Trying to link %s -> %s",srcfile,link_name)
+ if not os.path.exists(srcfile):
+ logging.info(" %s is not present, skipping...",srcfile)
+ elif os.path.exists(link_name):
+ logging.info(" %s is present, skipping...",link_name)
+ else:
+ try:
+ os.symlink(srcfile, link_name)
+ except:
+ logging.info(" Problem linking files occured")
+
+ return
+
def add_service(daemon):
logging.info(" Adding service %s",daemon)
diff --git a/abs/core/LinHES-config/mv_hostype.py b/abs/core/LinHES-config/mv_hostype.py
index fd04a18..9f26e57 100755
--- a/abs/core/LinHES-config/mv_hostype.py
+++ b/abs/core/LinHES-config/mv_hostype.py
@@ -59,15 +59,50 @@ def setup_mysqlnetwork(EnableNetwork):
mv_common.runcmd(cmd)
mv_common.restart_service("mysqld")
+
+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_mysql_connection(systemconfig):
+ #setup mysql.txt and config.xml
logging.info(" Configuring database connection")
mythip = systemconfig.get("mythip")
systemtype = systemconfig.get("SystemType")
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)
+
+
if systemtype == "Master_backend":
logging.debug(" Setting dbhost to %s in systemconfig", mythip)
@@ -101,6 +136,20 @@ def setup_mysql_connection(systemconfig):
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)
+
+
+
@@ -110,24 +159,96 @@ def setup_func_key():
cmd="/usr/MythVantage/bin/grabkey.py"
mv_common.runcmd(cmd)
-def setup_func_minion(dbhost):
- logging.info(" Setting up the func minion:")
+def setup_func_minion(dbhost,hostname):
+ logging.info(" Setting up the func minion: %s", hostname)
logging.debug(" certmaster is %s:",dbhost)
#cmd='''sed -i "s/^certmaster.*$/certmaster = %s/" /etc/func/minion.conf ''' %dbhost
#mv_common.runcmd(cmd)
cmd='''sed -i "s/^certmaster.*$/certmaster = %s/" /etc/certmaster/minion.conf ''' %dbhost
mv_common.runcmd(cmd)
+ cmd='''sed -i "s/^minion_name.*$/minion_name = %s/" /etc/func/minion.conf ''' %hostname
+ mv_common.runcmd(cmd)
def setup_syslog(dbhost):
logging.debug(" Setting syslog to log to %s",dbhost)
cmd ='''sed -i "s/^destination d_remote.*$/destination d_remote \{tcp\(\"%s\" port\(514\)\) \;\} \;/" /etc/syslog-ng.conf''' %dbhost
return
+def setup_rsyslog_server(enable_network):
+ syslog_conf_file="/etc/rsyslog.d/network.conf"
+ syslog_client_file="/etc/rsyslog.d/client.conf"
+ contents='''
+# ######### Receiving Messages from Remote Hosts ##########
+# TCP Syslog Server:
+# provides TCP syslog reception and GSS-API (if compiled to support it)
+$ModLoad imtcp.so # load module
+$InputTCPServerRun 514 # start up TCP listener at port 514
+# UDP Syslog Server:
+$ModLoad imudp.so # provides UDP syslog reception
+$UDPServerRun 514 # start a UDP syslog server at standard port 514
+'''
+ mv_common.remove_file(syslog_client_file)
+ if enable_network:
+ logging.info("____Enabling rsyslog network____")
+ try:
+ f = open(syslog_conf_file,'w')
+ except:
+ print "%s could not be opened" %syslog_conf_file
+ logging.debug("could not open %s" %syslog_conf_file)
+ return
+ f.write(contents)
+ f.write("\n")
+ f.close()
+ else:
+ logging.info("____Disabline rsyslog network____")
+ mv_common.remove_file(syslog_conf_file)
+
+ return
+
+def setup_rsyslog_client(rsyslog_server):
+ contents='''
+# Remote Logging (we use TCP for reliable delivery)
+# An on-disk queue is created for this action. If the remote host is
+# down, messages are spooled to disk and sent when it is up again.
+$WorkDirectory /var/spool/rsyslog # where to place spool files
+$ActionQueueFileName uniqName # unique name prefix for spool files
+$ActionQueueMaxDiskSpace 1g # 1gb space limit (use as much as possible)
+$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
+$ActionQueueType LinkedList # run asynchronously
+$ActionResumeRetryCount -1 # infinite retries if host is down
+# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional
+*.* @@%s:514
+'''
+
+ logging.info("____Enabling rsyslog network client____")
+ logging.info(" syslog_server: %s", rsyslog_server)
+ syslog_client_file="/etc/rsyslog.d/client.conf"
+ syslog_conf_file="/etc/rsyslog.d/network.conf"
+ try:
+ f = open(syslog_client_file,'w')
+ except:
+ print "%s could not be opened" %syslog_client_file
+ return
+ f.write(contents %rsyslog_server)
+ f.write("\n")
+ f.close()
+ mv_common.remove_file(syslog_conf_file)
+ cmd="mkdir -p /var/spool/rsyslog"
+ mv_common.runcmd(cmd)
+ return
+
def hostypeprint(systemconfig):
if mv_common.read_config(mv_common.module_config,"hostype") == False :
logging.info("____Skipping of hostype, config disabled____")
return
logging.info("______Start of hostype config_____")
+
+ url = 'http://%s:1337/extra.cfg.txt' %systemconfig.get("dbhost")
+ ex = mv_common.config_extra_reader(url)
+ xymon_supported=ex.read_config('xymon')
+ rsyslog_network=ex.read_config('rsyslog_network')
+ func_supported=ex.read_config('func')
+
mv_common.services(systemconfig)
install_list=''
remove_list=''
@@ -135,6 +256,9 @@ def hostypeprint(systemconfig):
daemon_remove_list=''
run_mysqlnetwork = False
+ profile_status="/etc/profile.d/z_myth_status.sh"
+ myth_status="/usr/LH/bin/myth_status.sh"
+
if systemconfig.get("SystemType") == "Standalone":
logging.info("Stand alone system being configured")
setup_ntp(False,"null")
@@ -145,8 +269,16 @@ def hostypeprint(systemconfig):
setup_db()
install_list=["mysql", "mythdb-initial", "avahi", "rpcbind", "nfs-utils", "local-website", "myth2ipod", "mythtv-status"]
daemon_list=["mysql", "mythbackend", "avahi", "rpcbind", "nfs-common", "netfs", "lighttpd"]
- if data_config.SYSTEMTYPE == "MythVantage":
- install_list.append('ghosd')
+
+
+ mv_common.link_file(myth_status,profile_status)
+ setup_rsyslog_server(False)
+ if func_supported:
+ install_list.append('func')
+ daemon_list.append('funcd')
+ install_list.append('certmaster')
+ daemon_list.append('certmaster')
+
elif systemconfig.get("SystemType") == "Master_backend":
logging.info("Master backend system being configured")
@@ -156,48 +288,64 @@ def hostypeprint(systemconfig):
daemon_list=["mysql", "mythbackend", "avahi", "rpcbind", "nfs-common", "netfs", "lighttpd"]
EnableNetwork = True
run_mysqlnetwork = True
- if data_config.SYSTEMTYPE == "MythVantage":
+ mv_common.link_file(myth_status,profile_status)
+
+ setup_rsyslog_server(True)
+ if func_supported:
+ #if data_config.SYSTEMTYPE == "MythVantage":
install_list.append('func')
- daemon_list.append('func')
+ daemon_list.append('funcd')
install_list.append('certmaster')
daemon_list.append('certmaster')
- install_list.append('ghosd')
+
elif systemconfig.get("SystemType") == "Slave_backend":
logging.info("Slave backend system being configured")
setup_ntp(True,systemconfig.get("dbhost"))
remove_avahi_service()
+ mv_common.link_file(myth_status,profile_status)
+
if systemconfig.get("hostypec"):
setup_db()
- install_list = ["rpcbind", "nfs-utils", "local-website", "avahi", "libmysqlclient" ]
- daemon_list = ["mythbackend", "rpcbind", "nfs-common", "netfs", "lighttpd", "avahi" ]
+ install_list = ["rpcbind", "nfs-utils", "avahi", "libmysqlclient" ]
+ daemon_list = ["mythbackend", "rpcbind", "nfs-common", "netfs", "avahi" ]
+
daemon_remove_list=('mysql')
- if data_config.SYSTEMTYPE == "MythVantage":
- install_list.remove("local-website")
- daemon_list.remove("lighttpd")
+ daemon_list.remove("lighttpd")
+ remove_list.append("lighttpd")
+
+ if func_supported:
install_list.append('func')
daemon_list.append('funcd')
- remove_list.append("lighttpd")
- install_list.append('ghosd')
+
+ if xymon_supported:
+ install_list.append('xymonclient')
+ daemon_list.append('xymon-client')
+
+ setup_rsyslog_client(systemconfig.get("dbhost"))
elif systemconfig.get("SystemType") == "Frontend_only":
logging.info("Frontend only system being configured")
setup_ntp(True,systemconfig.get("dbhost"))
remove_avahi_service()
- install_list=["mysql-clients", "libmysqlclient", "avahi", "rpcbind", "nfs-utils", "local-website"]
- remove_list=["mysql"]
- daemon_list=["mysql", "mythbackend", "avahi", "rpcbind", "nfs-common", "netfs", "lighttpd"]
- daemon_remove_list=("mysql", "mythbackend")
- if data_config.SYSTEMTYPE == "MythVantage":
- install_list.remove("local-website")
- daemon_list.remove("lighttpd")
+ install_list=["mysql-clients", "libmysqlclient", "avahi", "rpcbind", "nfs-utils"]
+ remove_list=["mysql","lighttpd"]
+
+ daemon_list=["mysql", "mythbackend", "avahi", "rpcbind", "nfs-common", "netfs" ]
+ daemon_remove_list=["mysql", "mythbackend","lighttpd"]
+ if xymon_supported:
+ install_list.append('xymonclient')
+ daemon_list.append('xymon-client')
+
+ if func_supported:
install_list.append('func')
daemon_list.append('funcd')
- remove_list.append("lighttpd")
- install_list.append('ghosd')
+ #install_list.append('ghosd')
+ setup_rsyslog_client(systemconfig.get("dbhost"))
+ mv_common.restart_service("rsyslog")
for pkg in install_list:
mv_common.pacinstall(pkg)
for pkg in remove_list:
@@ -206,6 +354,7 @@ def hostypeprint(systemconfig):
mv_common.add_service(daemon)
for daemon in daemon_remove_list:
mv_common.remove_service(daemon)
+
if systemconfig.get("RunFrontend") == "1":
logging.debug(" Will run the frontend")
mv_common.add_service("frontend")
@@ -226,8 +375,8 @@ def hostypeprint(systemconfig):
logging.debug(" Not running setup_mysql_connection")
setup_mysql_connection(systemconfig)
- if data_config.SYSTEMTYPE == "MythVantage":
- setup_func_minion(systemconfig.get("dbhost"))
- setup_func_key()
- setup_syslog(systemconfig.get("dbhost"))
+ if func_supported:
+ setup_func_minion(systemconfig.get("dbhost"),systemconfig.get("hostname"))
+
+
logging.info("__End of hostype config\n")
diff --git a/abs/core/LinHES-config/mv_install.py b/abs/core/LinHES-config/mv_install.py
index 922b921..85220cf 100755
--- a/abs/core/LinHES-config/mv_install.py
+++ b/abs/core/LinHES-config/mv_install.py
@@ -555,9 +555,9 @@ def create_fstab(extralines):
fstab_list.append(line)
line = '''/dev/sr0 /media/cdrom auto ro,user,noauto,unhide 0 0\n'''
fstab_list.append(line)
- line = '''UUID=ROOTUID / auto defaults,noatime 0 1\n'''
+ line = '''UUID=ROOTUID / auto defaults,noatime,acl 0 1\n'''
fstab_list.append(line)
- line = '''UUID=DATAUID %s auto defaults,noatime 0 1\n''' %(data_config.DATAMOUNT)
+ line = '''UUID=DATAUID %s auto defaults,noatime,acl 0 1\n''' %(data_config.DATAMOUNT)
fstab_list.append(line)
line = '''UUID=SWAPUID swap swap defaults 0 0 \n'''
fstab_list.append(line)