From 78e0cd83a2837a4f4847d41a1c2e7cbeb3a9ff09 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Thu, 10 Jan 2013 20:09:09 -0600
Subject: x11vnc: .9.13

---
 abs/extra/x11vnc/PKGBUILD       | 49 +++++++++++++++++++++++------------------
 abs/extra/x11vnc/conf.d         |  5 +++++
 abs/extra/x11vnc/rc.d           | 37 +++++++++++++++++++++++++++++++
 abs/extra/x11vnc/service        |  7 ++++++
 abs/extra/x11vnc/x11vnc.install | 26 ----------------------
 5 files changed, 77 insertions(+), 47 deletions(-)
 create mode 100644 abs/extra/x11vnc/conf.d
 create mode 100644 abs/extra/x11vnc/rc.d
 create mode 100644 abs/extra/x11vnc/service
 delete mode 100644 abs/extra/x11vnc/x11vnc.install

diff --git a/abs/extra/x11vnc/PKGBUILD b/abs/extra/x11vnc/PKGBUILD
index 2ee8284..323462d 100644
--- a/abs/extra/x11vnc/PKGBUILD
+++ b/abs/extra/x11vnc/PKGBUILD
@@ -1,30 +1,37 @@
-# $Id: PKGBUILD 356 2008-04-18 22:56:27Z aaron $
-# Maintainer: damir <damir@archlinux.org>
+# $Id: PKGBUILD 168731 2012-10-15 02:00:18Z bisson $
+# Maintainer: Gaetan Bisson <bisson@archlinux.org>
+# Contributor: damir <damir@archlinux.org>
 
 pkgname=x11vnc
-pkgver=0.9.12
+pkgver=0.9.13
 pkgrel=3
-pkgdesc="a VNC server for real X displays"
-arch=("i686" "x86_64")
-license=("GPL2")
-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
+pkgdesc='VNC server for real X displays'
+url='http://www.karlrunge.com/x11vnc/'
+arch=('i686' 'x86_64')
+license=('GPL2')
+depends=('openssl' 'libjpeg' 'libxtst' 'libxinerama' 'libxdamage' 'libxrandr' 'avahi')
+optdepends=('tk: for GUI support')
+backup=('etc/conf.d/x11vnc')
+source=("http://downloads.sourceforge.net/project/libvncserver/${pkgname}/${pkgver}/${pkgname}-${pkgver}.tar.gz"
+        'service'
+        'conf.d'
+        'rc.d')
+sha1sums=('f011d81488ac94dc8dce2d88739c23bd85a976fa'
+          '53e1ed7f84518a699a29607a03bee2321f9f9624'
+          '11011cce06511e9ba61672a1c80bb63a3a187539'
+          '477892cf0f0020043444b7493c80684762ded506')
 
 build() {
-
-  cd ${srcdir}/${pkgname}-${pkgver}
-  ./configure --prefix=/usr --mandir=/usr/share/man
-  make || return 1
-
+	cd "${srcdir}/${pkgname}-${pkgver}"
+	./configure --prefix=/usr --mandir=/usr/share/man
+	make
 }
 
 package() {
-
-  cd ${srcdir}/${pkgname}-${pkgver}
-  make prefix=${pkgdir}/usr install || return 1
-
+	cd "${srcdir}/${pkgname}-${pkgver}"
+	make DESTDIR="${pkgdir}" install
+	install -Dm755 ../rc.d "${pkgdir}/etc/rc.d/x11vnc"
+	install -Dm644 ../conf.d "${pkgdir}/etc/conf.d/x11vnc"
+	install -Dm644 ../service "${pkgdir}/usr/lib/systemd/system/x11vnc.service"
+	rm -fr "${pkgdir}"/usr/include/rfb # provided by libvncserver
 }
-md5sums=('1498a68d02aa7b6c97bf746c073c8d00')
diff --git a/abs/extra/x11vnc/conf.d b/abs/extra/x11vnc/conf.d
new file mode 100644
index 0000000..8a81e32
--- /dev/null
+++ b/abs/extra/x11vnc/conf.d
@@ -0,0 +1,5 @@
+#
+# Parameters to be passed to x11vnc
+#
+
+X11VNC_ARGS=""
diff --git a/abs/extra/x11vnc/rc.d b/abs/extra/x11vnc/rc.d
new file mode 100644
index 0000000..b5f2a64
--- /dev/null
+++ b/abs/extra/x11vnc/rc.d
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/x11vnc
+
+PID=$(pidof -o %PPID /usr/bin/x11vnc)
+case "$1" in
+  start)
+    stat_busy "Starting x11vnc"
+    [[ -z "$PID" ]] && /usr/bin/x11vnc $X11VNC_ARGS &> /dev/null &
+    if [[ $? -gt 0 ]]; then
+      stat_fail
+    else
+      add_daemon x11vnc
+      stat_done
+    fi
+    ;;
+  stop)
+    stat_busy "Stopping x11vnc"
+    [[ ! -z "$PID" ]]  && kill $PID &> /dev/null
+    if [[ $? -gt 0 ]]; then
+      stat_fail
+    else
+      rm_daemon x11vnc
+      stat_done
+    fi
+    ;;
+  restart)
+    $0 stop
+    sleep 1
+    $0 start
+    ;;
+  *)
+    echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/abs/extra/x11vnc/service b/abs/extra/x11vnc/service
new file mode 100644
index 0000000..0ccc2fe
--- /dev/null
+++ b/abs/extra/x11vnc/service
@@ -0,0 +1,7 @@
+[Unit]
+Description=VNC Server for X11
+Requires=graphical.target
+After=graphical.target
+
+[Service]
+ExecStart=/usr/bin/x11vnc
diff --git a/abs/extra/x11vnc/x11vnc.install b/abs/extra/x11vnc/x11vnc.install
deleted file mode 100644
index 97b6048..0000000
--- a/abs/extra/x11vnc/x11vnc.install
+++ /dev/null
@@ -1,26 +0,0 @@
-post_install() {
-  if [ -f $MYTHHOME/.fluxbox/apps ] ; then
-    if [ -n `/bin/grep x11vnc $MYTHHOME/.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}' $MYTHHOME/.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 $MYTHHOME/.fluxbox/apps ] ; then
-    sed -i '/x11vnc/d' $MYTHHOME/.fluxbox/apps
-  fi
-}
-- 
cgit v0.12

