summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/LinHES-config
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2009-06-01 03:31:49 (GMT)
committerJames Meyer <james.meyer@operamail.com>2009-06-01 03:31:49 (GMT)
commit0275dd9b652a2bc4cce6011c49ee5a1595bb8fd0 (patch)
treeed3f8c3cd91edd93a2af8a0a3fb72e1625314eb9 /abs/core-testing/LinHES-config
parent45e93081254e4ff4a8da05b82e79e0645a40bcad (diff)
downloadlinhes_pkgbuild-0275dd9b652a2bc4cce6011c49ee5a1595bb8fd0.zip
linhes_pkgbuild-0275dd9b652a2bc4cce6011c49ee5a1595bb8fd0.tar.gz
linhes_pkgbuild-0275dd9b652a2bc4cce6011c49ee5a1595bb8fd0.tar.bz2
LinHES-config: adding more python modules.
Most things are not python, but network.sh is still used by install.
Diffstat (limited to 'abs/core-testing/LinHES-config')
-rw-r--r--abs/core-testing/LinHES-config/hostype.py147
-rw-r--r--abs/core-testing/LinHES-config/ir.py41
-rw-r--r--abs/core-testing/LinHES-config/mv_advanced.py352
-rw-r--r--abs/core-testing/LinHES-config/mv_common.py94
-rwxr-xr-xabs/core-testing/LinHES-config/mv_config.py1
-rw-r--r--abs/core-testing/LinHES-config/mv_ir.py288
-rw-r--r--abs/core-testing/LinHES-config/mv_misc.py167
-rw-r--r--abs/core-testing/LinHES-config/mv_network.py277
-rw-r--r--abs/core-testing/LinHES-config/mv_screensaver.py199
-rw-r--r--abs/core-testing/LinHES-config/mv_software.py41
-rw-r--r--abs/core-testing/LinHES-config/mv_webuser.py19
-rwxr-xr-xabs/core-testing/LinHES-config/systemconfig.py116
-rw-r--r--abs/core-testing/LinHES-config/webuser.py23
13 files changed, 1748 insertions, 17 deletions
diff --git a/abs/core-testing/LinHES-config/hostype.py b/abs/core-testing/LinHES-config/hostype.py
index 928c038..4dde3dc 100644
--- a/abs/core-testing/LinHES-config/hostype.py
+++ b/abs/core-testing/LinHES-config/hostype.py
@@ -1,6 +1,147 @@
# -*- coding: utf-8 -*-
-import logging
+import logging, mv_common
+import os
+
+config_file = "mv_config"
+data_config = __import__(config_file, globals(), locals(), [])
+
+def setup_ntp(usepool,ntpserver):
+ if usepool:
+ logging.info("Setting ntp server to %s",ntpserver)
+ print '''sed -i "s/pool.ntp.org/$dbhost/g" ${BASE}/etc/ntp.conf'''
+ else:
+ logging.info("Not changing ntp configuration")
+
+def setup_avahi(templates):
+ file="/etc/avahi/services/mysql.service"
+ if not os.path.exists(file):
+ logging.debug(" copying in mysql.service for avahi")
+ try:
+ os.makedirs("/etc/avahi/services")
+ except:
+ logging.debug(" Couldn't create /etc/avahi/services")
+ mv_common.cp_and_log(template+"/mysql.service",file)
+ cmd="sudo sv restart avahi"
+ mv_common.runcmd(cmd)
+
+def remove_avahi_service():
+ file="/etc/avahi/services/mysql.service"
+ if os.path.exists(file):
+ logging.debug(" Removing avahi mysql.service file")
+ cmd="rm -rf %s" %file
+ runcmd(cmd)
+ cmd="sudo sv restart avahi"
+ mv_common.runcmd(cmd)
+
+def setup_db():
+ logging.debug(" Setting up the database")
+
+def setup_mysqlnetwork():
+ logging.debug(" Setting up mysql network")
+
+def setup_mysql():
+ logging.debug(" Configuring mysql")
+
+def setup_func_key():
+ if data_config.SYSTEMTYPE == "MythVantage":
+ logging.debug(" Grabbing the key for Func")
+ cmd="/usr/MythVantage/bin/grabkey.py"
+ mv_common.runcmd(cmd)
+
+def setup_func_minion(dbhost):
+ logging.info(" Setting up the func minion:")
+ logging.debug(" certmaster is %s:",dbhost)
+ cmd='''sed -i "s/^certmaster.*$/certmaster = %s/" /etc/func/minion.conf ''' %dbhost
+ 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 hostypeprint(systemconfig):
- print "hostran"
- print systemconfig["Hostipeth0"] \ No newline at end of file
+ logging.debug("______Start of hostype config_____")
+ mv_common.services(systemconfig)
+ install_list=''
+ remove_list=''
+ daemon_list=''
+ daemon_remove_list=''
+
+ if systemconfig["SystemType"] == "Standalone":
+ logging.info("Stand alone system being configured")
+ setup_ntp(False,"null")
+ remove_avahi_service()
+ if systemconfig["hostypec"]:
+ setup_db()
+ install_list=("mysql", "mythdb-initial", "avahi", "portmap", "nfs-utils", "local-website", "myth2ipod", "mythtv-status")
+ daemon_list=("mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd")
+
+ elif systemconfig["SystemType"] == "Master_backend":
+ logging.info("Master backend system being configured")
+ setup_ntp(False,"null")
+ setup_avahi(systemconfig["TEMPLATES"])
+ install_list=("mysql", "mythdb-initial", "avahi", "portmap", "nfs-utils", "local-website", "myth2ipod", "mythtv-status")
+ daemon_list=("mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd")
+ if data_config.SYSTEMTYPE == "MythVantage":
+ install_list.append('func')
+ install_list.append('certmaster')
+ daemon_list.append('certmaster')
+
+ elif systemconfig["SystemType"] == "Slave_backend":
+ logging.info("Slave backend system being configured")
+ setup_ntp(True,systemconfig["dbhost"])
+ remove_avahi_service()
+ if systemconfig["hostypec"]:
+ setup_db()
+ install_list=("portmap", "nfs-utils", "local-website", "avahi", 'libmysqlclient')
+ daemon_list=("mythbackend", "portmap", "nfs-utils", "netfs", "lighttpd", "avahi")
+ daemon_remove_list=('mysql')
+ if data_config.SYSTEMTYPE == "MythVantage":
+ install_list.remove("local-website")
+ daemon_list.remove("lighttpd")
+ install_list.append('func')
+ daemon_list.append('funcd')
+ remove_list.append("lighttpd")
+
+
+ elif systemconfig["SystemType"] == "Frontend_only":
+ logging.info("Frontend only system being configured")
+ setup_ntp(True,systemconfig["dbhost"])
+ remove_avahi_service()
+ install_list=("mysql-clients", "libmysqlclient", "avahi", "portmap", "nfs-utils", "local-website")
+ remove_list=("mysql")
+ daemon_list=("mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd")
+ daemon_remove_list=("mysql", "mythbackend")
+ if data_config.SYSTEMTYPE == "MythVantage":
+ install_list.remove("local-website")
+ daemon_list.remove("lighttpd")
+ install_list.append('func')
+ daemon_list.append('funcd')
+ remove_list.append("lighttpd")
+
+
+
+ for pkg in install_list:
+ mv_common.pacinstall(pkg)
+ for pkg in remove_list:
+ mv_common.pacinstall(pkg)
+ for daemon in daemon_list:
+ mv_common.add_service(daemon)
+ for daemon in daemon_remove_list:
+ mv_common.remove_service(daemon)
+ if systemconfig["RunFrontend"] == "1":
+ logging.debug(" Will run the frontend")
+ mv_common.add_service("frontend")
+ mv_common.add_service("hal")
+ else:
+ logging.debug(" Will NOT run the frontend")
+ mv_common.remove_service("frontend")
+ mv_common.remove_service("hal")
+
+ setup_mysqlnetwork()
+ setup_mysql()
+ if data_config.SYSTEMTYPE == "MythVantage":
+ setup_func_minion(dbhost)
+ setup_func_key()
+ setup_syslog(systemconfig["dbhost"])
+ logging.debug("__End of hostype config")
diff --git a/abs/core-testing/LinHES-config/ir.py b/abs/core-testing/LinHES-config/ir.py
new file mode 100644
index 0000000..a6723ce
--- /dev/null
+++ b/abs/core-testing/LinHES-config/ir.py
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+import logging, mv_common
+import os, re
+
+def setup_ir(systemconfig, data_config):
+ logging.info("____Start of Software install____")
+ default_disabled = ("mythphone", "mytharchive", "mythbrowser", "mythnews",
+ "mythgame", "mythflix", "mythweather",
+ "mythappletrailers", "mythstream", "mythvodka")
+
+ default_installed=("mythcontrols", "mythgallery", "mythmovies",
+ "mythmusic", "mythsmolt", "mythvideo")
+ other_pkg=("miro", "xe", "romdb", "xine", "dvdcss", "webmin")
+
+ for pkg in default_disabled:
+ try:
+ if systemconfig[pkg] == "1":
+ mv_common.pacinstall(pkg)
+ else:
+ mv_common.pacremove(pkg)
+ except:
+ logging.debug(" ERROR-- %s is not defined", pkg)
+
+ for pkg in default_installed:
+ try:
+ if systemconfig[pkg] == "0":
+ mv_common.pacremove(pkg)
+ else:
+ mv_common.pacinstall(pkg)
+ except:
+ logging.debug(" ERROR-- %s is not defined", pkg)
+
+ for pkg in other_pkg:
+ try:
+ if systemconfig[pkg] == "1":
+ mv_common.pacinstall(pkg)
+ elif systemconfig[pkg] == "0":
+ mv_common.pacremove(pkg)
+ except:
+ logging.debug(" ERROR-- %s is not defined", pkg)
+ logging.info("__End Software ") \ No newline at end of file
diff --git a/abs/core-testing/LinHES-config/mv_advanced.py b/abs/core-testing/LinHES-config/mv_advanced.py
new file mode 100644
index 0000000..67692a4
--- /dev/null
+++ b/abs/core-testing/LinHES-config/mv_advanced.py
@@ -0,0 +1,352 @@
+# -*- coding: utf-8 -*-
+import logging, os, re
+import mv_common
+
+def setup_pacman(create_link):
+ if create_link:
+ logging.info(" Creating pacman link")
+ logging.info(" LOOK")
+ else:
+ logging.info(" Pacman link will not be created")
+ return
+
+def setup_ncid_client(dbhost,templatefile):
+ #This always runs
+ logging.debug(" Configuring ncid client with server %s",dbhost)
+ cmd = '''sed -e "s/^set Host.*$/set Host %s /" %s >/etc/ncid/ncid.conf''' %(dbhost, templatefile)
+ return
+
+def setup_ncid_daemon(port,templatefile,Runncidd):
+ logging.info(" Configuring callerid daemon")
+ if Runncidd == "1":
+ logging.debug(" Port: %s",port)
+ mv_common.cp_and_log("/etc/ncid/ncidd.conf",templatefile)
+ cmd = '''sed -e "s/.*set ttyport.*$/set ttyport = \/dev\/%s /" %s >/etc/ncid/ncidd.conf''' %(port,templatefile)
+ mv_common.runcmd(cmd)
+ mv_common.pacinstall("ncidd")
+ mv_common.add_service("ncidd")
+ else:
+ logging.debug(" Callerid will not run")
+ mv_common.pacremove("ncidd")
+ mv_common.remove_service("ncidd")
+ return
+
+def setup_splash(Usebootsplash):
+ if Usebootsplash == "1":
+ logging.info(" Enabling splash")
+ cmd = ''' sed -i "s/^default.*0/default 1/g" /boot/grub/menu.lst'''
+ mv_common.runcmd(cmd)
+ else:
+ logging.info(" Disabling splash")
+ cmd = ''' sed -i "s/^default.*1/default 0/g" /boot/grub/menu.lst'''
+ mv_common.runcmd(cmd)
+ return
+
+def setup_hobbit(UseHobbit,SystemType,dbhost):
+ if UseHobbit == "1":
+ if SystemType == "Standalone" or SystemType == "Master_backend":
+ logging.info(" Installing hobbit server")
+ mv_common.pacinstall("hobbitserver")
+ mv_common.add_service("hobbit")
+ else:
+ logging.info(" Installing hobbit client")
+ mv_common.pacinstall("hobbit-client")
+ setup_hobbit_client(dbhost)
+ mv_common.add_service("hobbit-client")
+
+ else:
+ logging.info(" Removing Hobbit")
+ mv_common.pacremove("hobbit")
+ mv_common.pacremove("hobbit-client")
+ mv_common.remove_service("hobbit-client")
+ mv_common.remove_service("hobbitserver")
+ cmd = "rm -f /data/srv/httpd/htdocs/hobbit/index.html"
+ mv_common.runcmd(cmd)
+ return
+
+def setup_hobbit_client(dbhost):
+ logging.info(" Configuring hobbit client")
+ logging.debug(" hobbit server is %s:", dbhost)
+ cmd='''sed -i "s/^BBDISP.*$/BBDISP=%s/g" /data/srv/hobbit/client/etc/hobbitclient.cfg ''' %dbhost
+ mv_common.runcmd(cmd)
+ return
+
+def setup_evrouter(UseEvrouter,EvrouterConfig,template):
+ if UseEvrouter == "1":
+ logging.info(" Configuring everouter")
+ logging.debug(" EvrouterConfig is %s:",EvrouterConfig)
+ if EvrouterConfig == "tinker":
+ logging.debug(" tinker mode, not changing the config")
+ return
+ mv_common.pacinstall("evrouter")
+ mv_common.pacinstall("Xvfb")
+ mv_common.cp_and_log(template+EvrouterConfig,"/etc/evrouter.cfg")
+ mv_common.add_service("evrouter")
+ mv_common.add_service("Xvfb")
+ else:
+ logging.info(" Not using evrouter")
+ mv_common.pacremove("evrouter")
+ mv_common.remove_service("evrouter")
+ mv_common.remove_service("Xvfb")
+
+ return
+
+def setup_DNSmasq(RunDHCP,ip,gw,nameserver):
+ if RunDHCP == "1":
+ logging.info(" Configuring dhcp server(dnsmasq)")
+ logging.debug(" ip: %s", ip)
+ logging.debug(" gw: %s", gw)
+ logging.debug(" ns: %s", nameserver)
+ mv_common.pacinstall("dnsmasq")
+ mv_common.pacinstall("mvpmc")
+ mv_common.add_service("dnsmasq")
+ logging.debug(" Setting default route to my gw: %s",gw)
+ try:
+ f = open("/etc/dnsmasq.conf",'r')
+ dnsconf = f.readlines()
+ f.close()
+ except:
+ logging.info(" Couldn't open dnsmasq.conf")
+ return
+ for line in dnsconf:
+ outline = line
+ if re.match("^dhcp-option=3",line):
+ logging.debug(" Setting default route to my gw: %s",gw)
+ outline = "dhcp-option=3,%s\n" %gw
+ if re.match("^dhcp-option=6",line):
+ logging.debug(" Setting dns to my ip: %s",ip)
+ outline = "dhcp-option=6,%s\n" %ip
+ f.write(outline)
+ f.close()
+
+ logging.debug(" change nfsroot to my ip:%s",ip)
+ cmd = '''sed -i "s/nfsroot=.*:/nfsroot=%s:/g" /data/srv/tftp/pxelinux.cfg/default''' %ip
+ mv_common.runcmd(cmd)
+
+ logging.debug(" Adding 127.0.0.1 to resolv.conf")
+ logging.debug(" other nameserver is %s",nameserver)
+ try:
+ f = open("/etc/resolv.conf",'r')
+ dns = f.readlines()
+ f.close()
+ except:
+ dns=''
+ logging.debug(" Couldn't open resolv.conf for reading")
+ try:
+ f = open("/etc/resolv.conf",'w')
+ line="search lan\n"
+ f.write(line)
+ line="nameserver 127.0.0.1\n"
+ f.write(line)
+ line="nameserver %s\n" %nameserver
+ f.write(line)
+ for line in dns:
+ f.write(line)
+ f.close()
+ except:
+ logging.debug(" Couldn't open resolv.conf for writing")
+
+ logging.debug(" setup dongle.config")
+ cmd = ''' sed -i "s/mvpmc -f .*/mvpmc -f \/etc\/helvR10.fon -s %s \& /" /data/srv/tftp/dongle.bin.config ''' %ip
+ #COMMAND="%s/mvpmc -f .*/mvpmc -f \/etc\/helvR10.fon -s ${ip} \& /"
+ #ex ${BASE}/data/srv/tftp/dongle.bin.config <<EOF
+ mv_common.runcmd(cmd)
+ else:
+ logging.info(" removing dhcp server(dnsmasq)")
+ mv_common.pacremove("dnsmasq")
+ mv_common.pacremove("mvpmc")
+ mv_common.remove_service("dnsmasq")
+ return
+
+def setup_mythweb(UseMythWEB):
+ if UseMythWEB == "1":
+ logging.info(" Activating mythweb")
+ mv_common.pacinstall("lighttpd")
+ mv_common.pacinstall("mythweb")
+ mv_common.add_service("lighttpd")
+ else:
+ logging.info(" Removing mythweb")
+ mv_common.pacremove("lighttpd")
+ mv_common.pacremove("mythweb")
+ mv_common.remove_service("lighttpd")
+ return
+
+def setup_samba(systemconfig,data_config):
+ mythhome = data_config.MYTHHOME
+ if systemconfig["UseSamba"] == "1":
+ logging.info(" Activating windows file sharing")
+ usersamba=mythhome+"/templates/smb.conf"
+ mv_common.pacinstall("samba")
+ if not os.path.exists("/etc/samba"):
+ logging.debug(" Creating directory /etc/samba")
+ try:
+ os.makedirs("/etc/samba")
+ except:
+ pass
+
+ if os.path.exists(usersamba):
+ logging.debug(" Using user provided config file %s",usersamba)
+ cmd = "install -D -m755 %s /etc/samba/smb.conf" %usersamba
+ mv_common.runcmd(cmd)
+ else:
+ Samba_media = systemconfig["Samba_media"]
+ Samba_home = systemconfig["Samba_home"]
+ if systemconfig["Samba_mediareadonly"] == "1":
+ smreadonly = "yes"
+ else:
+ smreadonly = "no"
+
+ if systemconfig["Samba_homereadonly"] == "1":
+ shreadonly = "yes"
+ else:
+ shreadonly = "no"
+ domain = systemconfig["Samba_domain"]
+ servername = systemconfig["hostname"]
+
+ try:
+ f = open(systemconfig["TEMPLATES"]+"/samba/smb.conf.template",'r')
+ t_smbconf = f.readlines()
+ f.close()
+ except:
+ logging.info(" Couldn't open samba template file")
+ return
+
+ try:
+ f = open("/etc/samba/smb.conf",'w')
+ except:
+ logging.info(" Couldn't open samba file")
+ return
+
+ for line in t_smbconf:
+ outline = line
+ if re.match("^.*workgroup", line):
+ logging.debug(" Setting workgroup to %s",domain)
+ outline="workgroup = %s\n" %domain
+ logging.debug(" %s",outline)
+ if re.match("^.* server string",line):
+ logging.debug(" Setting server name to %s",servername)
+ outline="server string = %s\n" %servername
+ logging.debug(" %s",outline)
+ f.write(outline)
+ outline="include = %s/templates/user.shares \n" %mythhome
+ f.write(outline)
+ if Samba_media == "1":
+ outline="include = /etc/samba/smb.conf.media\n"
+ f.write(outline)
+ if Samba_home == "1":
+ outline="include = /etc/samba/smb.conf.home\n"
+ f.write(outline)
+ f.close()
+ logging.info(" Writing smb.conf.media")
+ try:
+ f = open("/etc/samba/smb.conf.media","w")
+ except:
+ logging.info(" Couldn't open smb.conf.media")
+ return
+ medialines='''
+[%s]
+path = %s
+public = yes
+only guest = yes
+writeable = %s
+printable = no
+force user = mythtv
+force group = mythtv
+create mask = 0755''' %(data_config.SMEDIA,data_config.DATAMOUNT,smreadonly)
+ f.write(medialines)
+ f.close
+ logging.debug(" %s",medialines)
+ logging.info(" Writing smb.conf.home")
+ try:
+ f = open("/etc/samba/smb.conf.home","w")
+ except:
+ logging.info(" Couldn't open smb.conf.home")
+ return
+ homelines='''
+[home]
+path = %s
+public = yes
+only guest = yes
+writeable = %s
+printable = no
+force user = mythtv
+force group = mythtv
+create mask = 0755 ''' %(data_config.MYTHHOME,shreadonly)
+ f.write(homelines)
+ f.close
+ logging.debug(" %s",homelines)
+
+
+ mv_common.add_service("nmbd")
+ mv_common.add_service("smbd")
+ else:
+ logging.info(" Removing windows file sharing")
+ mv_common.remove_service("smbd")
+ mv_common.remove_service("nmbd")
+ mv_common.pacremove("samba")
+ mv_common.pacinstall("smbclient")
+ return
+
+def setup_NFSshares(UseNFS,templatefile):
+ if UseNFS == "1":
+ logging.info(" Activating NFS server")
+ mv_common.pacinstall("nfs-utils")
+ mv_common.pacinstall("portmap")
+ cmd = '''sed -e "s/REPLACEME/*/g" %s >/etc/exports''' %templatefile
+ mv_common.add_service("nfsd")
+ mv_common.add_service("nfs-utils")
+ mv_common.add_service("portmap")
+ else:
+ logging.info(" Removing NFS server")
+ mv_common.remove_service("nfsd")
+ return
+
+def setup_dyndns(DDnsEnable):
+ if DDnsEnable == "1":
+ logging.info(" Installing Dynamic DNS client")
+ mv_common.pacinstall("inadyn")
+ mv_common.add_service("inadyn")
+ else:
+ logging.info(" Removing Dynamic DNS client")
+ mv_common.pacremove("inadyn")
+ mv_common.remove_service("inadyn")
+
+
+def setup_advanced(systemconfig,data_config):
+ logging.info("____Start of advanced configuration____")
+ create_link = False
+ if systemconfig["SystemType"] == "Master_backend":
+ create_link = True
+ setup_pacman(create_link)
+ setup_ncid_client(systemconfig["dbhost"],
+ systemconfig["TEMPLATES"]+"/ncid.conf.template")
+
+ setup_ncid_daemon(systemconfig["nciddSerialPort"],
+ systemconfig["TEMPLATES"]+"/ncidd.conf.template",
+ systemconfig["Runncidd"])
+
+ setup_splash(systemconfig["Usebootsplash"])
+ if data_config.SYSTEMTYPE == "MythVantage":
+ setup_hobbit(systemconfig["UseHobbit"],
+ systemconfig["SystemType"],
+ systemconfig["dbhost"])
+
+ setup_evrouter(systemconfig["UseEvrouter"],
+ systemconfig["EvrouterConfig"],
+ systemconfig["TEMPLATES"])
+ systemconfig["mythip"]="192.168.100.myip"
+ systemconfig["mythgw"]="192.168.100.mygw"
+ systemconfig["mythdns"]="192.168.100.100"
+
+ setup_DNSmasq(systemconfig["RunDHCP"],
+ systemconfig["mythip"],
+ systemconfig["mythgw"],
+ systemconfig["mythdns"])
+
+ setup_mythweb(systemconfig["UseMythWEB"])
+ setup_samba(systemconfig,data_config)
+ setup_NFSshares(systemconfig["UseNFS"],
+ systemconfig["TEMPLATES"]+"/exports.template")
+
+ setup_dyndns(systemconfig["DDnsEnable"])
+
diff --git a/abs/core-testing/LinHES-config/mv_common.py b/abs/core-testing/LinHES-config/mv_common.py
new file mode 100644
index 0000000..3ae7edb
--- /dev/null
+++ b/abs/core-testing/LinHES-config/mv_common.py
@@ -0,0 +1,94 @@
+# -*- coding: utf-8 -*-
+import logging, os
+import commands
+config_file = "mv_config"
+data_config = __import__(config_file, globals(), locals(), [])
+
+def runcmd(cmd):
+ if data_config.NOOPDEBUG=="FALSE":
+ pass
+ else:
+ cmd = "echo "+cmd
+ logging.debug(" %s",cmd)
+ cmdout = commands.getoutput(cmd)
+ logging.debug(" %s",cmdout)
+ return cmdout
+
+
+def services(systemconfig):
+ logging.debug("______Start of services______")
+ logging.debug("__End services")
+
+def cp_and_log(srcfile,destfile):
+ #return
+ if not os.path.exists(srcfile):
+ logging.info("%s is not present, skipping...",srcfile)
+ else:
+ cmd = ("rsync -arhp %s %s") %(srcfile,destfile)
+ runcmd(cmd)
+
+
+def add_service(daemon):
+ logging.info(" Adding service %s",daemon)
+
+def remove_service(daemon):
+ logging.info(" Removing service %s",daemon)
+
+def pacinstall(pkg):
+ logging.info(" Installing %s",pkg)
+ #extra pkg check
+ if pkg == "xine":
+ pacinstall("xine-ui")
+ elif pkg == "dvdcss":
+ pacinstall("libdvdcss")
+ elif pkg == "webmin":
+ add_service("webmin")
+
+def pacremove(pkg):
+ logging.info(" Removing %s",pkg)
+ if pkg == "xine":
+ pacremove("xine-ui")
+ elif pkg == "dvdcss":
+ pacremove("libdvdcss")
+ elif pkg == "webmin":
+ remove_service("webmin")
+
+
+def reloadfe():
+ logging.info(" Reloading frontend")
+ logging.info(" LOOK Reloading frontend")
+ #function reloadfe(){
+ #PID=`ps -ef |grep mythfrontend|grep -v grep |awk '{print $2 }'`
+ #/usr/bin/backend_control.sh clearcache behost $dbhost
+ #if [ x$RESTART_LCD = xtrue ]
+ #then
+ #killall -9 mythlcdserver
+ #fi
+ #if [ x = x$PID ]
+ #then
+ #echo "Mythfrontend not running, will not reload"
+ #else
+ #kill -s USR1 $PID
+ #fi
+ return
+
+def restartfe():
+ logging.info(" Restarting frontend")
+ cmd="killall -9 mythfrontend"
+ runcmd(cmd)
+ cmd="killall -9 welcome"
+ runcmd(cmd)
+ return
+
+def udev_trigger():
+ logging.info(" Triggering udev")
+ cmd = "udevadm settle"
+ runcmd(cmd)
+ cmd = "udevadm trigger"
+ runcmd(cmd)
+ cmd = "udevadm settle"
+ runcmd(cmd)
+ cmd = "udevadm trigger"
+ runcmd(cmd)
+
+
diff --git a/abs/core-testing/LinHES-config/mv_config.py b/abs/core-testing/LinHES-config/mv_config.py
index 969e12d..d5a247d 100755
--- a/abs/core-testing/LinHES-config/mv_config.py
+++ b/abs/core-testing/LinHES-config/mv_config.py
@@ -10,6 +10,7 @@ NOOPDEBUG="FALSE"
BACKUPFILE="mythconverg.sql.gz"
BACKUPPATH="/myth/backup/"
TEMP_TEMPLATES="/tmp/templates"
+SMEDIA="/myth"
diff --git a/abs/core-testing/LinHES-config/mv_ir.py b/abs/core-testing/LinHES-config/mv_ir.py
new file mode 100644
index 0000000..cbc18a2
--- /dev/null
+++ b/abs/core-testing/LinHES-config/mv_ir.py
@@ -0,0 +1,288 @@
+# -*- coding: utf-8 -*-
+import logging, mv_common
+import os, re , glob
+from time import time, localtime, strftime
+import time
+
+def setup_lirc_links(mythhome):
+ logging.debug(" Creating links for lirc")
+ if not os.path.exists(mythhome+"/.mythtv"):
+ logging.debug(" Creating %s/.mythtv",mythhome)
+ try:
+ os.mkdir(mythhome+"/.mythtv")
+ except:
+ logging.debug(" Couldn't create .mythtv ")
+ return
+ os.chown(mythhome+"/.mythtv","mythtv","mythtv")
+
+ if not os.path.exists(mythhome+"/.mythtv/lircrc"):
+ logging.debug(" Creating symlink for myth lircrc")
+ os.symlink("/etc/lircrc",mythhome+"/.mythtv/lircrc")
+ else:
+ logging.debug(" %s/lircrc already present",mythhome)
+
+ if not os.path.exists(mythhome+"/.lircrc"):
+ logging.debug(" Creating symlink for lircrc")
+ os.symlink("/etc/lircrc",mythhome+"/.lircrc")
+ else:
+ logging.debug(" %s/.lircrc already present",mythhome)
+
+def scrub_modules(filename,module):
+ logging.debug(" scrubbing %s from %s",module,filename)
+ cmd = '''sed -i -e '/.*#%s/d' %s''' %(module,filename)
+ mv_common.runcmd(cmd)
+
+def add_module(filename,module):
+ logging.debug(" adding %s to %s",module,filename)
+ cmd = ''' echo %s >> %s ''' %(module,filename)
+ mv_common.runcmd(cmd)
+
+def unload_all_lirc():
+ logging.debug(" Unloading all lirc modules")
+ cmd = "sv stop lircd"
+ mv_common.runcmd(cmd)
+ cmd = "killall -9 lircd"
+ mv_common.runcmd(cmd)
+ cmd = '''modprobe -r $(lsmod |grep ^lirc |awk '{print $1}') '''
+ mv_common.runcmd(cmd)
+
+
+
+def include_file( incfile,filename):
+ logging.debug(" including %s within %s",filename,incfile)
+ try:
+ f = open( incfile, 'a')
+ except:
+ logging.debug(" Couldn't open %s for writing",incfile)
+ return
+ line = '''include "%s" ''' %filename
+ logging.debug(" %s",line)
+ f.write(line)
+ f.write("\n")
+ f.close()
+
+def setup_ir_remote(Remotetype,templates):
+ logging.debug(" Setup of remote type %s",Remotetype)
+ if Remotetype == "no_remote":
+ mv_common.remove_service(lircd)
+ elif Remotetype == "tinker":
+ pass
+ else:
+ currenttime = strftime("%b-%d-%Y-%H:%M:%S", localtime())
+ cmd = "mv /etc/lircd.conf /etc/lircd.conf-%s" %currenttime
+ mv_common.runcmd(cmd)
+ cmd = "mv /etc/lircrc /etc/lircrc-%s" %currenttime
+ mv_common.runcmd(cmd)
+ files = templates + "/remotes/" + Remotetype + "/lircd*"
+ logging.debug(" Using %s",files)
+ for filename in glob.glob(files):
+ # Ignore subfolders
+ if os.path.isdir (filename):
+ logging.debug(" %s is a dir, skipping",filename)
+ continue
+ include_file("/etc/lircd.conf",filename)
+ files = templates + "/remotes/" + Remotetype + "/lircrc*"
+ logging.debug(" Using %s",files)
+ for filename in glob.glob(files):
+ # Ignore subfolders
+ if os.path.isdir (filename):
+ logging.debug(" %s is a dir, skipping",filename)
+ continue
+ include_file("/etc/lircrc",filename)
+ cmd = "chmod 755 /etc/lircrc"
+ mv_common.runcmd(cmd)
+ mv_common.add_service("lircd")
+
+
+def setup_ir_receiver(ReceiverType,TEMPLATES):
+ logging.info(" Configuring receiver %s", ReceiverType)
+ if ReceiverType == "Serial":
+ scrub_modules("/etc/modules.mythvantage","lirc")
+ add_module("/etc/modules/.mythvantage","lirc_serial #lirc")
+ cmd = "load-modules-mythvantage.sh"
+ mv_common.runcmd(cmd)
+ mv_common.remove_service("igdaemon")
+ mv_common.remove_service("tatir")
+
+ elif ReceiverType == "Usb-imon":
+ scrub_modules("/etc/modules.mythvantage","lirc")
+ add_module("/etc/modules/.mythvantage","lirc_imon #lirc")
+ cmd = "load-modules-mythvantage.sh"
+ mv_common.runcmd(cmd)
+ mv_common.remove_service("igdaemon")
+ mv_common.remove_service("tatir")
+
+ elif ReceiverType == "Hauppauge":
+ scrub_modules("/etc/modules.mythvantage","lirc")
+ add_module("/etc/modules/.mythvantage","lirc_i2c #lirc")
+ mv_common.cp_and_log(TEMPLATES+"/modules/lirc_i2c.conf" ,
+ "/etc/modprobe.d/lirc_i2c.conf")
+ cmd = "rmmod lirc_i2c"
+ mv_common.runcmd(cmd)
+ cmd = "load-modules-mythvantage.sh"
+ mv_common.runcmd(cmd)
+ mv_common.remove_service("igdaemon")
+ mv_common.remove_service("tatir")
+
+ elif ReceiverType == "iguanaIR-usb":
+ scrub_modules("/etc/modules.mythvantage","lirc")
+ mv_common.add_service("igdaemon")
+ mv_common.remove_service("tatir")
+
+ elif ReceiverType == "tatir":
+ scrub_modules("/etc/modules.mythvantage","lirc")
+ mv_common.add_service("tatir")
+ mv_common.remove_service("igdaemon")
+
+ else:
+ logging.debug(" didn't match receiver, using genric case")
+ scrub_modules("/etc/modules.mythvantage","lirc")
+ mv_common.remove_service("igdaemon")
+ mv_common.remove_service("tatir")
+
+def setup_blaster_proto(HostBlasterType,Hostnumblaster,TEMPLATES,systemconfig):
+ logging.debug(" Start of setup_blaster_proto")
+ logging.debug(" HostBlasterType: %s", HostBlasterType)
+ logging.debug(" Hostnumblaster: %s" , Hostnumblaster)
+ if not HostBlasterType == "pvr150" and not HostBlasterType == "None":
+ for i in range(int(Hostnumblaster)):
+ try:
+ proto = systemconfig["HostTransmitproto_"+str(i+1)]
+ logging.debug(" proto: %s",proto)
+ except:
+ logging.info(" unkown proto for %s",i+1)
+ continue
+ template=TEMPLATES+"/transmit/%s/lircd.conf" %proto
+ if os.path.exists(template):
+ logging.debug(" include blaster template: %s",proto)
+ include_file("/etc/lircd.conf",template)
+ else:
+ logging.debug(" template: %s is not present",template)
+ logging.info("------NEED TO SETUP CHANGE_CHANNEL------")
+
+
+def setup_blaster_transmiter(HostBlasterType):
+ logging.debug(" Start of setup_blaster_transmiter")
+ logging.info(" HostBlasterType : %s", HostBlasterType)
+
+ if HostBlasterType == "Receiver":
+ logging.info(" Blaster is receiver, skipping module config for Blaster")
+ return
+
+ if HostBlasterType == "no blaster":
+ scrub_modules("/etc/modules.mythvantage","blaster")
+ elif HostBlasterType == "Serial":
+ scrub_modules("/etc/modules.mythvantage","blaster")
+ add_module("/etc/modules/.mythvantage","lirc_serial #blaster")
+ cmd = "load-modules-mythvantage.sh"
+ mv_common.runcmd(cmd)
+ elif HostBlasterType == "pvr150":
+ scrub_modules("/etc/modules.mythvantage", "blaster")
+ scrub_modules("/etc/modules.mythvantage", "lirc")
+ add_module("/etc/modules/.mythvantage", "lirc_pvr150 #blaster")
+ add_module("/etc/modules/.mythvantage", "lirc_pvr150 #lirc")
+ cmd = "rmmod lirc_i2c"
+ mv_common.runcmd(cmd)
+ cmd = "load-modules-mythvantage.sh"
+ mv_common.runcmd(cmd)
+ else:
+ scrub_modules("/etc/modules.mythvantage","blaster")
+
+def setup_lcd(LCDtype, TEMPLATES, Remotetype):
+ logging.debug(" Start of setup_lcd")
+ logging.debug(" LCDType: %s", LCDtype)
+ logging.debug(" Remotetype: %s", Remotetype)
+ if LCDtype == "tinker":
+ logging.info(" tinker mode detected")
+ return
+
+ if LCDtype == "no_lcd":
+ logging.info(" Disabling LCD support")
+ cmd = "sv stop lcdd"
+ mv_common.runcmd(cmd)
+ #sometimes it doesn't want to die
+ cmd = "killall -9 LCDd"
+ mv_common.runcmd(cmd)
+ cmd = "load-modules-mythvantage.sh UNLOAD LCD"
+ mv_common.runcmd(cmd)
+ scrub_modules("/etc/modules.mythvantage", "LCD")
+ mv_common.remove_service("lcdd")
+ else:
+ lcdmodule="%s/LCD/%s/modules" %(TEMPLATES,LCDtype)
+ if os.path.exists(lcdmodule):
+ logging.debug(" Adding module for LCD")
+ scrub_modules("/etc/modules.mythvantage", "LCD")
+ cmd = "cat %s >> /etc/modules.mythvantage" %lcdmodule
+ if Remotetype != "tinker":
+ lcdlirc = "%s/LCD/%s" %(TEMPLATES,LCDtype)
+ if os.path.exists(lcdlirc+"/lircrc"):
+ logging.debug(" LCD seems to support lirc")
+ #setup the lirc aspect of the lcd
+ #copied from setup_ir_remote
+ files = lcdlirc+"/lircd*"
+ logging.debug(" Using %s",files)
+ for filename in glob.glob(files):
+ # Ignore subfolders
+ if os.path.isdir (filename):
+ logging.debug(" %s is a dir, skipping",filename)
+ continue
+ include_file("/etc/lircd.conf",filename)
+ files = lcdlirc+"/lircrc*"
+ logging.debug(" Using %s",files)
+ for filename in glob.glob(files):
+ # Ignore subfolders
+ if os.path.isdir (filename):
+ logging.debug(" %s is a dir, skipping",filename)
+ continue
+ include_file("/etc/lircrc",filename)
+ cmd = "chmod 755 /etc/lircrc"
+ mv_common.runcmd(cmd)
+
+def setup_ir(systemconfig, data_config):
+ rc = False
+ logging.info("____Start of IR____")
+ if systemconfig["Remotetype"] == "tinker":
+ logging.info(" Tinker mode detected")
+ else:
+ if not systemconfig["HostBlasterType"]:
+ HostBlasterType = "unknown"
+ Hostnumblaster = "0"
+ else:
+ HostBlasterType = systemconfig["HostBlasterType"]
+ Hostnumblaster = systemconfig["Hostnumblaster"]
+
+ if systemconfig["HostBlasterType"] == "pvr150":
+ remotetype = "hauppauge-blaster"
+ logging.debug(" pvr150 blaster selected, setting remote to hauppauge-blaster")
+ else:
+ remotetype = systemconfig["Remotetype"]
+
+ setup_ir_remote(remotetype,systemconfig["TEMPLATES"])
+ setup_lirc_links(data_config.MYTHHOME)
+
+ if systemconfig["ReceiverType"]:
+ setup_ir_receiver(systemconfig["ReceiverType"],
+ systemconfig["TEMPLATES"])
+ else:
+ setup_ir_receiver("unknown", systemconfig["TEMPLATES"])
+ unload_all_lirc()
+ setup_blaster_proto(HostBlasterType,
+ Hostnumblaster,
+ systemconfig["TEMPLATES"],
+ systemconfig)
+ setup_blaster_transmiter(HostBlasterType)
+ cmd = "load-modules-mythvantage.sh"
+ mv_common.runcmd(cmd)
+ time.sleep(2)
+ mv_common.udev_trigger()
+ cmd="sv start lircd"
+ mv_common.runcmd(cmd)
+ rc = True
+ if systemconfig["LCDtype"]:
+ setup_lcd(systemconfig["LCDtype"],
+ systemconfig["TEMPLATES"],
+ systemconfig["Remotetype"])
+ else:
+ logging.debug(" LCD not defined")
+ logging.info("__End IR ")
+ return rc \ No newline at end of file
diff --git a/abs/core-testing/LinHES-config/mv_misc.py b/abs/core-testing/LinHES-config/mv_misc.py
new file mode 100644
index 0000000..e792f67
--- /dev/null
+++ b/abs/core-testing/LinHES-config/mv_misc.py
@@ -0,0 +1,167 @@
+# -*- coding: utf-8 -*-
+import logging, mv_common
+import os, re
+from urllib2 import Request, urlopen, URLError, HTTPError
+
+config_file = "mv_config"
+data_config = __import__(config_file, globals(), locals(), [])
+
+def setup_zip(MVROOT,zipcode):
+ logging.debug("____Setting up the zipcode____")
+
+ if zipcode:
+ cmd="%s/bin/restore_default_settings.sh -c ZIP -c %s" %(MVROOT,zipcode)
+ #Let's also speed things up for those in North America
+ #LOOK REVISIT
+ print "mkdir /usr/bin/perlbin/vendor/tv_grabbers_non_na"
+ print "mv /usr/bin/perlbin/vendor/tv_grab_* /usr/bin/perlbin/vendor/tv_grabbers_non_na"
+ print "mv /usr/bin/perlbin/vendor/tv_grabbers_non_na/tv_grab_na* /usr/bin/perlbin/vendor/"
+ else:
+ logging.debug(" Zipcode is not set")
+
+ logging.debug("__End of zipcode")
+
+def setup_tz(timezone,TEMPLATES):
+ logging.debug("____Setting up the timezone____")
+
+ if not timezone:
+ timezone="unknown"
+ logging.debug(" Setting timezone to %s",timezone)
+ try:
+ logging.debug(" Removeing /etc/localtime")
+ os.remove("/etc/localtime")
+ except:
+ logging.debug(" Couldn't remove /etc/localtime")
+ pass
+
+ srclink="/usr/share/zoneinfo/%s" %timezone
+ logging.debug(" symlinking %s to /etc/localtime",srclink)
+ os.symlink(srclink,"/etc/localtime")
+ print '''sed -e "s~^TIMEZONE=.*$~TIMEZONE=\"${timezone}\"~" ${BASE}/etc/rc.conf > $TEMPLATES/rc.conf'''
+
+ if os.path.exists("/etc/php/php.ini"):
+ logging.debug("Changing timezone for php")
+ print '''sed -i "s/^.*date.timezone.*$/date.timezone=${timezone}/" ${BASE}/etc/php/php.ini'''
+
+ mv_common.cp_and_log(TEMPLATES+"/rc.conf","/etc/rc.conf")
+ logging.debug("__End of timezone")
+
+def setup_nfs(systemconfig):
+ nfslist=[]
+ logging.debug("____Setting up nfs____")
+ scrubnfs(systemconfig["TEMPLATES"])
+
+ if systemconfig["HaveCentralNFS"] == "yes":
+ logging.debug(" Using a Central NFS server")
+ if systemconfig["NFSserver"] == "file:nfsmap":
+ #if it's a file check for it, failure results in downloading attempt from MBE
+ nfsmap_file=data_config.MYTHHOME+"/templates/nfsmap"
+ if not os.path.exists(nfsmap_file):
+ logging.debug(" Couldn't find local %s",nfsmap_file)
+ logging.info(" Trying to download nfsmap from MBE")
+ nfsmap_file = download_nfsmap(systemconfig["dbhost"])
+ nfslist = process_nfsmap_file(nfsmap_file)
+ # if it's an ip parse ip and download file
+ elif re.search(systemconfig["NFSserver"],":nfsmap"):
+ ip=systemconfig["NFSserver"].split(":")[0]
+ nfsmap_file = download_nfsmap(ip)
+ nfslist = process_nfsmap_file(nfsmap_file)
+ #else treat it as a single mount point
+ else:
+ item = (systemconfig["NFSserver"] , systemconfig["NFSmount"])
+ nfslist.append(item)
+ setup_nfs_fstab(nfslist)
+
+ logging.debug("__End of nfs")
+
+def setup_sleep(systemconfig):
+ logging.debug("____Setting up sleep____")
+ autoshutdown = systemconfig["AutoShutdown"]
+ stime1 = systemconfig["Shutdowntime"]
+ stime2 = systemconfig["Shutdowntime2"]
+ cstime1=''
+
+ if autoshutdown == "1" :
+ if not stime1 == "-1" :
+ cstime1 = stime1
+ cshutdown = cstime1
+ if not stime2 == "-1" :
+ if cstime1 :
+ cshutdown = "%s,%s" %(cstime1,stime2)
+ else:
+ cshutdown = stime2
+ logging.debug(" Shutdown time at %s",cshutdown)
+ cmd='''sed -e "s/HOUR/%s/g" %s/cron.template | crontab - -u mythtv''' %(cshutdown,systemconfig["TEMPLATES"])
+ mv_common.runcmd(cmd)
+ else:
+ logging.info(" Shutdown not enabled")
+ cmd='''sed -e "/00 HOUR.*/d" %s/cron.template | crontab - -u mythtv''' %systemconfig["TEMPLATES"]
+ mv_common.runcmd(cmd)
+
+ logging.debug("__End of sleep")
+
+
+def process_nfsmap_file(mapfile):
+ logging.debug(" processing nfsmap file %s",mapfile)
+ nfslist = []
+ try:
+ f = open(mapfile,"r")
+ for line in f.readlines():
+ if line.startswith("#"):
+ continue
+ item = line.split()
+ if len(item) <= 1 :
+ continue
+ logging.debug(" %s",item)
+ nfslist.append(item)
+ except :
+ logging.debug("Couldn't read file %s, or some other error",mapfile)
+ return nfslist
+
+def scrubnfs(templates):
+ logging.info(" Scrubbing nfs")
+ mv_common.cp_and_log("/etc/fstab",templates+"/fstab.conf.template")
+ #used this sed cmd because it's clean and took me forever to figure out =)
+ cmd='''sed '/^#STARTSCRUB.*$/,/^#ENDSCRUB.*$/d' %s/fstab.conf.template > /etc/fstab''' %templates
+ mv_common.runcmd(cmd)
+
+def download_nfsmap(ip):
+ nfsmap_file="/tmp/nfsmap"
+ myurl="http://%s:1337/templates/nfsmap" %ip
+ req = Request(myurl)
+ try:
+ f = urlopen(req)
+ logging.info(" downloading %s", myurl)
+ local_file = open(nfsmap_file, "w")
+ #Write to our local file
+ local_file.write(f.read())
+ local_file.close()
+ #handle errors
+ except HTTPError, e:
+ logging.info(" File download failed")
+ logging.debug(" %s", myurl)
+ logging.debug(" HTTP Error: %s", e.code)
+ except URLError, e:
+ logging.info(" File download failed")
+ logging.debug(" %s",myurl)
+ logging.debug(" URL Error: %s ", e.reason)
+
+ return nfsmap_file
+
+def setup_nfs_fstab(nfslist):
+ logging.info(" Adding nfs paths to fstab")
+ try:
+ f = open('/etc/fstab', 'a')
+ line = "#STARTSCRUB --------------anything in this block will be scrubbed\n"
+ f.write(line)
+ for s, m in nfslist:
+ line = "%s %s nfs \n" %(s,m)
+ logging.debug(" %s",line)
+ f.write(line)
+ line = "#ENDSCRUB\n"
+ f.write(line)
+ f.close()
+ except:
+ logging.debug(" Couldn't open /etc/fstab")
+ logging.debug(" Done adding nfs paths to fstab")
+
diff --git a/abs/core-testing/LinHES-config/mv_network.py b/abs/core-testing/LinHES-config/mv_network.py
new file mode 100644
index 0000000..71bc442
--- /dev/null
+++ b/abs/core-testing/LinHES-config/mv_network.py
@@ -0,0 +1,277 @@
+# -*- coding: utf-8 -*-
+import sys , os, commands , glob, time, re
+import logging
+import mv_common
+global etcnetdir
+etcnetdir = "/etc/net/ifaces"
+
+
+def setup_MYTH_IP(systemconfig):
+ default_interface = systemconfig["default_interface"]
+ try:
+ defaultip = systemconfig["Hostip"+default_interface]
+ except:
+ logging.debug(" Error occured finding the defaultip")
+ defaultip = "127.0.0.1"
+ logging.info(" Using %s as default ip", defaultip)
+ return defaultip
+
+def setup_MYTH_DHCP(systemconfig):
+ default_interface = systemconfig["default_interface"]
+ try:
+ defaultdhcp = systemconfig["HostUSEDHCP"+default_interface]
+ except:
+ logging.debug(" Error occured finding default dhcp")
+ defaultdhcp = "0"
+ logging.info(" Using %s as dhcp value for %s", default_interface, defaultdhcp)
+ return defaultdhcp
+
+def flush(netdev):
+ logging.debug(" Flushing %s",netdev)
+ cmd = '''ip address flush dev %s''' %netdev
+ mv_common.runcmd(cmd)
+
+def kill_dhcp(basedir):
+ logging.debug(" _Start of kill_dhcp")
+ logging.debug(" Killing off dhcpd")
+ stddir = os.getcwd()
+ piddir = ("%s/var/run/") %basedir
+ try:
+ os.chdir(piddir)
+ for FILE in glob.glob("dhcpcd-*.pid"):
+ f = open(FILE,'r')
+ pid = f.readline()
+ f.close
+ cmd = "kill -9 %s" %pid
+ mv_common.runcmd(cmd)
+ os.remove(FILE)
+ os.chdir(stddir)
+ except:
+ pass
+
+def setup_nameserver(dns):
+ logging.info(" Adding %s for DNS", dns)
+ logging.info("-----------NEED TO SETUP setup_nameserver")
+ #grep -q $1 ${BASE}/etc/resolv.conf
+ #status=$?
+ #if [ ! $status = 0 ]
+ #then
+ #echo "nameserver $1" >> ${BASE}/etc/resolv.conf
+ #fi
+
+
+def setup_hostname(systemconfig):
+ logging.debug(" _Start of setup_hostname")
+ try:
+ hostname = systemconfig["hostname"]
+ except:
+ logging.info(" Hostname could not be set")
+ logging.info(" Using default value of me")
+ hostname = "me"
+ logging.info(" Setting the hostname to %s", hostname)
+ cmd = "cat /etc/hosts | grep -v 127.0.0.1 | grep -v %s > /tmp/hosts" %hostname
+ mv_common.runcmd(cmd)
+ if systemconfig["mythdhcp"] == "1" :
+ logging.debug(" not using dhcp")
+ cmd = ''' echo 127.0.0.1 localhost > /etc/hosts '''
+ mv_common.runcmd(cmd)
+ cmd = ''' echo %s %s > /etc/hosts ''' %(systemconfig["mythip"], systemconfig["hostname"])
+ mv_common.runcmd(cmd)
+ else:
+ cmd = ''' echo 127.0.0.1 %s localhost > /etc/hosts ''' %systemconfig["hostname"]
+ mv_common.runcmd(cmd)
+ cmd = '''cat /tmp/hosts >> /etc/hosts '''
+ mv_common.runcmd(cmd)
+
+def setup_interface(netdev,systemconfig):
+ logging.debug(" _Start of setup_interface for %s",netdev)
+ nettrans = {'Hostip':'ip',
+ 'Hostnetmask':'netmask',
+ 'HostActive':'isactive',
+ 'HostDNS':'dns',
+ 'HostUSEDHCP':'UseDHCP',
+ 'HostGW':'GW',
+ 'HostMTU':'mtu',
+ 'HOST_iswireless':"wireless",
+ 'HostESSID':'ESSID',
+ 'HostKey':'key',
+ 'HostUseEncryption':'ENCRYPT'}
+ netinfo = {}
+ #populate the netinfo dict
+ for netitem in nettrans:
+ if systemconfig[netitem+netdev]:
+ netinfo[nettrans[netitem]] = systemconfig[netitem+netdev]
+ else:
+ netinfo[nettrans[netitem]] = False
+ logging.debug(" %s:%s",netitem,netinfo[nettrans[netitem]])
+ logging.info(" %s wireless: %s", netdev,netinfo["wireless"])
+ try:
+ os.makedirs(etcnetdir)
+ except:
+ logging.debug(" Could not create %s",etcnetdir)
+
+ optionfile=etcnetdir+"/"+netdev+"/options"
+ if not os.path.exists(optionfile):
+ os.makedirs(etcnetdir+"/"+netdev)
+ mv_common.cp_and_log(systemconfig["TEMPLATES"]+"/etcnet/eth/options", optionfile)
+
+ if netinfo["isactive"] == "1" :
+ change_iface_state(netdev,"enabled")
+ else:
+ change_iface_state(netdev,"disabled")
+
+ if netinfo["wireless"] == "1" :
+ logging.info(" Enabling wireless extensions")
+ cmd = ''' sed -i -e 's/^CONFIG_WIRELESS=.*$/CONFIG_WIRLESS=yes/g' %s/%s/options''' %(etcnetdir,netdev)
+ mv_common.runcmd(cmd)
+ #set the key and essid
+ cmd = ''' echo "essid %s" > %s/%s/iwconfig ''' %(netinfo["ESSID"], etcnetdir, netdev)
+ mv_common.runcmd(cmd)
+ if netinfo["ENCRYPT"] == "1":
+ logging.info(" Enabling encryption")
+ cmd = '''echo "key %s" >> %s/%s/iwconfig ''' %(netinfo["KEY"], etcnetdir, netdev)
+ mv_common.runcmd(cmd)
+ else:
+ logging.info(" Disabling wireless extensions")
+ cmd = '''sed -i -e 's/^CONFIG_WIRLESS=.*$/CONFIG_WIRLESS=no/g' %s/%s/options''' %(etcnetdir, netdev)
+ mv_common.runcmd(cmd)
+
+ if netinfo["UseDHCP"] == "0" :
+ logging.info(" Enabling DHCP support")
+ cmd = ''' sed -i -e 's/^BOOTPROTO=.*$/BOOTPROTO=dhcp/g' %s/%s/options''' %(etcnetdir, netdev)
+ mv_common.runcmd(cmd)
+ else:
+ logging.info(" Using static ip address of %s",netinfo["ip"])
+ cmd = ''' sed -i -e 's/^BOOTPROTO=.*$/BOOTPROTO=static/g' %s/%s/options''' %(etcnetdir, netdev)
+ mv_common.runcmd(cmd)
+ cmd = '''echo "default via %s" > %s/%s/ipv4route''' %(netinfo["GW"], etcnetdir, netdev)
+ mv_common.runcmd(cmd)
+ cmd = '''echo "%s%s" > %s/%s/ipv4address ''' %(netinfo["ip"], netinfo["netmask"], etcnetdir, netdev)
+ mv_common.runcmd(cmd)
+ setup_nameserver(netinfo["dns"])
+
+ if netinfo["mtu"] :
+ logging.info(" Setting mtu to %s", netinfo["mtu"])
+ cmd = '''sed -i '/^mtu.*$/d' %s/%s/iplink''' %(etcnetdir,netdev)
+ mv_common.runcmd(cmd)
+ cmd = ''' echo "mtu %s" >> %s/%s/iplink''' %(netinfo["mtu"], etcnetdir,netdev)
+ mv_common.runcmd(cmd)
+ else:
+ logging.info(" Using default mtu value")
+ cmd = '''sed -i '/^mtu.*$/d' %s/%s/iplink''' %(etcnetdir,netdev)
+ mv_common.runcmd(cmd)
+
+
+def change_iface_state(netdev, state):
+ if state == "enabled":
+ logging.info(" Activating %s", netdev)
+ cmd = '''sed -i -e 's/^ONBOOT=.*$/ONBOOT=yes/g' %s/%s/options''' %(etcnetdir,netdev)
+ mv_common.runcmd(cmd)
+ cmd = '''sed -i -e 's/^DISABLED=.*$/DISABLED=no/g' %s/%s/options ''' %(etcnetdir,netdev)
+ mv_common.runcmd(cmd)
+ else:
+ logging.info(" Disabling %s", netdev)
+ cmd = '''sed -i -e 's/^ONBOOT=.*$/ONBOOT=no/g' %s/%s/options''' %(etcnetdir,netdev)
+ mv_common.runcmd(cmd)
+ cmd = '''sed -i -e 's/^DISABLED=.*$/DISABLED=yes/g' %s/%s/options ''' %(etcnetdir,netdev)
+ mv_common.runcmd(cmd)
+ cmd = "/sbin/ifconfig %s down" %netdev
+ mv_common.runcmd(cmd)
+ cmd = "ip address flush %s" %netdev
+ mv_common.runcmd(cmd)
+
+def find_active(systemconfig):
+ interfacelist=('eth0', 'eth1', 'wlan0', 'wlan1')
+ logging.debug(" _Start of find_active")
+ try:
+ os.remove("/etc/resolv.conf")
+ except:
+ logging.debug(" couldn't remove /etc/resolv.conf")
+
+ if systemconfig["mythdhcp"] == "1":
+ cmd = ''' echo search lan > /etc/resolv.conf '''
+ mv_common.runcmd(cmd)
+ cmd = ''' echo nameserver 127.0.0.1 >> /etc/resolv.conf '''
+ mv_common.runcmd(cmd)
+
+ for netdev in interfacelist:
+ currentnet = "HostActive" + netdev
+ try:
+ systemconfig[currentnet]
+ except:
+ logging.debug(" %s is not defined",currentnet)
+ continue
+ if systemconfig[currentnet] == "1" :
+ setup_interface(netdev,systemconfig)
+ else:
+ change_iface_state(netdev, "disabled")
+
+def vnc_netboot_check():
+ logging.debug(" Start of VNC/NETBOOT check")
+ vnc = False
+ netboot = False
+ try:
+ f = open('/proc/cmdline', 'r')
+ bootoptions = f.readlines()
+ f.close()
+ except:
+ logging.debug(" Couldn't open /proc/cmdline")
+ logging.debug(" Assuming it's ok to fiddle with the network")
+ return True
+ bootoptions = bootoptions[0]
+ if re.match("vnc",bootoptions) != None :
+ logging.debug(" Found VNC option")
+ vnc = True
+ if re.match("nfsroot",bootoptions) != None :
+ logging.debug(" Found netboot option")
+ netboot = True
+
+ return (vnc or netboot)
+
+def start_network():
+ if not vnc_netboot_check():
+ logging.info(" Restarting network")
+ cmd ="/etc/net/scripts/network.init reload"
+ mv_common.runcmd(cmd)
+ cmd ="/etc/net/scripts/network.init reload"
+ mv_common.runcmd(cmd)
+ else:
+ logging.info(" Will not restart network due to netboot/vnc")
+
+
+def stop_network():
+ if not vnc_netboot_check():
+ logging.info(" Stopping network")
+ cmd ="/etc/net/scripts/network.init stop"
+ mv_common.runcmd(cmd)
+ kill_dhcp("")
+ interfacelist=('eth0', 'eth1', 'wlan0', 'wlan1')
+ for i in interfacelist:
+ flush(i)
+ else:
+ logging.info(" Will not stop network due to netboot/vnc")
+ pass
+
+
+
+def setup_network (systemconfig):
+ logging.info("____Start of network____")
+ logging.info(" Setting up the network")
+ setup_hostname(systemconfig)
+ find_active(systemconfig)
+ logging.info("__End of network")
+
+
+
+##this is used by the install process to start the network
+def install_network_setup(systemconfig):
+ logging.info("____Start of network_install____")
+ logging.info(" Setting up the network")
+ #setup_MYTH_vars
+ setup_hostname(systemconfig)
+ stop_network()
+ find_active(systemconfig)
+ start_network()
+ logging.info("__End of network")
+
+
diff --git a/abs/core-testing/LinHES-config/mv_screensaver.py b/abs/core-testing/LinHES-config/mv_screensaver.py
new file mode 100644
index 0000000..eb81792
--- /dev/null
+++ b/abs/core-testing/LinHES-config/mv_screensaver.py
@@ -0,0 +1,199 @@
+# -*- coding: utf-8 -*-
+import logging, mv_common
+import re
+import os
+
+
+def mplayer_saver_check (cmd,templatefile):
+ logging.debug(" Checking for heartbeat command in mplayer.conf")
+ mplayerconf = "/etc/mplayer/mplayer.conf"
+ if not os.path.exists(mplayerconf):
+ logging.debug(" copying in mplayer template file")
+ mv_common.cp_and_log(templatefile, mplayerconf)
+
+ try:
+ f = open(mplayerconf, 'r')
+ mplayerconf_contents = f.readlines()
+ f.close()
+ except:
+ logging.debug(" Couldn't open %s for reading",mplayerconf)
+ mplayerconf_contents = "#\n"
+
+ try:
+ f = open(mplayerconf, 'w')
+ except:
+ logging.debug(" Couldn't open %s for writing",mplayerconf)
+ return
+
+ for line in mplayerconf_contents:
+ if re.match("^.*stop-xscreensaver",line):
+ continue
+ elif re.match("^.*heartbeat-cmd",line):
+ continue
+ else:
+ f.write(line)
+
+ f.write("stop-xscreensaver = 0\n")
+ line='''heartbeat-cmd="%s"\n''' %cmd
+ f.write(line)
+ f.close()
+
+
+def killxscreensaver():
+ logging.info(" Stopping xscreensaver")
+ cmd="xscreensaver-command --exit "
+ mv_common.runcmd(cmd)
+ cmd="killall xscreensaver "
+ mv_common.runcmd(cmd)
+
+def killgscreensaver():
+ logging.info(" Stopping gnome-screensaver")
+ cmd="gnome-screensaver-command --exit "
+ mv_common.runcmd(cmd)
+ cmd="killall gnome-screensaver "
+ mv_common.runcmd(cmd)
+
+
+def setup_x_screensaver(idle,theme,screenconfigfile,templatefile):
+ logging.info(" Configuring X screensaver")
+ killgscreensaver()
+ logging.debug(" Why can't xscreensaver have a nice configuration !")
+
+ if not os.path.exists(screenconfigfile):
+ logging.debug(" copying in new template file")
+ mv_common.cp_and_log(templatefile,screenconfigfile)
+
+ try:
+ f = open(screenconfigfile, 'r')
+ screenconfigcontents=f.readlines()
+ f.close()
+ except:
+ logging.info("Couldn't open %s for reading",screenconfigfile)
+ return
+ try:
+ f = open(screenconfigfile, 'w')
+ except:
+ logging.info("Couldn't open %s for writing",screenconfigfile)
+ return
+
+ startline=0
+ foundline=0
+
+ for k, line in enumerate(screenconfigcontents):
+ if re.match("programs:",line):
+ startline = k
+ if re.search(theme,line):
+ foundline = k
+ themenumber=foundline-startline-2
+
+ for line in screenconfigcontents:
+ if re.match("selected.*$",line):
+ continue
+
+ if re.match("timeout",line):
+ logging.info(" Setting idletime to %s",idle)
+ outline = "timeout: 0:%s:00 \n" %idle
+ f.write(outline)
+ elif re.match("mode",line):
+ if theme == "Random":
+ logging.info(" Setting theme to %s", "Random")
+ outline = "mode: random \n"
+ f.write(outline)
+ outline = "selected: -1 \n"
+ f.write(outline)
+ continue
+
+ elif theme == "Blank":
+ logging.info(" Setting theme to %s", "blank")
+ outline = "mode: blank \n"
+ f.write(outline)
+ outline = "selected: -1 \n"
+ f.write(outline)
+ continue
+
+ else:
+ logging.info(" Setting theme to %s", theme)
+ outline = "mode: one\n"
+ f.write(outline)
+ logging.debug(" Theme number is %s",themenumber)
+ outline = "selected: %s\n" %themenumber
+ f.write(outline)
+ continue
+
+ else:
+ outline = line
+ f.write(outline)
+ f.close()
+ logging.debug("__End of xscreensaver")
+
+def setup_gnome_screensaver(theme,idletime):
+ logging.info(" Configuring gnome screensaver")
+
+ logging.info(" Disabling lock screen")
+ cmd='''gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type bool --set /apps/gnome-screensaver/lock_enabled false'''
+ mv_common.runcmd(cmd)
+
+ logging.info(" Setting idletime to %s",idletime)
+ cmd='''gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type int -s "/apps/gnome-screensaver/idle_delay" %s''' %idletime
+ mv_common.runcmd(cmd)
+
+ logging.info(" Setting mode to single")
+ cmd='''gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type string -s "/apps/gnome-screensaver/mode" single'''
+ mv_common.runcmd(cmd)
+
+ if theme == "Random":
+ logging.info(" setting theme to random")
+ cmd='''gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type string -s "/apps/gnome-screensaver/mode" random'''
+ mv_common.runcmd(cmd)
+
+ elif theme == "Blank":
+ logging.info(" setting theme to blank")
+ cmd='''gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type string -s "/apps/gnome-screensaver/themes" blank'''
+ mv_common.runcmd(cmd)
+
+ else:
+ logging.info(" setting theme to %s",theme)
+ cmd='''gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --set --type list --list-type=string /apps/gnome-screensaver/themes [screensavers-%s]''' %theme
+ mv_common.runcmd(cmd)
+
+ killxscreensaver()
+ logging.info("__End gnome screensaver")
+
+
+
+
+def setup_screensaver (systemconfig,data_config):
+ logging.info("____Start of screensaver configuration____")
+ screensavertype = systemconfig["Screensavertype"]
+ theme = systemconfig["Screensavertheme"]
+ idletime = systemconfig["Screensaveridle"]
+ configfile = data_config.MYTHHOME+"/.xscreensaver"
+ templatefile = systemconfig["TEMPLATES"]+"/xscreensaver.template"
+ mtemplate = systemconfig["TEMPLATES"]+"/mplayer.conf.template"
+
+ if screensavertype == "xscreensaver":
+ mv_common.pacinstall("xscreensaver")
+ mv_common.pacremove("gnome-screensaver")
+ setup_x_screensaver(idletime, theme, configfile, templatefile)
+ mplayer_saver_check("/usr/bin/xscreensaver-command -deactivate &",mtemplate)
+
+ elif screensavertype == "gscreensaver":
+ mv_common.pacinstall("xscreensaver")
+ mv_common.pacinstall("gnome-screensaver")
+ setup_gnome_screensaver(theme,idletime)
+ mplayer_saver_check("/usr/bin/gnome-screensaver-command -p &",mtemplate)
+
+ elif screensavertype == "none":
+ mv_common.pacremove("xscreensaver")
+ mv_common.pacremove("gnome-screensaver")
+ killgscreensaver()
+ killxscreensaver()
+
+ elif screensavertype == "tinker" :
+ logging.debug(" screensaver tinker mode detected")
+ else:
+ logging.debug(" Unknown screensaver")
+ logging.info("__End of screensaver")
+
+
+
diff --git a/abs/core-testing/LinHES-config/mv_software.py b/abs/core-testing/LinHES-config/mv_software.py
new file mode 100644
index 0000000..83d7c86
--- /dev/null
+++ b/abs/core-testing/LinHES-config/mv_software.py
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+import logging, mv_common
+import os, re
+
+def setup_software(systemconfig, data_config):
+ logging.info("____Start of Software install____")
+ default_disabled = ("mythphone", "mytharchive", "mythbrowser", "mythnews",
+ "mythgame", "mythflix", "mythweather",
+ "mythappletrailers", "mythstream", "mythvodka")
+
+ default_installed=("mythcontrols", "mythgallery", "mythmovies",
+ "mythmusic", "mythsmolt", "mythvideo")
+ other_pkg=("miro", "xe", "romdb", "xine", "dvdcss", "webmin")
+
+ for pkg in default_disabled:
+ try:
+ if systemconfig[pkg] == "1":
+ mv_common.pacinstall(pkg)
+ else:
+ mv_common.pacremove(pkg)
+ except:
+ logging.debug(" ERROR-- %s is not defined", pkg)
+
+ for pkg in default_installed:
+ try:
+ if systemconfig[pkg] == "0":
+ mv_common.pacremove(pkg)
+ else:
+ mv_common.pacinstall(pkg)
+ except:
+ logging.debug(" ERROR-- %s is not defined", pkg)
+
+ for pkg in other_pkg:
+ try:
+ if systemconfig[pkg] == "1":
+ mv_common.pacinstall(pkg)
+ elif systemconfig[pkg] == "0":
+ mv_common.pacremove(pkg)
+ except:
+ logging.debug(" ERROR-- %s is not defined", pkg)
+ logging.info("__End Software ") \ No newline at end of file
diff --git a/abs/core-testing/LinHES-config/mv_webuser.py b/abs/core-testing/LinHES-config/mv_webuser.py
new file mode 100644
index 0000000..026121f
--- /dev/null
+++ b/abs/core-testing/LinHES-config/mv_webuser.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+import logging, mv_common
+#import os
+
+def setup_web_auth(UseMythWEB_auth):
+ if UseMythWEB_auth == str(1):
+ #enable auth
+ logging.info("Enabling authorization for mythweb")
+ cmd='''sed -i "s/^.*include.*auth-inc.conf.*$/include \\"\/etc\/lighttpd\/auth-inc.conf\\"/g" /etc/lighttpd/lighttpd.conf'''
+ mv_common.runcmd(cmd)
+ else:
+ #disable auth
+ logging.info("Disabling authorization for mythweb")
+ cmd='''sed -i "s/^.*include.*auth-inc.conf.*$/#include \\"\/etc\/lighttpd\/auth-inc.conf\\"/g" /etc/lighttpd/lighttpd.conf'''
+ mv_common.runcmd(cmd)
+ logging.debug("Restarting lighttpd")
+ cmd="sudo sv restart lighttpd"
+ mv_common.runcmd(cmd)
+
diff --git a/abs/core-testing/LinHES-config/systemconfig.py b/abs/core-testing/LinHES-config/systemconfig.py
index 88961f6..1df4c39 100755
--- a/abs/core-testing/LinHES-config/systemconfig.py
+++ b/abs/core-testing/LinHES-config/systemconfig.py
@@ -3,8 +3,8 @@
import sys, os, commands, glob, time
import getopt, re, MySQLdb
import logging
-import hostype
-
+import mv_common , mv_network
+import inspect
#____________________________________________setup the logging______________________________________________________
LOG_FILENAME = '/tmp/systemconfig.log'
DEBUGLOG = '/tmp/systemconfig_debug.log'
@@ -12,10 +12,10 @@ logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
datefmt='%m-%d %H:%M',
filename=DEBUGLOG,
- filemode='a')
+ filemode='w')
# define a Handler which writes INFO messages or higher to the sys.stderr
console = logging.StreamHandler()
-console.setLevel(logging.DEBUG)
+console.setLevel(logging.INFO)
# set a format which is simpler for console use
#formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
formatter = logging.Formatter("%(message)s")
@@ -35,16 +35,28 @@ logging.getLogger('').addHandler(infofile)
def usage():
logging.info("tell people how to use this")
+def setup_x(systemconfig):
+ cmd = "%s/bin/xconfig.sh" %systemconfig["MVROOT"]
+ mv_common.runcmd(cmd)
+
def main(argv):
+ try:
+ MVROOT = os.environ["MV_ROOT"]
+ except:
+ logging.debug("MVROOT was not defined, using the default value")
+ MVROOT = "/usr/MythVantage"
+
global cmdmodule
+ global systemconfig
+ systemconfig["MVROOT"]=MVROOT
+ cmdmodule={"misc":False , "sleep":False , "hostype":False , "hostypec":False , "advanced":False , "audio":False , "network":False , "advancedX":False , "webuser":False , "restartfe":False , "reloadfe":False , "ddns":False , "screensaver":False , "ir":False , "this_is_install":False , "user":False, "software":False}
try:
opts, args = getopt.getopt(argv, 'c:hm:', ["help","modules" ] )
except getopt.GetoptError, why:
print why
usage()
- print "exception haappen"
+ print "exception happened"
sys.exit(2)
- cmdmodule = {"op": 'null'}
for opt, arg in opts:
if opt in ("-h", "--help"):
usage()
@@ -53,11 +65,77 @@ def main(argv):
for i in arg.split(","):
cmdmodule[i]=True
+ if cmdmodule["this_is_install"] or cmdmodule["hostypec"]:
+ systemconfig["hostypec"] = True
+
+ systemconfig["mythip"] = mv_network.setup_MYTH_IP(systemconfig)
+ systemconfig["mythdhcp"] = mv_network.setup_MYTH_DHCP(systemconfig)
+
if cmdmodule["hostype"]:
+ import hostype
+ cmdmodule["advancedX"] = False
+ setup_x(systemconfig)
+ cmdmodule["ir"] = True
hostype.hostypeprint(systemconfig)
+ if cmdmodule["network"]:
+ mv_network.setup_network(systemconfig)
+
+
+
+ if cmdmodule["ir"] == True:
+ import mv_ir
+ restartfe = mv_ir.setup_ir(systemconfig,data_config)
+ if restartfe == True:
+ logging.debug(" Setting the frontend to restart due to lirc change")
+ cmdmodule["restartfe"] = True
+
+ if cmdmodule["audio"] == True:
+ logging.debug("______Start of Audio Configuration______")
+ if not systemconfig["Audiotype"] == "tinker":
+ cmd="%s/bin/soundconfig.sh -t real -i %s -d %s" %(MVROOT,systemconfig["Audiotype"],systemconfig["SoundDevice"])
+ mv_common.runcmd(cmd)
+ else:
+ logging.debug(" Tinker mode(audio), not changing configuration")
+ logging.debug("__End of audio")
+
+ if cmdmodule["misc"]:
+ import mv_misc
+ mv_misc.setup_zip(MVROOT,systemconfig["zipcode"])
+ mv_misc.setup_tz(systemconfig["timezone"],systemconfig["TEMPLATES"])
+ mv_misc.setup_nfs(systemconfig)
+
+ if cmdmodule["sleep"]:
+ mv_misc.setup_sleep(systemconfig)
+
+ if cmdmodule["webuser"]:
+ import mv_webuser
+ mv_webuser.setup_web_auth(systemconfig["UseMythWEB_auth"])
+
+ if cmdmodule["screensaver"]:
+ import mv_screensaver
+ mv_screensaver.setup_screensaver(systemconfig, data_config)
+
+ if cmdmodule["advanced"]:
+ import mv_advanced
+ mv_advanced.setup_advanced(systemconfig, data_config)
+
+ if cmdmodule["software"]:
+ import mv_software
+ mv_software.setup_software(systemconfig, data_config)
+
+ if cmdmodule["advancedX"]:
+ setup_x(systemconfig)
+
+ if cmdmodule["restartfe"]:
+ mv_common.restartfe()
+
+ if cmdmodule["reloadfe"]:
+ mv_common.reloadfe()
+
if __name__ == "__main__":
+
config_file = "mv_config"
data_config = __import__(config_file, globals(), locals(), [])
#Read in systemconfig
@@ -76,13 +154,23 @@ if __name__ == "__main__":
var, val = line.rsplit("=", 1)
val = val.strip('"')
systemconfig[var.strip()] = val.strip()
-
+ systemconfig["TEMPLATES"] = os.environ["TEMPLATES"]
logging.debug("______START OF DEBUG______")
main(sys.argv[1:])
- logging.debug("______cmd line options______")
- for i in cmdmodule.items():
- logging.debug (i)
- logging.debug("______systemconfig______")
- for i in systemconfig.items():
- logging.debug(i)
- pass
+ #logging.debug("______cmd line options______")
+ #for i in cmdmodule.items():
+ #logging.debug (i)
+ #logging.debug("______systemconfig______")
+ #for i in systemconfig.items():
+ #logging.debug(i)
+ #pass
+
+
+
+
+
+
+
+
+
+
diff --git a/abs/core-testing/LinHES-config/webuser.py b/abs/core-testing/LinHES-config/webuser.py
new file mode 100644
index 0000000..1a91bf2
--- /dev/null
+++ b/abs/core-testing/LinHES-config/webuser.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+import logging, mv_common
+#import os
+
+
+config_file = "mv_config"
+data_config = __import__(config_file, globals(), locals(), [])
+
+def setup_web_auth(UseMythWEB_auth):
+ if UseMythWEB_auth == 1:
+ #enable auth
+ logging.info("Enabling authorization for mythweb")
+ cmd='''sed -ie "s/^.*include.*auth-inc.conf.*$/include \"\/etc\/lighttpd\/auth-inc.conf\"/g" /etc/lighttpd/lighttpd.conf'''
+ mv_common.runcmd(cmd)
+ else
+ #disable auth
+ logging.info("Disabling authorization for mythweb")
+ cmd='''sed -ie "s/^.*include.*auth-inc.conf.*$/#include \"\/etc\/lighttpd\/auth-inc.conf\"/g" /etc/lighttpd/lighttpd.conf'''
+ mv_common.runcmd(cmd)
+ logging.debug("Restarting lighttpd")
+ cmd="sudo sv restart lighttpd"
+ mv_common.runcmd(cmd)
+