From d0f8e88086dcbe2c05331f36cff037b0c675c7c4 Mon Sep 17 00:00:00 2001
From: Michael Hanson <hansonorders@verizon.net>
Date: Tue, 9 Aug 2011 19:39:56 +0000
Subject: x11vnc: add install file that adds/removes line in .fluxbox/apps Ref
 #780

---
 abs/extra/x11vnc/PKGBUILD       |  3 ++-
 abs/extra/x11vnc/x11vnc.install | 26 ++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 abs/extra/x11vnc/x11vnc.install

diff --git a/abs/extra/x11vnc/PKGBUILD b/abs/extra/x11vnc/PKGBUILD
index 8e6835f..5672669 100644
--- a/abs/extra/x11vnc/PKGBUILD
+++ b/abs/extra/x11vnc/PKGBUILD
@@ -3,7 +3,7 @@
 
 pkgname=x11vnc
 pkgver=0.9.12
-pkgrel=1
+pkgrel=2
 pkgdesc="a VNC server for real X displays"
 arch=("i686" "x86_64")
 license=("GPL2")
@@ -11,6 +11,7 @@ url="http://www.karlrunge.com/x11vnc/"
 source=("http://downloads.sourceforge.net/libvncserver/${pkgname}-${pkgver}.tar.gz")
 depends=('openssl' 'libjpeg' 'zlib' 'libx11' 'libxtst' 'libxinerama'
          'libxdamage' 'libxrandr' 'avahi' 'recordproto')
+install=x11vnc.install
 
 build() {
 
diff --git a/abs/extra/x11vnc/x11vnc.install b/abs/extra/x11vnc/x11vnc.install
new file mode 100644
index 0000000..63af505
--- /dev/null
+++ b/abs/extra/x11vnc/x11vnc.install
@@ -0,0 +1,26 @@
+post_install() {
+  if [ -f /home/mythtv/.fluxbox/apps ] ; then
+    if [ -n `/bin/grep x11vnc /home/mythtv/.fluxbox/apps` ] ; then
+      echo ""
+      echo "==> Adding x11vnc to user mythtv's ~/.fluxbox/apps"
+      echo ""
+      # Add x11vnc to ~/mythtv/.fluxbox/apps before LinHES-run
+      sed -i '/LinHES-run/ i [startup] {x11vnc -nap -wait 50 -passwd mythtv -display :0 -forever -o ~/.vnc/x11vnc.log -bg}' /home/mythtv/.fluxbox/apps
+    else
+      echo ""
+      echo "==> x11vnc startup line already present in user"
+      echo "==> mythtv's ~/.fluxbox/apps"
+      echo ""
+    fi
+  fi
+}
+
+pre_remove() {
+  # kill x11vnc
+  PID=`pidof -o %PPID /usr/bin/x11vnc`
+  [ -n "$PID" ] && kill $PID
+  # Remove line in .fluxbox/apps
+  if [ -f /home/mythtv/.fluxbox/apps ] ; then
+    sed -i '/x11vnc/d' /home/mythtv/.fluxbox/apps
+  fi
+}
-- 
cgit v0.12

