summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-config/mv_vnc.py
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2012-08-25 04:14:20 (GMT)
committerJames Meyer <james.meyer@operamail.com>2012-08-25 04:14:20 (GMT)
commita2b8003706543f561ea00236ef1efd008372b87e (patch)
tree602ad9c9fc03a295c7caf46d96e704dfc23d058a /abs/core/LinHES-config/mv_vnc.py
parent153da1b95eae42d4af8596ddf614041700ecdafa (diff)
downloadlinhes_pkgbuild-a2b8003706543f561ea00236ef1efd008372b87e.zip
linhes_pkgbuild-a2b8003706543f561ea00236ef1efd008372b87e.tar.gz
linhes_pkgbuild-a2b8003706543f561ea00236ef1efd008372b87e.tar.bz2
LinHES-config: added mv_vnc.py
Diffstat (limited to 'abs/core/LinHES-config/mv_vnc.py')
-rwxr-xr-xabs/core/LinHES-config/mv_vnc.py87
1 files changed, 87 insertions, 0 deletions
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