From a2b8003706543f561ea00236ef1efd008372b87e Mon Sep 17 00:00:00 2001 From: James Meyer Date: Fri, 24 Aug 2012 23:14:20 -0500 Subject: LinHES-config: added mv_vnc.py --- abs/core/LinHES-config/PKGBUILD | 19 ++++--- abs/core/LinHES-config/mv_advanced.py | 18 +++---- abs/core/LinHES-config/mv_common.py | 16 +++--- abs/core/LinHES-config/mv_config.py | 1 + abs/core/LinHES-config/mv_hostype.py | 2 +- abs/core/LinHES-config/mv_supplemental.py | 0 abs/core/LinHES-config/mv_vnc.py | 87 +++++++++++++++++++++++++++++++ abs/core/LinHES-config/mythvantage.cfg | 1 + abs/core/LinHES-config/print_xorg_res.py | 0 abs/core/LinHES-config/systemconfig.py | 37 +++++++++---- 10 files changed, 146 insertions(+), 35 deletions(-) mode change 100644 => 100755 abs/core/LinHES-config/PKGBUILD mode change 100644 => 100755 abs/core/LinHES-config/mv_supplemental.py create mode 100755 abs/core/LinHES-config/mv_vnc.py mode change 100644 => 100755 abs/core/LinHES-config/print_xorg_res.py diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD old mode 100644 new mode 100755 index 0ea9210..679ce50 --- a/abs/core/LinHES-config/PKGBUILD +++ b/abs/core/LinHES-config/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-config pkgver=2.3 -pkgrel=83 +pkgrel=84 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' @@ -43,7 +43,8 @@ source=(mv_install.py 09_mythvantge_runit_grub mv_webuser.py mv_hostype.py mv_supplemental.py - systemconfig.py + mv_vnc.py + systemconfig.py myth_user_call.py mythvantage.cfg config-sudo.rules @@ -95,6 +96,7 @@ build() { install -m 0755 mv_webuser.py $MVDIR/bin/ install -m 0755 mv_hostype.py $MVDIR/bin/ install -m 0755 mv_supplemental.py $MVDIR/bin/ + install -m 0755 mv_vnc.py $MVDIR/bin/ install -m 0755 systemconfig.py $MVDIR/bin/ install -m 0755 print_xorg_res.py $MVDIR/bin/ install -m 0755 mythvantage.cfg $startdir/pkg/etc/ @@ -122,7 +124,7 @@ build() { } md5sums=('0b29bb0819aad086f612699815132ec5' 'c68322a6f6f86f050035a81907f5c1db' - 'f909edd79b8a222fb42fb3958851b53a' + '9a942c95d2c5a4fb27713d6e2b633e89' '2596460462cf6c889cf8f95485537b20' '985891a43f7c4c983eb2a362162f1a0f' '5c61eec133e270e8b0740194e6ed4769' @@ -142,8 +144,8 @@ md5sums=('0b29bb0819aad086f612699815132ec5' '9151c74fcaf18ec4cf5e757cfdbc7017' '3d1e4a119f38cff0498bf8a67e94e4b3' '71fd2d0d448fc2fcd15415a1beed7109' - '5691d6d3419bca136c69de3ad0245fb3' - 'd66c0e470e54a1551bdf60d8df85108d' + 'e9e70a255b2e25e15f89229551c3fbac' + '65c2dad8748210c3c0098efab377c330' 'b845de3e05c1734cce4b9ac5e8f1baaf' '6801f87992b44118a12b6dfe6ea68127' 'eaf5b9bab2a52beb8ad5ca6f0f56026d' @@ -152,11 +154,12 @@ md5sums=('0b29bb0819aad086f612699815132ec5' 'fe5e31b833cc6707209e9d656b6eb53c' 'ecb52b9b7a9ac0c8988093c1dfdda635' '23d0e12b7ca1cc6ea6b993c1d7ff20b9' - '6924cdcc5e7ed0c073b669362b0366e1' + 'cc5ee06e2182bb825ca3712a1c1afb64' '919909f4d23b9ee3caf71193c042cc40' - '5cdb3ef03d5a2a99889a458a82228ecc' + '0dfd6968213aa045fef5048af687585a' + '0dd5a895022a81aa2f87d761d3f43a87' '2596460462cf6c889cf8f95485537b20' - 'a63ff9ef5250965aeabc74bfa8e43981' + '2bfa69776f57b459e690094dd249e863' '4804aa93aaad3dfcfff08cd9ffd68836' '0fa6fffd87f350380d45f1f8a5b7babe' '6ec39b010c0ed8901ea896c7e153d330' diff --git a/abs/core/LinHES-config/mv_advanced.py b/abs/core/LinHES-config/mv_advanced.py index 98664da..5ca42de 100755 --- a/abs/core/LinHES-config/mv_advanced.py +++ b/abs/core/LinHES-config/mv_advanced.py @@ -234,7 +234,7 @@ def setup_mythweb(UseMythWEB): logging.info(" Removing mythweb") # mv_common.pacremove("lighttpd") mv_common.pacremove("mythweb") - # mv_common.remove_service("lighttpd") +# mv_common.remove_service("lighttpd") return def setup_samba(systemconfig,data_config): @@ -343,10 +343,10 @@ create mask = 0755 ''' %(data_config.MYTHHOME,shreadonly) logging.debug(" %s",homelines) - mv_common.add_service("nmbd") + mv_common.add_service("nmbd") mv_common.add_service("smbd") - mv_common.restart_service("nmbd") - mv_common.restart_service("smbd") + mv_common.restart_service("nmbd") + mv_common.restart_service("smbd") else: logging.info(" Removing windows file sharing") @@ -409,13 +409,13 @@ def setup_advanced(systemconfig,data_config): #setup_rrd(systemconfig.get("UseRRD")) setup_evrouter(systemconfig.get("UseEvrouter"), - systemconfig.get("EvrouterConfig"), - systemconfig.get("TEMPLATES")) + systemconfig.get("EvrouterConfig"), + systemconfig.get("TEMPLATES")) setup_DNSmasq(systemconfig.get("RunDHCP"), - systemconfig.get("mythip"), - systemconfig.get("mythgw"), - systemconfig.get("mythdns")) + systemconfig.get("mythip"), + systemconfig.get("mythgw"), + systemconfig.get("mythdns")) setup_mythweb(systemconfig.get("UseMythWEB")) setup_samba(systemconfig,data_config) diff --git a/abs/core/LinHES-config/mv_common.py b/abs/core/LinHES-config/mv_common.py index fa610b6..a1b3bef 100755 --- a/abs/core/LinHES-config/mv_common.py +++ b/abs/core/LinHES-config/mv_common.py @@ -108,22 +108,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 diff --git a/abs/core/LinHES-config/mv_config.py b/abs/core/LinHES-config/mv_config.py index cc4f2a0..2f17be2 100755 --- a/abs/core/LinHES-config/mv_config.py +++ b/abs/core/LinHES-config/mv_config.py @@ -4,6 +4,7 @@ MVHOSTNAME="apheleia" MOUNTPOINT="/new_boot" DATAMOUNT="/myth" MYTHHOME="/home/mythtv" +VNCHOME="/home/vncsvc" SQUASHFILE="/tmp/.squashlist" SQUASHLIST=("bin","boot","etc","home","lib","opt","root","sbin","usr","var","data","service") NOOPDEBUG="FALSE" diff --git a/abs/core/LinHES-config/mv_hostype.py b/abs/core/LinHES-config/mv_hostype.py index 21a22b4..2cbd97a 100755 --- a/abs/core/LinHES-config/mv_hostype.py +++ b/abs/core/LinHES-config/mv_hostype.py @@ -101,7 +101,7 @@ def setup_mysql_connection(systemconfig): dbhost = systemconfig.get("dbhost") uuid = gen_uuid() config_xml=generate_config_xml(uuid,dbhost) - mv_common.mkdir_mythhome(data_config.MYTHHOME) + mv_common.mkdir_mythhome(data_config.MYTHHOME,"mythtv","mythtv") if systemtype == "Master_backend": diff --git a/abs/core/LinHES-config/mv_supplemental.py b/abs/core/LinHES-config/mv_supplemental.py old mode 100644 new mode 100755 diff --git a/abs/core/LinHES-config/mv_vnc.py b/abs/core/LinHES-config/mv_vnc.py new file mode 100755 index 0000000..63d155f --- /dev/null +++ b/abs/core/LinHES-config/mv_vnc.py @@ -0,0 +1,87 @@ +# -*- coding: utf-8 -*- +import logging, mv_common +import os, re + +config_file = "mv_config" + +def setupvnc_system(systemconfig,data_config): + logging.info("____Start of vnc setup____") + mv_common.pacinstall("tigervnc") + vncdir=data_config.VNCHOME+"/.vnc" + try: + os.makedirs(vncdir) + os.chown(vncdir,78,78) + except: + logging.info(" couldn't create vnc dir:%s" %vncdir) + + vncfile="%s/xstartup" %vncdir + file_contents=''' +#!/bin/bash +vncconfig -iconic & +if [ ! -e ~GNUstep ] +then + wmaker.inst + cp -f /data/GNUstep/Defaults/WindowMaker ~/GNUstep/Defaults/ + cp -f /data/GNUstep/Defaults/WMState.vnc ~/GNUstep/Defaults/WMState + cp -f /data/GNUstep/Defaults/WMWindowAttributes ~/GNUstep/Defaults/ +fi +exec wmaker +''' + try: + logging.debug(" Writing %s",vncfile) + f= open(vncfile,'w') + f.write(file_contents) + f.close() + os.chmod(vncfile,0755) + + except: + logging.debug(" Couldn't open %s",vncfile) + logging.debug(" Aborting vnc...") + + try: + vncuid = pwd.getpwnam('vncsvc')[2] + vncgid = pwd.getpwnam('vncsvc')[3] + except: + logging.critical("* vncsvc not found") + vncuid = '78' + vncgid = '78' + mv_common.mkdir_mythhome(data_config.VNCHOME,vncuid,vncgid) + + + home_xml_file=data_config.VNCHOME + "/.mythtv/config.xml" + configxml_file="/usr/share/mythtv/config.xml" + mv_common.link_file(configxml_file,home_xml_file) + + logging.info(" Writing out password") + vncpassfile="%s/passwd" %vncdir + cmd="echo %s|vncpasswd -f > %s" %(systemconfig.get("vncpassword"),vncpassfile) + mv_common.runcmd(cmd) + cmd="chmod 700 %s" %vncpassfile + mv_common.runcmd(cmd) + cmd="chown vncsvc %s" %vncpassfile + mv_common.runcmd(cmd) + + + + logging.info("__End of vnc \n") + + +def setupvnc(systemconfig,data_config): + logging.info("____Start of vnc config ____") + if mv_common.read_config(mv_common.module_config,"vnc") == False : + logging.info("____Skipping of vnc, config disabled____") + return + + try: + vnc=systemconfig.get("vncenable") + except: + vnc = "0" + + if vnc == "1": + logging.info(" Installing vnc system\n") + setupvnc_system(systemconfig,data_config) + mv_common.add_service("vnc") + else: + mv_common.remove_service("vnc") + + logging.info("__End of vnc\n") \ No newline at end of file diff --git a/abs/core/LinHES-config/mythvantage.cfg b/abs/core/LinHES-config/mythvantage.cfg index eaa4865..dda5ed5 100644 --- a/abs/core/LinHES-config/mythvantage.cfg +++ b/abs/core/LinHES-config/mythvantage.cfg @@ -18,4 +18,5 @@ ir = True user = True software = True smolt = True +vnc = True diff --git a/abs/core/LinHES-config/print_xorg_res.py b/abs/core/LinHES-config/print_xorg_res.py old mode 100644 new mode 100755 diff --git a/abs/core/LinHES-config/systemconfig.py b/abs/core/LinHES-config/systemconfig.py index baa7142..8686841 100755 --- a/abs/core/LinHES-config/systemconfig.py +++ b/abs/core/LinHES-config/systemconfig.py @@ -62,7 +62,19 @@ def main(argv): global systemconfig systemconfig["MVROOT"]=MVROOT restartlcd = False - 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, "plugins":False, "smolt":False, "all":False, "dhcp_request":False , "func":False, "supplemental":False} + 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, + "plugins":False, "smolt":False, + "all":False, "dhcp_request":False , + "func":False, "supplemental":False, + "vnc":False } try: opts, args = getopt.getopt(argv, 'c:hm:d:', ["help","modules" ] ) except getopt.GetoptError, why: @@ -105,8 +117,9 @@ def main(argv): cmdmodule["advanced"] = True cmdmodule["software"] = True cmdmodule["advancedX"] = True - cmdmodule["smolt"] = True + #cmdmodule["smolt"] = True cmdmodule["user"] = True + cmdmodule["vnc"] = True if cmdmodule["network"]: restartfe = mv_network.setup_network(systemconfig, cmdmodule["this_is_install"]) @@ -133,7 +146,7 @@ def main(argv): setup_x(systemconfig) cmdmodule["ir"] = True mv_hostype.hostypeprint(systemconfig) - cmdmodule["smolt"] = True + #cmdmodule["smolt"] = True #if cmdmodule["network"]: #restartfe = mv_network.setup_network(systemconfig, cmdmodule["this_is_install"]) @@ -224,13 +237,13 @@ def main(argv): if cmdmodule["reloadfe"]: mv_common.reloadfe(systemconfig.get("dbhost"),restartlcd) - if cmdmodule["smolt"]: - import mv_smolt - mv_smolt.setup_smolt_type(systemconfig.get("SystemType"), - systemconfig.get("Remotetype"), - systemconfig.get("RunFrontend"), - data_config.MYTHHOME, - data_config.SYSTEMTYPE) + #if cmdmodule["smolt"]: + #import mv_smolt + #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____") @@ -253,6 +266,10 @@ def main(argv): mv_supplemental.windowmanager(systemconfig) mv_supplemental.supplemental(systemconfig) + if cmdmodule["vnc"]: + import mv_vnc + mv_vnc.setupvnc(systemconfig,data_config) + if __name__ == "__main__": -- cgit v0.12