diff options
Diffstat (limited to 'abs/core/LinHES-config/mv_common.py')
-rwxr-xr-x | abs/core/LinHES-config/mv_common.py | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/abs/core/LinHES-config/mv_common.py b/abs/core/LinHES-config/mv_common.py index e4bef48..432c270 100755 --- a/abs/core/LinHES-config/mv_common.py +++ b/abs/core/LinHES-config/mv_common.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import logging, os, time import commands +import subprocess import ConfigParser import urllib2 config_file = "mv_config" @@ -62,6 +63,10 @@ def read_config(module_config,data): return rvalue + +def runcmd_bg(cmd): + subprocess.Popen(cmd) + def runcmd(cmd): if data_config.NOOPDEBUG=="FALSE": pass @@ -108,22 +113,24 @@ def link_file(srcfile,link_name): return -def mkdir_mythhome(mythhome): +def mkdir_mythhome(mythhome,user,grp=1000): 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 + try: - os.chown(mythhome+"/.mythtv", mythuid, mythgid) - logging.debug("* Couldn't chown of %s", mythhome) - except: - cmd = ''' chown -R mythtv %s/.mythtv''' %mythhome + #os.chown(mythhome+"/.mythtv", int(user), int(grp)) + #logging.debug("* Couldn't chown of %s", mythhome) + + cmd = ''' chown -R %s %s/.mythtv''' %(user,mythhome) runcmd(cmd) - cmd = ''' chgrp -R mythtv %s/.mythtv''' %mythhome + cmd = ''' chgrp -R %s %s/.mythtv''' %(grp,mythhome) runcmd(cmd) + except: + logging.debug("* Couldn't chown of %s", mythhome) pass @@ -162,6 +169,16 @@ def restart_service(daemon): cmd = "sv restart %s" %daemon runcmd(cmd) +def check_service(daemon): + logging.info(" Checking status of service %s",daemon) + cmd = "sv status %s" %daemon + results = runcmd_output(cmd) + status = results.split()[0] + if status == "run:": + return True + else: + return False + def hup_service(daemon): logging.info(" hup service %s",daemon) cmd = "sv hup %s" %daemon @@ -195,6 +212,7 @@ def pacinstall(pkg): elif pkg == "dvdcss": pacinstall("libdvdcss") elif pkg == "webmin": + pacinstall("webmin") add_service("webmin") elif pkg == "fuppes": pacinstall("fuppes-svn") @@ -204,6 +222,15 @@ def pacinstall(pkg): pacinstall("dolphin-emu") elif pkg == "webonlinhes": pacinstall("web-on-linhes") + elif pkg == "mame": + pacinstall("sdlmame") + elif pkg == "foldingathome": + add_service("fah") + + elif pkg == "xymonclient": + if os.path.exists('/home/xymon/client'): + cmd='''pacman --noconfirm --dbonly -Sddf xymonclient''' + runcmd(cmd) if not pkg_blacklist_check(pkg): if pkg_installed_check(pkg): @@ -231,6 +258,11 @@ def pacremove(pkg): pacremove("dolphin-emu") elif pkg == "webonlinhes": pacremove("web-on-linhes") + elif pkg == "mame": + pacremove("sdlmame") + elif pkg == "foldingathome": + remove_service("fah") + if not pkg_blacklist_check(pkg): if not pkg_installed_check(pkg): |