From bce9a0bdcd1d4cbd464b7f4ec2c3b19bff86d48f Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Mon, 7 Jan 2013 14:16:52 -0600
Subject: =?UTF-8?q?LinHES-system|config:=20=20add=20support=20for=20x11vnc?=
 =?UTF-8?q?=20x11vnc=20support=20added=20to=20service=20menu.=20=20By=20de?=
 =?UTF-8?q?fault=20it=20will=20run=20on=20:2.=20The=20startup=20script=20w?=
 =?UTF-8?q?ill=20reference=20/etc/x11vnc.cfg=20if=20a=20user=20wishes=20to?=
 =?UTF-8?q?=20override=20the=20default=20flags.=20Ex:=20x11=5Fvnc=5Foption?=
 =?UTF-8?q?s=3D=E2=80=9D=20-rfbport=206000=E2=80=9D=20=20=20=20will=20resu?=
 =?UTF-8?q?lt=20in=20a=20startup=20cmd=20of=20=E2=80=9Cx11vnc=20-rfbport?=
 =?UTF-8?q?=206000=E2=80=9D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

refs # 894
---
 abs/core/LinHES-config/PKGBUILD       |  4 ++--
 abs/core/LinHES-config/mv_vnc.py      | 35 ++++++++++++++++++++++++++++++++++-
 abs/core/LinHES-system/LinHES-session | 15 +++++++++++++++
 abs/core/LinHES-system/PKGBUILD       |  8 ++++----
 abs/core/mythinstall/PKGBUILD         |  2 +-
 5 files changed, 56 insertions(+), 8 deletions(-)

diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index 7c64fe2..2ebafe8 100755
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=2.3
-pkgrel=204
+pkgrel=205
 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'
@@ -166,7 +166,7 @@ md5sums=('26e20dba8d1bea96a07131ef945fd2f7'
          '087a0ef743bc8af915503f8773536ce4'
          '183a11aa06d60065106472ed9f72cc4a'
          'b4900090d841d3e390cb840cf16afd85'
-         'f2a19e3e864984ec95ac5ea090cbfa69'
+         '299c24c0820fc9c483c820db2595e3cb'
          'cf51cb22e23218ae7e9b55cac1ba3a7f'
          'e4b61402858058f7575b776d62d5ee89'
          'c2ef0f1140bd3fbeb44294fdf5415a32'
diff --git a/abs/core/LinHES-config/mv_vnc.py b/abs/core/LinHES-config/mv_vnc.py
index bc7a201..0260494 100755
--- a/abs/core/LinHES-config/mv_vnc.py
+++ b/abs/core/LinHES-config/mv_vnc.py
@@ -79,12 +79,30 @@ 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 ____")
     if  mv_common.read_config(mv_common.module_config,"vnc")  == False  :
         logging.info("____Skipping of vnc, config disabled____")
         return
-
+    #vncservice
     try:
         vnc=systemconfig.get("vncenable")
     except:
@@ -96,5 +114,20 @@ def setupvnc(systemconfig,data_config):
         mv_common.add_service("vnc")
     else:
         mv_common.remove_service("vnc")
+    #x11vnc
+    try:
+        xvnc=systemconfig.get("xvncenable")
+        xvncpasswd=systemconfig.get("xvncpassword")
+    except:
+        xvnc = "0"
+        xvncpassword="LinHES"
+
+    if xvnc == "1":
+        logging.info("     Installing x11vnc system\n")
+        mv_common.pacinstall("x11vnc")
+        start_xvnc(xvncpasswd)
+    else:
+        mv_common.pacinstall("x11vnc")
+
 
     logging.info("__End of vnc\n")
\ No newline at end of file
diff --git a/abs/core/LinHES-system/LinHES-session b/abs/core/LinHES-system/LinHES-session
index d55b900..1eb991e 100755
--- a/abs/core/LinHES-system/LinHES-session
+++ b/abs/core/LinHES-system/LinHES-session
@@ -110,6 +110,20 @@ function keylaunch(){
 
 }
 
+function start_x11vnc(){
+    if [ x$xvncenable = "x1" ]
+    then
+        if [ -e /etc/x11vnc.cfg ]
+        then
+            . /etc/x11vnc.cfg
+            x11vnc $x11vnc_options
+        else
+            x11vnc -rfbport 5902 --passwd $xvncpassword
+        fi
+    fi
+}
+
+
 function fluxbox_settings(){
     if [ ! -e $HOME/.fluxbox ]
     then
@@ -433,6 +447,7 @@ $WM &
 pid=$!
 mouse_move
 keylaunch
+start_x11vnc &
 #set_background
 unclutter
 load_nvidia_settings
diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index 2cb8997..6731cf0 100755
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-system
 pkgver=2
-pkgrel=134
+pkgrel=135
 arch=('i686' 'x86_64')
 MVDIR=$startdir/pkg/usr/LH
 BINDIR=$startdir/pkg/usr/bin
@@ -80,7 +80,7 @@ build() {
 
 
 }
-md5sums=('d275db0a946087671e0c2014dac9ed22'
+md5sums=('53bc3d73641c7227fe1da4084f69a7a1'
          '5881bdb43d578ec3a79d1f77ea58a3db'
          'a875ee97f86e46f34a741c2bc455f894'
          '76b2637cac0452b3acdbeeb4e8a5474b'
@@ -95,8 +95,8 @@ md5sums=('d275db0a946087671e0c2014dac9ed22'
          '692563448cca1d49f45e7d1c8abcaa0c'
          '962a3e9eaba2d1466251b7ab0956705d'
          '1758aed160de64abfafb28a3a8f3390e'
-         '1da34ffbe6dccfdf202bdd03edd6bb28'
-         '079085b1ad92e23a1c3399ad1dcf7486'
+         '323048b6c1e17106830e66e7f935e747'
+         '6b2640772d89195cd6fa3db134142951'
          '1be1d3dfc83f828eede93055713882ae'
          '47e093e8cfe4b5b96602358e1f540832'
          'a85c19902f2af90931e05c839c63b62d'
diff --git a/abs/core/mythinstall/PKGBUILD b/abs/core/mythinstall/PKGBUILD
index 9aa5d83..856d070 100644
--- a/abs/core/mythinstall/PKGBUILD
+++ b/abs/core/mythinstall/PKGBUILD
@@ -1,7 +1,7 @@
 # Maintainer: Jams
 pkgname=mythinstall
 pkgver=3
-pkgrel=66
+pkgrel=67
 pkgdesc="LinHES installer/systemconfig GUI."
 arch=('i686'  'x86_64')
 depends=('mythtv>=0.25')
-- 
cgit v0.12

