Source0: http://download.sourceforge.net/tigervnc/%{name}-%{version}.tar.bz2
# Source0-md5: a5158228e64d14496821a39bf3851f1b
Source1: %{name}.desktop
+Source2: vncserver.init
+Source3: vncserver.sysconfig
Patch0: %{name}-cookie.patch
Patch1: %{name}-ldnow.patch
Patch2: %{name}-rh102434.patch
install media/icons/tigervnc_48.png $RPM_BUILD_ROOT%{_iconsdir}/hicolor/48x48/apps/tigervnc.png
install media/icons/tigervnc.svg $RPM_BUILD_ROOT%{_iconsdir}/hicolor/scalable/apps/tigervnc.svg
+install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig}
+install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/vncserver
+install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/vncserver
+
%find_lang %{name}
%clean
%attr(755,root,root) %{_bindir}/Xvnc
%attr(755,root,root) %{_bindir}/vncserver
%attr(755,root,root) %{_bindir}/x0vncserver
+%attr(754,root,root) /etc/rc.d/init.d/vncserver
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/vncserver
%{_mandir}/man1/Xvnc.1*
%{_mandir}/man1/vncserver.1*
%{_mandir}/man1/x0vncserver.1*
--- /dev/null
+#!/bin/sh
+#
+# vncserver Starts/stop VNC server
+#
+# chkconfig: 345 91 35
+#
+# description: Starts and stops vncserver.
+# Used to provide remote X administration services.
+#
+# $Id$
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+VNCSERVERS=""
+[ -f /etc/sysconfig/vncserver ] && . /etc/sysconfig/vncserver
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+ if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+ msg_network_down vncserver
+ exit 1
+ fi
+else
+ exit 0
+fi
+
+start() {
+ # Check if the service is already running?
+ if [ ! -f /var/lock/subsys/vncserver ]; then
+ ulimit -S -c 0 >/dev/null 2>&1
+ RETVAL=0
+
+ if [ ! -d /tmp/.X11-unix ]
+ then
+ mkdir -m 1777 /tmp/.X11-unix || :
+ restorecon /tmp/.X11-unix 2>/dev/null || :
+ fi
+
+ NOSERV=1
+ for display in $VNCSERVERS
+ do
+ msg_starting "vncserver ($display)"
+ NOSERV=0
+ DISP="${display%%:*}"
+ USER="${display##*:}"
+ if [ "x$USER" == "xroot" ]; then
+ fail
+ echo "-- Do not run vncserver as root!"
+ continue
+ fi
+ VNCUSERARGS="${VNCSERVERARGS[${DISP}]}"
+ USEREXISTS=`cat /etc/passwd | awk -F: "{ if (\"$USER\"==\\\$1) print \"yes\" }"`
+ if [ "x$USEREXISTS" != "xyes" ]; then
+ fail
+ echo "-- User $USER does not exists!"
+ continue
+ fi
+ USERHOME=`runuser $USER -c 'echo $HOME'`
+ if [ ! -f "$USERHOME/.vnc/passwd" ]; then
+ fail
+ echo "-- No password file found for user $USER!"
+ continue
+ fi
+ export USER VNCUSERARGS
+ daemon --user ${USER} "vncserver :${DISP} ${VNCUSERARGS}"
+ RETVAL=$?
+ [ "$RETVAL" -eq 0 ] && echo $display >> /var/lock/subsys/vncserver && continue
+ done
+ else
+ msg_already_running vncserver
+ fi
+}
+
+stop() {
+ if [ -f /var/lock/subsys/vncserver ]; then
+ # Stop daemons.
+ ERRDISP=""
+ for display in `cat /var/lock/subsys/vncserver`
+ do
+ msg_stopping "vncserver ($display)"
+ export USER="${display##*:}"
+ runuser ${USER} -c "vncserver -kill :${display%%:*}" >/dev/null 2>&1
+ RETVAL=$?
+ [ "$RETVAL" -eq 0 ] && ok && continue
+ fail
+ ERRDISP="$ERRDISP $display"
+ done
+ rm -f /var/lock/subsys/vncserver
+ [ "x$ERRDISP" != "x" ] && echo "$ERRDISP" > /var/lock/subsys/vncserver
+ else
+ msg_not_running vncserver
+ fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ stop
+ sleep 3s
+ start
+ exit $?
+ ;;
+ status)
+ status Xvnc
+ RETVAL=$?
+ ;;
+ *)
+ msg_usage "$0 {start|stop|restart|status}"
+ exit 3
+esac
+
+exit $RETVAL
+
+# This must be last line !
+# vi:syntax=sh
--- /dev/null
+# The VNCSERVERS variable is a list of display:user pairs.
+#
+# Uncomment the lines below to start a VNC server on display :2
+# as my 'myusername' (adjust this to your own). You will also
+# need to set a VNC password; run 'man vncpasswd' to see how
+# to do that.
+#
+# DO NOT RUN THIS SERVICE if your local area network is untrusted!
+
+# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
+
+# Use "-nohttpd" to prevent web-based VNC clients connecting.
+
+# Use "-localhost" to prevent remote VNC clients connecting except when
+# doing so through a secure tunnel. See the "-via" option in the
+# `man vncviewer' manual page.
+
+# VNCSERVERS="2:myusername"
+# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"