]> git.pld-linux.org Git - packages/tigervnc.git/commitdiff
- vncserver.{init,sysconfig) from vnc package
authorMarcin Krol <hawk@tld-linux.org>
Thu, 18 Jul 2013 17:13:13 +0000 (17:13 +0000)
committerMarcin Krol <hawk@tld-linux.org>
Thu, 18 Jul 2013 17:13:13 +0000 (17:13 +0000)
- removed non-existent url in sysconfig, added descritpion in init

tigervnc.spec
vncserver.init [new file with mode: 0644]
vncserver.sysconfig [new file with mode: 0644]

index 7a54a3df1f977a3fe79b344192dc9c6475c6fbe7..a39669630f0077d68d1b87a939bc21614a31a9a7 100644 (file)
@@ -13,6 +13,8 @@ Group:                X11/Applications/Networking
 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
@@ -260,6 +262,10 @@ install media/icons/tigervnc_32.png $RPM_BUILD_ROOT%{_iconsdir}/hicolor/32x32/ap
 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
@@ -286,6 +292,8 @@ rm -rf $RPM_BUILD_ROOT
 %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*
diff --git a/vncserver.init b/vncserver.init
new file mode 100644 (file)
index 0000000..88c85fa
--- /dev/null
@@ -0,0 +1,126 @@
+#!/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
diff --git a/vncserver.sysconfig b/vncserver.sysconfig
new file mode 100644 (file)
index 0000000..5901eb6
--- /dev/null
@@ -0,0 +1,19 @@
+# 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"
This page took 0.125852 seconds and 4 git commands to generate.