[packages/tigervnc] Revert "- killed systemd"

baggins baggins at pld-linux.org
Mon May 11 19:54:24 CEST 2015


commit 245ad2d353e80e8c6571c651fa3f9b52af10e026
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Mon May 11 19:53:49 2015 +0200

    Revert "- killed systemd"
    
    This reverts commit 990569df4bd311a1ac68eeeb95eef784b2ba173a.
    
    I guess you commited this to wrong repo.

 tigervnc.spec               | 25 +++++++++++++++++++++++
 vncserver-service-generator | 49 +++++++++++++++++++++++++++++++++++++++++++++
 vncserver.target            |  7 +++++++
 3 files changed, 81 insertions(+)
---
diff --git a/tigervnc.spec b/tigervnc.spec
index f7e6765..f3a0380 100644
--- a/tigervnc.spec
+++ b/tigervnc.spec
@@ -12,6 +12,8 @@ Source0:	https://github.com/TigerVNC/tigervnc/archive/v%{version}.tar.gz?/%{name
 Source1:	%{name}.desktop
 Source2:	vncserver.init
 Source3:	vncserver.sysconfig
+Source4:	vncserver.target
+Source5:	vncserver-service-generator
 Patch0:		%{name}-cookie.patch
 Patch1:		%{name}-ldnow.patch
 Patch3:		%{name}-as-needed.patch
@@ -125,12 +127,14 @@ Summary:	VNC X server - TigerVNC version
 Summary(pl.UTF-8):	X serwer VNC - wersja TigerVNC
 Group:		X11/Applications/Networking
 Requires(post,preun):	/sbin/chkconfig
+Requires(post,preun,postun):	systemd-units >= 38
 Requires:	xorg-app-rgb
 # for vncpasswd tool
 Requires:	%{name}-utils = %{version}-%{release}
 # for mcookie
 Requires:	util-linux
 Requires:	libjpeg-turbo
+Requires:	systemd-units >= 38
 Requires:	xkeyboard-config
 Requires:	xorg-app-xauth
 Requires:	xorg-app-xkbcomp
@@ -274,6 +278,11 @@ 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
 
+install -d $RPM_BUILD_ROOT{%{systemdunitdir},/lib/systemd/system-generators}
+install -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/vncserver.target
+install -p %{SOURCE5} $RPM_BUILD_ROOT/lib/systemd/system-generators/vncserver-service-generator
+ln -s /dev/null $RPM_BUILD_ROOT%{systemdunitdir}/vncserver.service
+
 %{__rm} -r $RPM_BUILD_ROOT%{_docdir}
 
 %find_lang %{name}
@@ -293,12 +302,25 @@ rm -rf $RPM_BUILD_ROOT
 /sbin/chkconfig --add vncserver
 %service vncserver restart "VNC server"
 NORESTART=1
+%systemd_post vncserver.target
 
 %preun server
 if [ "$1" = "0" ]; then
 	%service vncserver stop
 	/sbin/chkconfig --del vncserver
 fi
+%systemd_preun vncserver.target
+
+%postun server
+%systemd_reload
+
+%triggerpostun server -- tigervnc-server < 1.3.0-5
+[ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
+[ ${RPM_ENABLE_SYSTEMD_SERVICE:-yes} = no ] && return 1
+export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog
+if [ "$(echo /etc/rc.d/rc[0-6].d/S[0-9][0-9]vncserver)" != "/etc/rc.d/rc[0-6].d/S[0-9][0-9]vncserver" ]; then
+	/bin/systemctl --quiet enable vncserver.target || :
+fi
 
 %files -f %{name}.lang
 %defattr(644,root,root,755)
@@ -315,6 +337,9 @@ fi
 %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
+%attr(755,root,root) /lib/systemd/system-generators/vncserver-service-generator
+%{systemdunitdir}/vncserver.target
+%{systemdunitdir}/vncserver.service
 %{_mandir}/man1/Xvnc.1*
 %{_mandir}/man1/vncserver.1*
 %{_mandir}/man1/x0vncserver.1*
diff --git a/vncserver-service-generator b/vncserver-service-generator
new file mode 100755
index 0000000..cdb5b42
--- /dev/null
+++ b/vncserver-service-generator
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+destunitdir=${1:-/tmp}
+
+# Do nothing if vncserver target is disabled
+[ -e /etc/systemd/system/multi-user.target.wants/vncserver.target ] || exit 0
+
+VNCSERVERS=""
+[ -f /etc/sysconfig/vncserver ] && . /etc/sysconfig/vncserver
+
+if [ -d $destunitdir/vncserver.target.wants ]; then
+	rm -f $destunitdir/vncserver.target.wants/vncserver@*.service
+else
+	mkdir -p $destunitdir/vncserver.target.wants
+fi
+
+for display in $VNCSERVERS; do
+	DISP="${display%%:*}"
+	USER="${display##*:}"
+	if [ "x$USER" == "xroot" ]; then
+		echo "-- Do not run vncserver as root!"
+		continue
+	fi
+	VNCUSERARGS="${VNCSERVERARGS[${DISP}]}"
+	if [ ! id $USER >/dev/null 2>&1 ]; then
+		echo "-- User $USER does not exists!"
+		continue
+	fi
+	USERHOME=$(eval "echo ~$USER")
+	if [ ! -f "$USERHOME/.vnc/passwd" ]; then
+		echo "-- No password file found for user $USER!"
+		continue
+	fi
+	cat >$destunitdir/vncserver.target.wants/vncserver@$DISP.service <<EOF
+[Unit]
+Description=Remote desktop service (VNC) on display %i
+Requires=vncserver.target
+After=vncserver.target
+PropagateReloadFrom=vncserver.target
+
+[Service]
+Type=simple
+ExecStart=/sbin/runuser -l $USER -c "/usr/bin/vncserver -fg :%i $VNCUSERARGS"
+ExecStop=/sbin/runuser -l $USER -c "/usr/bin/vncserver -kill :%i"
+
+[Install]
+WantedBy=vncserver.target
+EOF
+done
diff --git a/vncserver.target b/vncserver.target
new file mode 100644
index 0000000..340c623
--- /dev/null
+++ b/vncserver.target
@@ -0,0 +1,7 @@
+[Unit]
+Description=Start VNC server daemons
+After=network.target
+Wants=network.target
+
+[Install]
+WantedBy=multi-user.target
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/tigervnc.git/commitdiff/245ad2d353e80e8c6571c651fa3f9b52af10e026



More information about the pld-cvs-commit mailing list