From 531232997ba0f4e875af255b37e4149e37089805 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Thu, 29 Jan 2015 21:27:50 +0000
Subject: LinHES-config: mv_vnc.py: start xvnc runit service as needed

---
 abs/core/LinHES-config/PKGBUILD       |  6 +++---
 abs/core/LinHES-config/config.install |  3 ++-
 abs/core/LinHES-config/mv_vnc.py      | 25 +++++--------------------
 3 files changed, 10 insertions(+), 24 deletions(-)

diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index a397170..0350c0c 100755
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,12 +1,12 @@
 pkgname=LinHES-config
 pkgver=8.3
-pkgrel=6
+pkgrel=7
 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'
 	 'python2-pexpect' 'python-netifaces' 'xcursor-vanilla-dmz-aa'
-	 'python-iplib' 'sudo' 'setserial' 'udevil' 'balance' )
+	 'python-iplib' 'sudo' 'setserial' 'udevil' 'balance' 'runit-scripts>=8.3-4' )
 arch=('i686' 'x86_64')
 
 source=(mv_install.py 09_mythvantge_runit_grub
@@ -171,7 +171,7 @@ md5sums=('17d9dd5a097fbbd4dae75dff8e2677ff'
          '087a0ef743bc8af915503f8773536ce4'
          '38665330aeb3a8bdf7be24857fe035bb'
          '80685e047993b00161be29e3580f3a40'
-         '299c24c0820fc9c483c820db2595e3cb'
+         'b79fe6ef82b0b5e71d62806e773ed556'
          '595663a2cb0b43c4ea3fb3dac915a3c8'
          '781f161a79c3188a31c8615b8258b241'
          '888a6c57f272d9fa3e77e216a421562b'
diff --git a/abs/core/LinHES-config/config.install b/abs/core/LinHES-config/config.install
index 0b7060e..9eda0db 100644
--- a/abs/core/LinHES-config/config.install
+++ b/abs/core/LinHES-config/config.install
@@ -40,7 +40,8 @@ post_upgrade() {
        /usr/MythVantage/bin/systemconfig.py -m hostype
     fi
 
-    /usr/MythVantage/bin/systemconfig.py -m locale    
+    /usr/MythVantage/bin/systemconfig.py -m locale,vnc
+
     echo "   Removing pts and shm from fstab..."
     cp -a /etc/fstab /etc/fstab.backup.pre_pts_shm
     sed -i '/\/dev\/pts/d' /etc/fstab
diff --git a/abs/core/LinHES-config/mv_vnc.py b/abs/core/LinHES-config/mv_vnc.py
index 0260494..1a028d2 100755
--- a/abs/core/LinHES-config/mv_vnc.py
+++ b/abs/core/LinHES-config/mv_vnc.py
@@ -79,23 +79,6 @@ exec wmaker
     logging.info("__End of vnc \n")
 
 
-def start_xvnc(xvncpasswd):
-    logging.info("    Checking if x11vnc needs to be started")
-    if mv_common.check_service("frontend"):
-        logging.info("    Frontend is running, starting x11vnc")
-        line='''su mythtv -c "DISPLAY=localhost:0  x11vnc -rfbport 5902 --passwd %s 2>&1 > /dev/null &" \n''' %xvncpasswd
-        #line='''su mythtv -c "DISPLAY=localhost:0 xscreensaver  -no-splash \&" '''
-        try:
-            fout = open("/tmp/cmd.sh", "w")
-            fout.write(line)
-            fout.close()
-            os.chmod("/tmp/cmd.sh",0755)
-            cmd="/tmp/cmd.sh"
-            os.system(cmd)
-            os.remove("/tmp/cmd.sh")
-        except:
-            logging.info("    Couldn't start x11vnc")
-
 
 def setupvnc(systemconfig,data_config):
     logging.info("____Start of vnc config ____")
@@ -114,6 +97,7 @@ def setupvnc(systemconfig,data_config):
         mv_common.add_service("vnc")
     else:
         mv_common.remove_service("vnc")
+        mv_common.pacremove("tigervnc")
     #x11vnc
     try:
         xvnc=systemconfig.get("xvncenable")
@@ -125,9 +109,10 @@ def setupvnc(systemconfig,data_config):
     if xvnc == "1":
         logging.info("     Installing x11vnc system\n")
         mv_common.pacinstall("x11vnc")
-        start_xvnc(xvncpasswd)
+        mv_common.add_service("xvnc")
     else:
-        mv_common.pacinstall("x11vnc")
+        mv_common.remove_service("xvnc")
+        mv_common.pacremove("x11vnc")
 
 
-    logging.info("__End of vnc\n")
\ No newline at end of file
+    logging.info("__End of vnc\n")
-- 
cgit v0.12

