diff options
author | James Meyer <james.meyer@operamail.com> | 2011-08-19 18:23:42 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2011-08-19 18:23:42 (GMT) |
commit | 855cc7eb5a1ec13cc4ac28a910c79633703aa18f (patch) | |
tree | 8e740605bbbdd5cb0d959072201e3d2b66a821a4 /abs/core/LinHES-config | |
parent | b1b4f59f40b122ee1a9cfa0c3a0f7a6a3b488f5f (diff) | |
download | linhes_pkgbuild-855cc7eb5a1ec13cc4ac28a910c79633703aa18f.zip linhes_pkgbuild-855cc7eb5a1ec13cc4ac28a910c79633703aa18f.tar.gz linhes_pkgbuild-855cc7eb5a1ec13cc4ac28a910c79633703aa18f.tar.bz2 |
linhes-config: clean up etc/fstab (pts shm)
added service to list of things to unsquash .upgrades from CD will now work
Converted most calls to the systemconfig dict to use .get. This will stop KEYERRORS form occuring.
Diffstat (limited to 'abs/core/LinHES-config')
-rw-r--r-- | abs/core/LinHES-config/PKGBUILD | 22 | ||||
-rwxr-xr-x | abs/core/LinHES-config/mv_advanced.py | 60 | ||||
-rwxr-xr-x | abs/core/LinHES-config/mv_config.py | 2 | ||||
-rwxr-xr-x | abs/core/LinHES-config/mv_ddns.py | 8 | ||||
-rwxr-xr-x | abs/core/LinHES-config/mv_hostype.py | 34 | ||||
-rwxr-xr-x | abs/core/LinHES-config/mv_install.py | 12 | ||||
-rwxr-xr-x | abs/core/LinHES-config/mv_ir.py | 36 | ||||
-rwxr-xr-x | abs/core/LinHES-config/mv_misc.py | 28 | ||||
-rwxr-xr-x | abs/core/LinHES-config/mv_network.py | 30 | ||||
-rwxr-xr-x | abs/core/LinHES-config/mv_screensaver.py | 10 | ||||
-rwxr-xr-x | abs/core/LinHES-config/systemconfig.py | 24 |
11 files changed, 139 insertions, 127 deletions
diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD index b0b17e7..861fa32 100644 --- a/abs/core/LinHES-config/PKGBUILD +++ b/abs/core/LinHES-config/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-config pkgver=2.2 -pkgrel=31 +pkgrel=13 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,8 +101,8 @@ build() { install -m 0755 issue $startdir/pkg/etc/issue } -md5sums=('c737f8538aea20fcb5f3903957e80837' - '1a4694fcd694b362c339bda781ed0f3e' +md5sums=('3cf9277d2a205ef20b75d5f8b36d4f0d' + '16b98fcb3753ef6cfc35075c326d30e4' 'e36da536dd651ef182e7642337889e77' '985891a43f7c4c983eb2a362162f1a0f' 'd7a8cd4a0060399ae22e69f74e04eb07' @@ -122,17 +122,17 @@ md5sums=('c737f8538aea20fcb5f3903957e80837' '9151c74fcaf18ec4cf5e757cfdbc7017' '3d1e4a119f38cff0498bf8a67e94e4b3' '5b41cfc6f4ad5cdbcd28cf980110f135' - 'da74d6f6d0272881f7724eb642a8ec69' + 'e6538618f7bb5fb6b79c132803451c39' '41b03fb1e0a9d9ae7588e3b813212772' - 'a9ffe72c3ede99d505fdc97572a7c256' - 'df43bce1712320508d4eef8449c5d223' - '65d93f15ac85adf8299552581789a731' - '4badc3c664c55f87396a473e6c14d4bc' - '36f5953944f98c50c0212a584996028e' + 'b845de3e05c1734cce4b9ac5e8f1baaf' + '56ca5fd7d6b8d1828c95d13eb0d34de5' + '7a5018c3ce9c6aff3fb26c04ee805ba9' + '62b4ce94277c32f525db5c1480670acd' + 'ec6a9961e4d1b53ec1240c5979efff11' 'fe5e31b833cc6707209e9d656b6eb53c' 'f0988a801216b44c96bf17e24a23e3a9' '23d0e12b7ca1cc6ea6b993c1d7ff20b9' - '40d1ffb2ae8b14f242063e4121950d80' - '2f3de6bf907a04dcdcfe4f1418721b60' + '8a713ce49211eb0b91c84ba0b9cf52fe' + '5ff552dbae98b3bf312171f9b4c5e787' '2596460462cf6c889cf8f95485537b20' 'a63ff9ef5250965aeabc74bfa8e43981') diff --git a/abs/core/LinHES-config/mv_advanced.py b/abs/core/LinHES-config/mv_advanced.py index 3c93e0c..aa0dcd8 100755 --- a/abs/core/LinHES-config/mv_advanced.py +++ b/abs/core/LinHES-config/mv_advanced.py @@ -207,7 +207,7 @@ def setup_mythweb(UseMythWEB): def setup_samba(systemconfig,data_config): mythhome = data_config.MYTHHOME - if systemconfig["UseSamba"] == "1": + if systemconfig.get("UseSamba") == "1": logging.info(" Activating windows file sharing") usersamba=mythhome+"/templates/smb.conf" mv_common.pacinstall("samba") @@ -223,22 +223,22 @@ def setup_samba(systemconfig,data_config): 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"] == "0": + Samba_media = systemconfig.get("Samba_media") + Samba_home = systemconfig.get("Samba_home") + if systemconfig.get("Samba_mediareadonly") == "0": smreadonly = "yes" else: smreadonly = "no" - if systemconfig["Samba_homereadonly"] == "0": + if systemconfig.get("Samba_homereadonly") == "0": shreadonly = "yes" else: shreadonly = "no" - domain = systemconfig["Samba_domain"] - servername = systemconfig["hostname"] + domain = systemconfig.get("Samba_domain") + servername = systemconfig.get("hostname") try: - f = open(systemconfig["TEMPLATES"]+"/samba/smb.conf.template",'r') + f = open(systemconfig.get("TEMPLATES")+"/samba/smb.conf.template",'r') t_smbconf = f.readlines() f.close() except: @@ -355,37 +355,37 @@ def setup_advanced(systemconfig,data_config): return logging.info("____Start of advanced configuration____") create_link = False - if systemconfig["SystemType"] == "Master_backend": + if systemconfig.get("SystemType") == "Master_backend": create_link = True setup_pacman(create_link) - setup_ncid_client(systemconfig["dbhost"], - systemconfig["TEMPLATES"]+"/ncid.conf.template") + setup_ncid_client(systemconfig.get("dbhost"), + systemconfig.get("TEMPLATES")+"/ncid.conf.template") - setup_ncid_daemon(systemconfig["nciddSerialPort"], - systemconfig["TEMPLATES"]+"/ncidd.conf.template", - systemconfig["Runncidd"]) + setup_ncid_daemon(systemconfig.get("nciddSerialPort"), + systemconfig.get("TEMPLATES")+"/ncidd.conf.template", + systemconfig.get("Runncidd")) - setup_splash(systemconfig["Usebootsplash"]) + setup_splash(systemconfig.get("Usebootsplash")) if data_config.SYSTEMTYPE == "MythVantage": - setup_hobbit(systemconfig["UseHobbit"], - systemconfig["SystemType"], - systemconfig["dbhost"]) + setup_hobbit(systemconfig.get("UseHobbit"), + systemconfig.get("SystemType"), + systemconfig.get("dbhost")) if data_config.SYSTEMTYPE == "LinHES": - setup_rrd(systemconfig["UseRRD"]) + setup_rrd(systemconfig.get("UseRRD")) - setup_evrouter(systemconfig["UseEvrouter"], - systemconfig["EvrouterConfig"], - systemconfig["TEMPLATES"]) + setup_evrouter(systemconfig.get("UseEvrouter"), + systemconfig.get("EvrouterConfig"), + systemconfig.get("TEMPLATES")) - setup_DNSmasq(systemconfig["RunDHCP"], - systemconfig["mythip"], - systemconfig["mythgw"], - systemconfig["mythdns"]) + setup_DNSmasq(systemconfig.get("RunDHCP"), + systemconfig.get("mythip"), + systemconfig.get("mythgw"), + systemconfig.get("mythdns")) - setup_mythweb(systemconfig["UseMythWEB"]) + setup_mythweb(systemconfig.get("UseMythWEB")) setup_samba(systemconfig,data_config) - setup_NFSshares(systemconfig["UseNFS"], - systemconfig["TEMPLATES"]+"/exports.template") + setup_NFSshares(systemconfig.get("UseNFS"), + systemconfig.get("TEMPLATES")+"/exports.template") - setup_dyndns(systemconfig["DDnsEnable"]) + setup_dyndns(systemconfig.get("DDnsEnable")) logging.info("__End of advanced configuration\n") diff --git a/abs/core/LinHES-config/mv_config.py b/abs/core/LinHES-config/mv_config.py index 1ac4fea..2904366 100755 --- a/abs/core/LinHES-config/mv_config.py +++ b/abs/core/LinHES-config/mv_config.py @@ -5,7 +5,7 @@ MOUNTPOINT="/new_boot" DATAMOUNT="/myth" MYTHHOME="/home/mythtv" SQUASHFILE="/tmp/.squashlist" -SQUASHLIST=("bin","boot","etc","home","lib","opt","root","sbin","usr","var","data") +SQUASHLIST=("bin","boot","etc","home","lib","opt","root","sbin","usr","var","data","service") NOOPDEBUG="FALSE" BACKUPFILE="mythconverg.sql.gz" BACKUPPATH="/myth/backup/" diff --git a/abs/core/LinHES-config/mv_ddns.py b/abs/core/LinHES-config/mv_ddns.py index 9695f76..5d432a1 100755 --- a/abs/core/LinHES-config/mv_ddns.py +++ b/abs/core/LinHES-config/mv_ddns.py @@ -10,16 +10,16 @@ def setup_ddns(systemconfig): return logging.info("____Start of setup_ddns____") - if systemconfig["DDnsEnable"] == "1": + if systemconfig.get("DDnsEnable") == "1": logging.debug(" Enabling DDNS") mv_common.pacinstall("ddclient") mv_common.cp_and_log("/etc/ddclient/ddclient.conf.dynamic.dyndns.sample", "/etc/ddclient/ddclient.conf") - cmd = ''' sed -i -e "s/your-dynamic-dyndns-login/%s/g" /etc/ddclient/ddclient.conf''' %(systemconfig["DDnslogin"]) + cmd = ''' sed -i -e "s/your-dynamic-dyndns-login/%s/g" /etc/ddclient/ddclient.conf''' %(systemconfig.get("DDnslogin")) mv_common.runcmd(cmd) - cmd = ''' sed -i -e "s/your-dynamic-dyndns-password/%s/g" /etc/ddclient/ddclient.conf''' %(systemconfig["DDnspassword"]) + cmd = ''' sed -i -e "s/your-dynamic-dyndns-password/%s/g" /etc/ddclient/ddclient.conf''' %(systemconfig.get("DDnspassword")) mv_common.runcmd(cmd) - cmd = ''' sed -i -e "s/your-dynamic-dyndns-host/%s/g" /etc/ddclient/ddclient.conf''' %(systemconfig["DDnshostname"]) + cmd = ''' sed -i -e "s/your-dynamic-dyndns-host/%s/g" /etc/ddclient/ddclient.conf''' %(systemconfig.get("DDnshostname")) mv_common.runcmd(cmd) mv_common.add_service("ddclient") else: diff --git a/abs/core/LinHES-config/mv_hostype.py b/abs/core/LinHES-config/mv_hostype.py index 1a108af..fd04a18 100755 --- a/abs/core/LinHES-config/mv_hostype.py +++ b/abs/core/LinHES-config/mv_hostype.py @@ -61,13 +61,13 @@ def setup_mysqlnetwork(EnableNetwork): def setup_mysql_connection(systemconfig): logging.info(" Configuring database connection") - mythip = systemconfig["mythip"] - systemtype = systemconfig["SystemType"] - mv_root = systemconfig["MVROOT"] + mythip = systemconfig.get("mythip") + systemtype = systemconfig.get("SystemType") + mv_root = systemconfig.get("MVROOT") mysqltxt = "/usr/share/mythtv/mysql.txt" - templates = systemconfig["TEMPLATES"] + templates = systemconfig.get("TEMPLATES") mysqltemplate = templates + "/mysql.txt" - dbhost = systemconfig["dbhost"] + dbhost = systemconfig.get("dbhost") if systemtype == "Master_backend": logging.debug(" Setting dbhost to %s in systemconfig", mythip) @@ -135,23 +135,23 @@ def hostypeprint(systemconfig): daemon_remove_list='' run_mysqlnetwork = False - if systemconfig["SystemType"] == "Standalone": + if systemconfig.get("SystemType") == "Standalone": logging.info("Stand alone system being configured") setup_ntp(False,"null") remove_avahi_service() EnableNetwork = False run_mysqlnetwork = True - if systemconfig["hostypec"]: + if systemconfig.get("hostypec"): 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') - elif systemconfig["SystemType"] == "Master_backend": + elif systemconfig.get("SystemType") == "Master_backend": logging.info("Master backend system being configured") setup_ntp(False,"null") - setup_avahi(systemconfig["TEMPLATES"]) + setup_avahi(systemconfig.get("TEMPLATES")) install_list=["mysql", "mythdb-initial", "avahi", "rpcbind", "nfs-utils", "local-website", "myth2ipod", "mythtv-status"] daemon_list=["mysql", "mythbackend", "avahi", "rpcbind", "nfs-common", "netfs", "lighttpd"] EnableNetwork = True @@ -163,11 +163,11 @@ def hostypeprint(systemconfig): daemon_list.append('certmaster') install_list.append('ghosd') - elif systemconfig["SystemType"] == "Slave_backend": + elif systemconfig.get("SystemType") == "Slave_backend": logging.info("Slave backend system being configured") - setup_ntp(True,systemconfig["dbhost"]) + setup_ntp(True,systemconfig.get("dbhost")) remove_avahi_service() - if systemconfig["hostypec"]: + if systemconfig.get("hostypec"): setup_db() install_list = ["rpcbind", "nfs-utils", "local-website", "avahi", "libmysqlclient" ] daemon_list = ["mythbackend", "rpcbind", "nfs-common", "netfs", "lighttpd", "avahi" ] @@ -181,9 +181,9 @@ def hostypeprint(systemconfig): install_list.append('ghosd') - elif systemconfig["SystemType"] == "Frontend_only": + elif systemconfig.get("SystemType") == "Frontend_only": logging.info("Frontend only system being configured") - setup_ntp(True,systemconfig["dbhost"]) + setup_ntp(True,systemconfig.get("dbhost")) remove_avahi_service() install_list=["mysql-clients", "libmysqlclient", "avahi", "rpcbind", "nfs-utils", "local-website"] remove_list=["mysql"] @@ -206,7 +206,7 @@ def hostypeprint(systemconfig): mv_common.add_service(daemon) for daemon in daemon_remove_list: mv_common.remove_service(daemon) - if systemconfig["RunFrontend"] == "1": + if systemconfig.get("RunFrontend") == "1": logging.debug(" Will run the frontend") mv_common.add_service("frontend") mv_common.add_service("hal") @@ -227,7 +227,7 @@ def hostypeprint(systemconfig): setup_mysql_connection(systemconfig) if data_config.SYSTEMTYPE == "MythVantage": - setup_func_minion(systemconfig["dbhost"]) + setup_func_minion(systemconfig.get("dbhost")) setup_func_key() - setup_syslog(systemconfig["dbhost"]) + setup_syslog(systemconfig.get("dbhost")) 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 694a0b8..c032aad 100755 --- a/abs/core/LinHES-config/mv_install.py +++ b/abs/core/LinHES-config/mv_install.py @@ -651,6 +651,18 @@ def fstab_it(install_type): logging.debug(" New fstab line:") logging.debug( newline) newfstab.append(newline) + elif line.startswith("none"): + templine = line.split() + if ( templine[1] == "/dev/pts" ): + newline = '''devpts /dev/pts devpts defaults 0 0 \n''' + logging.debug(" New fstab line (converted):") + logging.debug( newline) + newfstab.append(newline) + if ( templine[1] == "/dev/shm" ): + newline = '''shm /dev/shm tmpfs nodev,nosuid 0 0 \n''' + logging.debug(" New fstab line(converted):") + logging.debug( newline) + newfstab.append(newline) else: logging.debug(" Line didn't match, adding to newfstab:") logging.debug( line) diff --git a/abs/core/LinHES-config/mv_ir.py b/abs/core/LinHES-config/mv_ir.py index a5e3f3b..f3be276 100755 --- a/abs/core/LinHES-config/mv_ir.py +++ b/abs/core/LinHES-config/mv_ir.py @@ -294,36 +294,36 @@ def setup_ir(systemconfig, data_config): return rc logging.info("____Start of IR____") - if systemconfig["Remotetype"] == "tinker": + if systemconfig.get("Remotetype") == "tinker": logging.info(" Tinker mode detected") else: - if not systemconfig["HostBlasterType"]: + if not systemconfig.get("HostBlasterType"): HostBlasterType = "unknown" Hostnumblaster = "0" else: - HostBlasterType = systemconfig["HostBlasterType"] - Hostnumblaster = systemconfig["Hostnumblaster"] + HostBlasterType = systemconfig.get("HostBlasterType") + Hostnumblaster = systemconfig.get("Hostnumblaster") - if systemconfig["HostBlasterType"] == "pvr150": + if systemconfig.get("HostBlasterType") == "pvr150": remotetype = "hauppauge-blaster" logging.debug(" pvr150 blaster selected, setting remote to hauppauge-blaster") else: - remotetype = systemconfig["Remotetype"] + remotetype = systemconfig.get("Remotetype") - setup_ir_remote(remotetype,systemconfig["TEMPLATES"]) + setup_ir_remote(remotetype,systemconfig.get("TEMPLATES")) setup_lirc_links(data_config.MYTHHOME) - if systemconfig["ReceiverType"]: - setup_ir_receiver(systemconfig["ReceiverType"], - systemconfig["TEMPLATES"], - systemconfig["HDHRlirc_device"], - systemconfig["mythip"]) + if systemconfig.get("ReceiverType"): + setup_ir_receiver(systemconfig.get("ReceiverType"), + systemconfig.get("TEMPLATES"), + systemconfig.get("HDHRlirc_device"), + systemconfig.get("mythip")) else: - setup_ir_receiver("unknown", systemconfig["TEMPLATES"],'','127.0.0.1') + setup_ir_receiver("unknown", systemconfig.get("TEMPLATES"),'','127.0.0.1') unload_all_lirc() setup_blaster_proto(HostBlasterType, Hostnumblaster, - systemconfig["TEMPLATES"], + systemconfig.get("TEMPLATES"), systemconfig) setup_blaster_transmiter(HostBlasterType) cmd = "load-modules-mythvantage.sh" @@ -333,10 +333,10 @@ def setup_ir(systemconfig, data_config): cmd="sv start lircd" mv_common.runcmd(cmd) rc = [ True , True ] - if systemconfig["LCDtype"]: - setup_lcd(systemconfig["LCDtype"], - systemconfig["TEMPLATES"], - systemconfig["Remotetype"]) + if systemconfig.get("LCDtype"): + setup_lcd(systemconfig.get("LCDtype"), + systemconfig.get("TEMPLATES"), + systemconfig.get("Remotetype")) else: logging.debug(" LCD not defined") logging.info("__End IR\n") diff --git a/abs/core/LinHES-config/mv_misc.py b/abs/core/LinHES-config/mv_misc.py index 9ea9c95..f49615a 100755 --- a/abs/core/LinHES-config/mv_misc.py +++ b/abs/core/LinHES-config/mv_misc.py @@ -58,40 +58,40 @@ def setup_tz(timezone,TEMPLATES): def setup_nfs(systemconfig): nfslist=[] logging.info("____Start of setup_nfs____") - scrubnfs(systemconfig["TEMPLATES"]) + scrubnfs(systemconfig.get("TEMPLATES")) - if systemconfig["HaveCentralNFS"] == "yes": + if systemconfig.get("HaveCentralNFS") == "yes": logging.debug(" Using a Central NFS server") - if systemconfig["NFSserver"] == "file:nfsmap": + if systemconfig.get("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"]) + nfsmap_file = download_nfsmap(systemconfig.get("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] + elif re.search(systemconfig.get("NFSserver"),":nfsmap"): + ip=systemconfig.get("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"]) + item = (systemconfig.get("NFSserver") , systemconfig["NFSmount"]) nfslist.append(item) else: #if standalone or slave try to use MBE - if systemconfig["SystemType"] == "Frontend_only" or systemconfig["SystemType"] == "Slave_Backend": - item = (systemconfig["dbhost"] , data_config.DATAMOUNT) + if systemconfig.get("SystemType") == "Frontend_only" or systemconfig["SystemType"] == "Slave_Backend": + item = (systemconfig.get("dbhost") , data_config.DATAMOUNT) nfslist.append(item) setup_nfs_fstab(nfslist) logging.info("__End of nfs\n") def setup_sleep(systemconfig): logging.debug("____Setting up sleep____") - autoshutdown = systemconfig["AutoShutdown"] - stime1 = systemconfig["Shutdowntime"] - stime2 = systemconfig["Shutdowntime2"] + autoshutdown = systemconfig.get("AutoShutdown") + stime1 = systemconfig.get("Shutdowntime") + stime2 = systemconfig.get("Shutdowntime2") cstime1='' if autoshutdown == "1" : @@ -104,11 +104,11 @@ def setup_sleep(systemconfig): 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"]) + cmd='''sed -e "s/HOUR/%s/g" %s/cron.template | crontab - -u mythtv''' %(cshutdown,systemconfig.get("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"] + cmd='''sed -e "/00 HOUR.*/d" %s/cron.template | crontab - -u mythtv''' %systemconfig.get("TEMPLATES") mv_common.runcmd(cmd) logging.debug("__End of sleep\n") diff --git a/abs/core/LinHES-config/mv_network.py b/abs/core/LinHES-config/mv_network.py index f256785..f25d4bc 100755 --- a/abs/core/LinHES-config/mv_network.py +++ b/abs/core/LinHES-config/mv_network.py @@ -8,7 +8,7 @@ global etcnetdir etcnetdir = "/etc/net/ifaces" def setup_MYTH_DHCP(systemconfig): - default_interface = systemconfig["default_interface"] + default_interface = systemconfig.get("default_interface") try: defaultdhcp = systemconfig["HostUSEDHCP"+default_interface] except: @@ -69,7 +69,7 @@ def get_default_route(iface): return rcroute def setup_MYTH_IP(systemconfig): - default_interface = systemconfig["default_interface"] + default_interface = systemconfig.get("default_interface") #check for dhcp in use if setup_MYTH_DHCP(systemconfig) == "0": logging.debug(" dhcp is in use, finding dhcp ip") @@ -85,7 +85,7 @@ def setup_MYTH_IP(systemconfig): def setup_MYTH_GW(systemconfig): - default_interface = systemconfig["default_interface"] + default_interface = systemconfig.get("default_interface") #check for dhcp in use if setup_MYTH_DHCP(systemconfig) == "0": logging.debug(" dhcp is in use, finding dhcp ip") @@ -154,7 +154,7 @@ def setup_nameserver(dns): def setup_hostname(systemconfig): logging.debug(" _Start of setup_hostname") try: - hostname = systemconfig["hostname"] + hostname = systemconfig.get("hostname") except: logging.critical(" *Hostname could not be set") logging.info(" Using default value of me") @@ -164,14 +164,14 @@ def setup_hostname(systemconfig): mv_common.runcmd(cmd) cmd = "cat /etc/hosts | grep -v 127.0.0.1 | grep -v %s > /tmp/hosts" %hostname mv_common.runcmd(cmd) - if systemconfig["mythdhcp"] == "1" : + if systemconfig.get("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"]) + cmd = ''' echo %s %s >> /etc/hosts ''' %(systemconfig.get("mythip"), systemconfig["hostname"]) mv_common.runcmd(cmd) else: - cmd = ''' echo 127.0.0.1 %s localhost > /etc/hosts ''' %systemconfig["hostname"] + cmd = ''' echo 127.0.0.1 %s localhost > /etc/hosts ''' %systemconfig.get("hostname") mv_common.runcmd(cmd) cmd = '''cat /tmp/hosts >> /etc/hosts ''' mv_common.runcmd(cmd) @@ -250,8 +250,8 @@ def setup_interface(netdev,systemconfig): netinfo = {} #populate the netinfo dict for netitem in nettrans: - if systemconfig[netitem+netdev]: - netinfo[nettrans[netitem]] = systemconfig[netitem+netdev] + if systemconfig.get(netitem+netdev): + netinfo[nettrans[netitem]] = systemconfig.get(netitem+netdev) else: netinfo[nettrans[netitem]] = False logging.debug(" %s:%s",netitem,netinfo[nettrans[netitem]]) @@ -267,7 +267,7 @@ def setup_interface(netdev,systemconfig): os.makedirs(etcnetdir+"/"+netdev) except: pass - mv_common.cp_and_log(systemconfig["TEMPLATES"]+"/etcnet/eth/options", optionfile) + mv_common.cp_and_log(systemconfig.get("TEMPLATES")+"/etcnet/eth/options", optionfile) if netinfo["isactive"] == "1" : change_iface_state(netdev,"enabled") @@ -380,7 +380,7 @@ def find_active(systemconfig,this_is_install): interfacelist=('eth0', 'eth1', 'wlan0', 'wlan1', 'ath0') logging.debug(" _Start of find_active") - if systemconfig["mythdhcp"] == "1": + if systemconfig.get("mythdhcp") == "1": mv_common.remove_file("/etc/resolv.conf") cmd = ''' echo search lan > /etc/resolv.conf ''' mv_common.runcmd(cmd) @@ -397,7 +397,7 @@ def find_active(systemconfig,this_is_install): logging.debug(" %s is not defined",currentnet) change_iface_state(netdev, "disabled") continue - if systemconfig[currentnet] == "1" : + if systemconfig.get(currentnet) == "1" : #check if device is present if devcheck(netdev) : setup_interface(netdev,systemconfig) @@ -458,8 +458,8 @@ def hostname_change_check(systemconfig): logging.debug(" _Start of hostname_change_check") oldhostname = socket.gethostname() #oldhostname = "crap" - newhostname = systemconfig["hostname"] - mv_root = systemconfig["MVROOT"] + newhostname = systemconfig.get("hostname") + mv_root = systemconfig.get("MVROOT") logging.debug(" Old hostname: %s", oldhostname) logging.debug(" New hostname: %s", newhostname) if oldhostname != newhostname : @@ -469,7 +469,7 @@ def hostname_change_check(systemconfig): logging.info(" Changing hostname to %s", newhostname) cmd = "hostname %s" %newhostname mv_common.runcmd(cmd) - if systemconfig["SystemType"] != "Frontend_only" : + if systemconfig.get("SystemType") != "Frontend_only" : logging.info(" Restarting backend") mv_common.stop_service("mythbackend") mv_common.start_service("mythbackend") diff --git a/abs/core/LinHES-config/mv_screensaver.py b/abs/core/LinHES-config/mv_screensaver.py index 35f0868..6a5ce1c 100755 --- a/abs/core/LinHES-config/mv_screensaver.py +++ b/abs/core/LinHES-config/mv_screensaver.py @@ -167,12 +167,12 @@ def setup_screensaver (systemconfig,data_config): logging.info("____Skipping of Screensaver, config disabled____") return logging.info("____Start of screensaver configuration____") - screensavertype = systemconfig["Screensavertype"] - theme = systemconfig["Screensavertheme"] - idletime = systemconfig["Screensaveridle"] + screensavertype = systemconfig.get("Screensavertype") + theme = systemconfig.get("Screensavertheme") + idletime = systemconfig.get("Screensaveridle") configfile = data_config.MYTHHOME+"/.xscreensaver" - templatefile = systemconfig["TEMPLATES"]+"/xscreensaver.template" - mtemplate = systemconfig["TEMPLATES"]+"/mplayer.conf.template" + templatefile = systemconfig.get("TEMPLATES")+"/xscreensaver.template" + mtemplate = systemconfig.get("TEMPLATES")+"/mplayer.conf.template" if screensavertype == "xscreensaver": mv_common.pacinstall("xscreensaver") diff --git a/abs/core/LinHES-config/systemconfig.py b/abs/core/LinHES-config/systemconfig.py index c1d780d..3cba427 100755 --- a/abs/core/LinHES-config/systemconfig.py +++ b/abs/core/LinHES-config/systemconfig.py @@ -42,13 +42,13 @@ def setup_x(systemconfig): if not os.path.exists('/usr/share/icons/default'): if os.path.exists('/usr/share/icons/whiteglass'): os.symlink('/usr/share/icons/whiteglass','/usr/share/icons/default'); - if systemconfig["UseXLargeMouse"] == "1" : + if systemconfig.get("UseXLargeMouse") == "1" : cmd = "echo Xcursor.size: 48 > %s/.Xdefaults" %data_config.MYTHHOME else: cmd = "echo Xcursor.size: 16 > %s/.Xdefaults" %data_config.MYTHHOME mv_common.runcmd(cmd) - cmd = "%s/bin/xconfig.sh" %systemconfig["MVROOT"] + cmd = "%s/bin/xconfig.sh" %systemconfig.get("MVROOT") mv_common.runcmd(cmd) def main(argv): @@ -140,8 +140,8 @@ def main(argv): logging.info("____Skipping of Audio, config disabled____") else: 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"]) + if not systemconfig.get("Audiotype") == "tinker": + cmd="%s/bin/soundconfig.sh -t real -i %s -d %s" %(MVROOT,systemconfig.get("Audiotype"),systemconfig["SoundDevice"]) mv_common.runcmd(cmd) else: logging.debug(" Tinker mode(audio), not changing configuration") @@ -153,8 +153,8 @@ def main(argv): else: import mv_misc #zipcode is no longer used - #mv_misc.setup_zip(MVROOT,systemconfig["zipcode"]) - mv_misc.setup_tz(systemconfig["timezone"],systemconfig["TEMPLATES"]) + #mv_misc.setup_zip(MVROOT,systemconfig.get("zipcode")) + mv_misc.setup_tz(systemconfig.get("timezone"),systemconfig["TEMPLATES"]) mv_misc.setup_nfs(systemconfig) if cmdmodule["sleep"]: @@ -166,7 +166,7 @@ def main(argv): if cmdmodule["webuser"]: import mv_webuser - mv_webuser.setup_web_auth(systemconfig["UseMythWEB_auth"]) + mv_webuser.setup_web_auth(systemconfig.get("UseMythWEB_auth")) if cmdmodule["ddns"]: import mv_ddns @@ -194,19 +194,19 @@ def main(argv): mv_common.restartfe(restartlcd) if cmdmodule["reloadfe"]: - mv_common.reloadfe(systemconfig["dbhost"],restartlcd) + mv_common.reloadfe(systemconfig.get("dbhost"),restartlcd) if cmdmodule["smolt"]: import mv_smolt - mv_smolt.setup_smolt_type(systemconfig["SystemType"], - systemconfig["Remotetype"], - systemconfig["RunFrontend"], + mv_smolt.setup_smolt_type(systemconfig.get("SystemType"), + systemconfig.get("Remotetype"), + systemconfig.get("RunFrontend"), data_config.MYTHHOME, data_config.SYSTEMTYPE) if cmdmodule["user"]: logging.info("____Start of ssh user____") - if systemconfig["rootSSH"] == "1" : + if systemconfig.get("rootSSH") == "1" : logging.info(" Allowing ssh access for root") cmd = '''sed -i "s/^.*PermitRootLogin.*$/PermitRootLogin yes/" /etc/ssh/sshd_config''' mv_common.runcmd(cmd) |