diff options
| author | James Meyer <james.meyer@operamail.com> | 2010-03-28 00:54:01 (GMT) | 
|---|---|---|
| committer | James Meyer <james.meyer@operamail.com> | 2010-03-28 00:54:01 (GMT) | 
| commit | 26444d35e3ce38da0504600900d4775eb7a5970b (patch) | |
| tree | eb8fafbd5ffafc980925f3a8e57c117bc8daada0 | |
| parent | a2c0883f206547f76d207a8477afc82a07cf0a30 (diff) | |
| download | linhes_pkgbuild-26444d35e3ce38da0504600900d4775eb7a5970b.zip linhes_pkgbuild-26444d35e3ce38da0504600900d4775eb7a5970b.tar.gz linhes_pkgbuild-26444d35e3ce38da0504600900d4775eb7a5970b.tar.bz2 | |
linhes-systemconfig: add ability to enable or disable modules based on configfile
/etc/mythvantage.cfg is the config file
Changing any value to False will make systemconfig.py skip that module and print what section is being skipped.
closes #663
| -rw-r--r-- | abs/core-testing/LinHES-config/PKGBUILD | 126 | ||||
| -rwxr-xr-x | abs/core-testing/LinHES-config/mv_advanced.py | 3 | ||||
| -rwxr-xr-x | abs/core-testing/LinHES-config/mv_common.py | 25 | ||||
| -rwxr-xr-x | abs/core-testing/LinHES-config/mv_ddns.py | 5 | ||||
| -rwxr-xr-x | abs/core-testing/LinHES-config/mv_hostype.py | 3 | ||||
| -rwxr-xr-x | abs/core-testing/LinHES-config/mv_ir.py | 6 | ||||
| -rwxr-xr-x | abs/core-testing/LinHES-config/mv_network.py | 3 | ||||
| -rwxr-xr-x | abs/core-testing/LinHES-config/mv_screensaver.py | 3 | ||||
| -rwxr-xr-x | abs/core-testing/LinHES-config/mv_smolt.py | 3 | ||||
| -rwxr-xr-x | abs/core-testing/LinHES-config/mv_software.py | 4 | ||||
| -rwxr-xr-x | abs/core-testing/LinHES-config/mv_webuser.py | 4 | ||||
| -rw-r--r-- | abs/core-testing/LinHES-config/mythvantage.cfg | 21 | ||||
| -rwxr-xr-x | abs/core-testing/LinHES-config/systemconfig.py | 45 | 
13 files changed, 173 insertions, 78 deletions
| diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD index 942dc4d..ce6d7d8 100644 --- a/abs/core-testing/LinHES-config/PKGBUILD +++ b/abs/core-testing/LinHES-config/PKGBUILD @@ -1,49 +1,51 @@  pkgname=LinHES-config  pkgver=2.1 -pkgrel=28 +pkgrel=32  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'  -	 'sg3_utils' 'nmbscan' 'system-templates' 'rsync' 'python-parted'  -	 'ddcxinfo' 'python-pexpect' 'python-netifaces' 'LinHES-timezone'  +depends=('bc' 'libstatgrab'  'mysql-python' 'expect' 'curl' 'dnsutils' 'parted' +	 'sg3_utils' 'nmbscan' 'system-templates' 'rsync' 'python-parted' +	 'ddcxinfo' 'python-pexpect' 'python-netifaces' 'LinHES-timezone'  	 'python-iplib' 'mythinstall>=2-10')  arch=('i686') -source=(mv_install.py  -	mv_config.py  -	myth_user_call  -	file_time_offset.py  -	install_proxy.sh  -	install_functions.sh  -	systemconfig.sh  -	install_db_chroot.sh  -	restore_default_settings.sh  -	xconfig.sh  -	timezip.py  -	soundconfig.sh  -	LinHES-release  -	issue  -	MythVantage.sh  -	create_master.sh  -	build_diskless.sh  -	networkconfig.sh  -	autocard.py  -	restore_km_db_chroot.sh  -	README  -	mv_advanced.py  -	mv_common.py  -	mv_ddns.py  -	mv_ir.py  -	mv_misc.py  -	mv_network.py  -	mv_screensaver.py  -	mv_smolt.py  -	mv_software.py  -	mv_webuser.py  -	mv_hostype.py  -	systemconfig.py  -	myth_user_call.py) +source=(mv_install.py +	mv_config.py +	myth_user_call +	file_time_offset.py +	install_proxy.sh +	install_functions.sh +	systemconfig.sh +	install_db_chroot.sh +	restore_default_settings.sh +	xconfig.sh +	timezip.py +	soundconfig.sh +	LinHES-release +	issue +	MythVantage.sh +	create_master.sh +	build_diskless.sh +	networkconfig.sh +	autocard.py +	restore_km_db_chroot.sh +	README +	mv_advanced.py +	mv_common.py +	mv_ddns.py +	mv_ir.py +	mv_misc.py +	mv_network.py +	mv_screensaver.py +	mv_smolt.py +	mv_software.py +	mv_webuser.py +	mv_hostype.py +	systemconfig.py +	myth_user_call.py +	mythvantage.cfg) +backup=(etc/mythvantage.cfg)  install=LinHES.install  build() { @@ -75,17 +77,18 @@ build() {      install -m 0755 mv_config.py $MVDIR/bin/mv_config.py      install -m 0755 mv_install.py $MVDIR/bin/mv_install.py      install -m 0755 mv_advanced.py  $MVDIR/bin/ -    install -m 0755 mv_common.py $MVDIR/bin/  -    install -m 0755 mv_ddns.py  $MVDIR/bin/  -    install -m 0755 mv_ir.py  $MVDIR/bin/  -    install -m 0755 mv_misc.py  $MVDIR/bin/  -    install -m 0755 mv_network.py  $MVDIR/bin/  -    install -m 0755 mv_screensaver.py  $MVDIR/bin/  -    install -m 0755 mv_smolt.py  $MVDIR/bin/  -    install -m 0755 mv_software.py  $MVDIR/bin/  -    install -m 0755 mv_webuser.py $MVDIR/bin/  -    install -m 0755 mv_hostype.py $MVDIR/bin/  -    install -m 0755 systemconfig.py $MVDIR/bin/  +    install -m 0755 mv_common.py $MVDIR/bin/ +    install -m 0755 mv_ddns.py  $MVDIR/bin/ +    install -m 0755 mv_ir.py  $MVDIR/bin/ +    install -m 0755 mv_misc.py  $MVDIR/bin/ +    install -m 0755 mv_network.py  $MVDIR/bin/ +    install -m 0755 mv_screensaver.py  $MVDIR/bin/ +    install -m 0755 mv_smolt.py  $MVDIR/bin/ +    install -m 0755 mv_software.py  $MVDIR/bin/ +    install -m 0755 mv_webuser.py $MVDIR/bin/ +    install -m 0755 mv_hostype.py $MVDIR/bin/ +    install -m 0755 systemconfig.py $MVDIR/bin/ +    install -m 0755 mythvantage.cfg $startdir/pkg/etc/      #README file displayed on install      install -m 0755 README $MVDIR/README @@ -119,16 +122,17 @@ md5sums=('297441b8d85820698c19e7c0ad5a3dfe'           '687555968d4ca688d8f95c8f13e1d8d4'           '3d1e4a119f38cff0498bf8a67e94e4b3'           '37401edf67296d3a4467ad178958d177' -         '4fa90a581278115c914fd356391b656f' -         '322cd6d5ce36f5d21bd84c3ca4ddfeec' -         '86d6d1672bf2bc1bdde18dd35b31383d' -         '8eb056f2ba0045e9f95578915dfecd22' +         'ee7c8e1f025ce1527ecfffabafb26806' +         '41b03fb1e0a9d9ae7588e3b813212772' +         'a9ffe72c3ede99d505fdc97572a7c256' +         'f1c98a4acb01d9284d192149914c1e18'           '65d93f15ac85adf8299552581789a731' -         '5d774c28dbee0f495ff6eabd30b459f6' -         '32385482ecc1275409b71f08d8b03acc' -         'da0a2fb1e3cdbabac1f62e8b908c5d7f' -         '1afc8d33021852d0254ae4a4d1f60888' -         'f19917bed3a1e00cbe08838bee18b4b7' -         '3c9adbbc1242d4e0a646af2e723924c7' -         '4ae4b8cd9d40e072697d29ef85d18dc8' -         'cf60e7ba4cf3467bb5539d5c51da61b6') +         '4badc3c664c55f87396a473e6c14d4bc' +         'e2aa772fe0bf366e26eaaf663f9257bd' +         'fe5e31b833cc6707209e9d656b6eb53c' +         'd328d63eaa4252f3d4888476c79bbff6' +         '23d0e12b7ca1cc6ea6b993c1d7ff20b9' +         '88059ef8c4a2926bb6fde14d810e1336' +         'cf35353141b70145f3ee8b0bd852c9f1' +         'cf60e7ba4cf3467bb5539d5c51da61b6' +         'a63ff9ef5250965aeabc74bfa8e43981') diff --git a/abs/core-testing/LinHES-config/mv_advanced.py b/abs/core-testing/LinHES-config/mv_advanced.py index d07b7cb..bc0d19e 100755 --- a/abs/core-testing/LinHES-config/mv_advanced.py +++ b/abs/core-testing/LinHES-config/mv_advanced.py @@ -349,6 +349,9 @@ def setup_dyndns(DDnsEnable):  def setup_advanced(systemconfig,data_config): +    if  mv_common.read_config(mv_common.module_config,"advanced")  == False  : +        logging.info("____Skipping of Advanced, config disabled____") +        return      logging.info("____Start of advanced configuration____")      create_link = False      if systemconfig["SystemType"] == "Master_backend": diff --git a/abs/core-testing/LinHES-config/mv_common.py b/abs/core-testing/LinHES-config/mv_common.py index 28b53d7..0272809 100755 --- a/abs/core-testing/LinHES-config/mv_common.py +++ b/abs/core-testing/LinHES-config/mv_common.py @@ -1,9 +1,34 @@  # -*- coding: utf-8 -*-  import logging, os, time  import commands +import ConfigParser  config_file = "mv_config"  data_config = __import__(config_file, globals(), locals(), []) +module_config = ConfigParser.RawConfigParser() +try: +    module_config.read('/etc/mythvantage.cfg') +except: +    logging.info("couldn't read mythvantage.cfg") + + +def read_config(module_config,data): +    rvalue = True +    section = "mythvantage" +    try: +        rvalue = module_config.get(section, data) +        if rvalue == "False": +            rvalue = False +        if rvalue == "no": +            rvalue = False + + +    except: +        logging.debug("Couldn't read mythvantage.cfg") +        rvalue = True + +    return rvalue +  def runcmd(cmd):      if data_config.NOOPDEBUG=="FALSE":          pass diff --git a/abs/core-testing/LinHES-config/mv_ddns.py b/abs/core-testing/LinHES-config/mv_ddns.py index 7ac7d3a..9695f76 100755 --- a/abs/core-testing/LinHES-config/mv_ddns.py +++ b/abs/core-testing/LinHES-config/mv_ddns.py @@ -5,12 +5,15 @@ import os, re  config_file = "mv_config"  def setup_ddns(systemconfig): +    if  mv_common.read_config(mv_common.module_config,"ddns")  == False  : +        logging.info("____Skipping of DDNS, config disabled____") +        return      logging.info("____Start of setup_ddns____")      if systemconfig["DDnsEnable"] == "1":          logging.debug("    Enabling DDNS")  	mv_common.pacinstall("ddclient") -	mv_common.cp_and_log("/etc/ddclient/ddclient.conf.dynamic.dyndns.sample",  +	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"])  	mv_common.runcmd(cmd) diff --git a/abs/core-testing/LinHES-config/mv_hostype.py b/abs/core-testing/LinHES-config/mv_hostype.py index d6ec0ed..c6f4a36 100755 --- a/abs/core-testing/LinHES-config/mv_hostype.py +++ b/abs/core-testing/LinHES-config/mv_hostype.py @@ -124,6 +124,9 @@ def setup_syslog(dbhost):      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_____")      mv_common.services(systemconfig)      install_list='' diff --git a/abs/core-testing/LinHES-config/mv_ir.py b/abs/core-testing/LinHES-config/mv_ir.py index bc1ae37..3573ee3 100755 --- a/abs/core-testing/LinHES-config/mv_ir.py +++ b/abs/core-testing/LinHES-config/mv_ir.py @@ -281,7 +281,11 @@ def setup_lcd(LCDtype, TEMPLATES, Remotetype):      logging.debug("__End of setup_lcd")  def setup_ir(systemconfig, data_config): -    rc = False +    rc = [ False , False ] +    if  mv_common.read_config(mv_common.module_config,"ir")  == False  : +        logging.info("____Skipping of IR, config disabled____") +        return rc +      logging.info("____Start of IR____")      if systemconfig["Remotetype"] == "tinker":          logging.info("    Tinker mode detected") diff --git a/abs/core-testing/LinHES-config/mv_network.py b/abs/core-testing/LinHES-config/mv_network.py index 2a55c63..f256785 100755 --- a/abs/core-testing/LinHES-config/mv_network.py +++ b/abs/core-testing/LinHES-config/mv_network.py @@ -482,6 +482,9 @@ def hostname_change_check(systemconfig):  def setup_network (systemconfig,this_is_install): +    if  mv_common.read_config(mv_common.module_config,"network")  == False  : +        logging.info("____Skipping of network, config disabled____") +        return False      logging.info("____Start of network____")      logging.info("    Setting up the network")      restartfe = hostname_change_check(systemconfig) diff --git a/abs/core-testing/LinHES-config/mv_screensaver.py b/abs/core-testing/LinHES-config/mv_screensaver.py index 2da970c..4068832 100755 --- a/abs/core-testing/LinHES-config/mv_screensaver.py +++ b/abs/core-testing/LinHES-config/mv_screensaver.py @@ -163,6 +163,9 @@ def setup_gnome_screensaver(theme,idletime):  def setup_screensaver (systemconfig,data_config): +    if  mv_common.read_config(mv_common.module_config,"screensaver")  == False  : +        logging.info("____Skipping of Screensaver, config disabled____") +        return      logging.info("____Start of screensaver configuration____")      screensavertype = systemconfig["Screensavertype"]      theme = systemconfig["Screensavertheme"] diff --git a/abs/core-testing/LinHES-config/mv_smolt.py b/abs/core-testing/LinHES-config/mv_smolt.py index 5fd3722..cfc697e 100755 --- a/abs/core-testing/LinHES-config/mv_smolt.py +++ b/abs/core-testing/LinHES-config/mv_smolt.py @@ -20,6 +20,9 @@ def read_release(stype):  def setup_smolt_type(SystemType,Remotetype,RunFrontend,mythhome,stype): +    if  mv_common.read_config(mv_common.module_config,"smolt")  == False  : +        logging.info("____Skipping of smolt, config disabled____") +        return      logging.debug("____Start of setup_smolt_type____")      releasename = read_release(stype) diff --git a/abs/core-testing/LinHES-config/mv_software.py b/abs/core-testing/LinHES-config/mv_software.py index 4ee2e4d..c0f5a5b 100755 --- a/abs/core-testing/LinHES-config/mv_software.py +++ b/abs/core-testing/LinHES-config/mv_software.py @@ -3,6 +3,10 @@ import logging, mv_common  import os, re  def setup_software(systemconfig, data_config): +    if  mv_common.read_config(mv_common.module_config,"software")  == False  : +        logging.info("____Skipping of software, config disabled____") +        return +      logging.info("____Start of Software install____")      postfix=''      if data_config.SYSTEMTYPE == "MythVantage": diff --git a/abs/core-testing/LinHES-config/mv_webuser.py b/abs/core-testing/LinHES-config/mv_webuser.py index a8517a8..3e383f2 100755 --- a/abs/core-testing/LinHES-config/mv_webuser.py +++ b/abs/core-testing/LinHES-config/mv_webuser.py @@ -3,6 +3,10 @@ import logging, mv_common  #import os  def setup_web_auth(UseMythWEB_auth): +    if  mv_common.read_config(mv_common.module_config,"webuser")  == False  : +        logging.info("____Skipping of webuser, config disabled____") +        return +      logging.info("____Start of setup_web_auth____")      if UseMythWEB_auth == str(1):          #enable auth diff --git a/abs/core-testing/LinHES-config/mythvantage.cfg b/abs/core-testing/LinHES-config/mythvantage.cfg new file mode 100644 index 0000000..eaa4865 --- /dev/null +++ b/abs/core-testing/LinHES-config/mythvantage.cfg @@ -0,0 +1,21 @@ +[mythvantage] +#change any of the following to False or True +# True will allow systemconfig to run that module +# False will skip the module +misc = True +sleep = True +hostype = True +advanced = True +audio = True +network = True +xorg = True +webuser = True +restartfe = True +reloadfe = True +ddns = True +screensaver = True +ir = True +user = True +software = True +smolt = True + diff --git a/abs/core-testing/LinHES-config/systemconfig.py b/abs/core-testing/LinHES-config/systemconfig.py index 28e2e7a..2e07b2f 100755 --- a/abs/core-testing/LinHES-config/systemconfig.py +++ b/abs/core-testing/LinHES-config/systemconfig.py @@ -36,8 +36,11 @@ 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) +    if  mv_common.read_config(mv_common.module_config,"xorg")  == False  : +        logging.info("____Skipping of Xorg, config disabled____") +    else: +        cmd = "%s/bin/xconfig.sh" %systemconfig["MVROOT"] +        mv_common.runcmd(cmd)  def main(argv):      try: @@ -124,23 +127,32 @@ def main(argv):      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) +        if  mv_common.read_config(mv_common.module_config,"audio")  == False  : +            logging.info("____Skipping of Audio, config disabled____")          else: -            logging.debug("    Tinker mode(audio), not changing configuration") -        logging.debug("__End of audio") +            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  mv_common.read_config(mv_common.module_config,"misc")  == False  : +            logging.info("____Skipping of misc, config disabled____") +        else: +            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"]: -        import mv_misc -        mv_misc.setup_sleep(systemconfig) +        if  mv_common.read_config(mv_common.module_config,"sleep")  == False  : +            logging.info("____Skipping of sleep, config disabled____") +        else: +            import mv_misc +            mv_misc.setup_sleep(systemconfig)      if cmdmodule["webuser"]:          import mv_webuser @@ -163,7 +175,10 @@ def main(argv):          mv_software.setup_software(systemconfig, data_config)      if cmdmodule["advancedX"]: -        setup_x(systemconfig) +        if  mv_common.read_config(mv_common.module_config,"xorg")  == False  : +            logging.info("____Skipping of advancedX, config disabled____") +        else: +            setup_x(systemconfig)      if cmdmodule["restartfe"]:          mv_common.restartfe(restartlcd) | 
