From 36832862012790f1c7ee883e5631f20ebbc0b483 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 5 Jan 2024 18:33:12 +0100 Subject: [PATCH] fix vncserver@ service template to use PIDFile and support pam [release 1.3.10-5mamba;Sun May 11 2014] --- README.md | 3 + tightvnc-1.3.10-arm.patch | 11 +++ tightvnc-1.3.10-config.patch | 24 +++++ tightvnc.spec | 184 +++++++++++++++++++++++++++++++++++ vncserver@.service | 32 ++++++ 5 files changed, 254 insertions(+) create mode 100644 tightvnc-1.3.10-arm.patch create mode 100644 tightvnc-1.3.10-config.patch create mode 100644 tightvnc.spec create mode 100644 vncserver@.service diff --git a/README.md b/README.md index 3712dc0..21ca26f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # tightvnc +Virtual Network Computing (VNC) is a remote display system which allows you to view a computing 'desktop' environment not only on the machine where it is running, but from anywhere on the Internet and from a wide variety of machine architectures. TightVNC is an enhanced VNC distribution. +This package contains a client which will allow you to connect to other desktops running a VNC or a TightVNC server. + diff --git a/tightvnc-1.3.10-arm.patch b/tightvnc-1.3.10-arm.patch new file mode 100644 index 0000000..36b1f75 --- /dev/null +++ b/tightvnc-1.3.10-arm.patch @@ -0,0 +1,11 @@ +diff -ru vnc_unixsrc.orig//Xvnc/configure vnc_unixsrc/Xvnc/configure +--- vnc_unixsrc.orig//Xvnc/configure 2010-12-01 01:24:05.000000000 +0000 ++++ vnc_unixsrc/Xvnc/configure 2010-12-01 01:20:19.000000000 +0000 +@@ -39,6 +39,7 @@ + echo "#define OSMinorVersion $MINOR" >> config/cf/platform.def + echo "#define OSTeenyVersion $TEENY" >> config/cf/platform.def + echo "#define LinuxCLibMajorVersion 6" >> config/cf/platform.def ++echo "#define ArmArchitecture 1" >> config/cf/platform.def + + if [ "$SYSNAME" = AIX ] + then diff --git a/tightvnc-1.3.10-config.patch b/tightvnc-1.3.10-config.patch new file mode 100644 index 0000000..e376c02 --- /dev/null +++ b/tightvnc-1.3.10-config.patch @@ -0,0 +1,24 @@ +diff -Nru vnc_unixsrc.orig//tightvncserver.conf vnc_unixsrc/tightvncserver.conf +--- vnc_unixsrc.orig//tightvncserver.conf 2009-02-12 05:27:18.000000000 +0100 ++++ vnc_unixsrc/tightvncserver.conf 2010-11-30 22:34:35.879961723 +0100 +@@ -19,16 +19,16 @@ + # $geometry = "1024x768"; + # $depth = 24; + # $desktopName = "X"; +-# $vncClasses = "/usr/local/vnc/classes"; ++$vncClasses = "/usr/share/vnc/classes"; + # $vncUserDir = "$ENV{HOME}/.vnc"; + # $fontPath = "unix/:7100"; + # $authType = "-rfbauth $vncUserDir/passwd"; +-# $colorPath = "/usr/lib/X11/rgb"; ++$colorPath = "/usr/share/X11/rgb.txt"; + + ## Here is another example of setting the font path: + # +-# $fontPath = "/usr/lib/X11/fonts/misc/" +-# $fontPath = "$fontPath,/usr/lib/X11/fonts/75dpi/"; ++$fontPath = "/usr/share/fonts/X11/misc/" ++$fontPath = "$fontPath,/usr/share/fonts/X11/75dpi/"; + + ## You might wish to make your vnc directory under /tmp, to make sure + ## passwords are always kept on the local filesystem. To do that, just diff --git a/tightvnc.spec b/tightvnc.spec new file mode 100644 index 0000000..68a7ce9 --- /dev/null +++ b/tightvnc.spec @@ -0,0 +1,184 @@ +### AUTOUPDATE-OFF: 6 +Name: tightvnc +Version: 1.3.10 +Release: 5mamba +Summary: A VNC distribution with many new features, improvements, and bugfixes over VNC +Group: Graphical Desktop/Applications/Networking +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: http://www.tightvnc.com/ +Source: http://downloads.sourceforge.net/sourceforge/vnc-tight/tightvnc-%{version}_unixsrc.tar.bz2 +Source1: vncserver@.service +Patch0: %{name}-1.3.10-config.patch +Patch1: %{name}-1.3.10-arm.patch +License: GPL +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +BuildRequires: libICE-devel +BuildRequires: libSM-devel +BuildRequires: libX11-devel +BuildRequires: libXaw-devel +BuildRequires: libXext-devel +BuildRequires: libXmu-devel +BuildRequires: libXpm-devel +BuildRequires: libXt-devel +BuildRequires: libjpeg-devel +BuildRequires: libwrap-devel +BuildRequires: libz-devel +## AUTOBUILDREQ-END +BuildRequires: imake +BuildRequires: gccmakedep +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +%description +Virtual Network Computing (VNC) is a remote display system which allows you to view a computing 'desktop' environment not only on the machine where it is running, but from anywhere on the Internet and from a wide variety of machine architectures. TightVNC is an enhanced VNC distribution. +This package contains a client which will allow you to connect to other desktops running a VNC or a TightVNC server. + +%package server +Summary: TightVNC server +Obsoletes: vnc-server +Group: Graphical Desktop/Applications/Networking +Requires: xorg-fonts-base +Requires: xorg-fonts-75dpi +Requires: xorg-apps-base +Requires: xauth +Requires: rgb + +%description server +The VNC system allows you to access the same desktop from a wide variety of platforms. +TightVNC is an enhanced VNC distribution. This package is a TightVNC server, allowing others to access the desktop on your machine. + +%prep +%setup -q -n vnc_unixsrc +%patch0 -p1 +%ifarch arm +%patch1 -p1 +%endif +perl -pi -e "s|/usr/local/vnc/classes|%{_datadir}/vnc/classes|" vncserver + +%build +# Use xinit's Xclients script to start the session (bug #52711) +patch < vnc-xclients.patch + +xmkmf +make Makefiles LIBDIR=%{_libdir}/X11 +%make World \ + CC=%{_host}-gcc \ + CXX=%{_host}-c++ \ + LIBDIR=%{_libdir}/X11 + +cd Xvnc +%configure + +make World \ + EXTRA_LIBRARIES="-lwrap -lnss_nis -DArmArchitecture" \ + EXTRA_DEFINES="-DUSE_LIBWRAP=1" \ + INCROOT=%{_includedir}/X11 \ + SHLIBDIR=%{_libdir}/X11 \ + MANPATH=%{_mandir} + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%makeinstall +install -d %{buildroot}%{_mandir}/man1 %{buildroot}%{_bindir} +./vncinstall %{buildroot}%{_bindir} %{buildroot}%{_mandir} + +mkdir -p %{buildroot}%{_datadir}/vnc +cp -aR classes %{buildroot}%{_datadir}/vnc + +install -D -m0644 tightvncserver.conf %{buildroot}%{_sysconfdir}/tightvncserver.conf +#install -D -m755 vncserver.init %{buildroot}%{_initrddir}/vncserver + +install -d %{buildroot}%{_sysconfdir}/sysconfig +cat > %{buildroot}%{_sysconfdir}/sysconfig/vncservers << EOF +# The VNCSERVERS variable is a list of display:user pairs. +# +# Uncomment the line below to start a VNC server on display :1 +# 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! For a secure way of using VNC, see +# . + +# VNCSERVERS="1:myusername" +EOF +chmod 644 %{buildroot}%{_sysconfdir}/sysconfig/vncservers + +mkdir -p %{buildroot}%{_datadir}/applications +cat > %{buildroot}%{_datadir}/applications/vncviewer.desktop << EOF +[Desktop Entry] +Name=VNC Viewer +Comment=VNC client application +Exec=/usr/bin/vncviewer +Terminal=0 +Type=Application +Categories=Application;Network; +EOF + +install -D -m0755 %{SOURCE1} %{buildroot}/lib/systemd/system/vncserver@.service + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%post server +if [ "$1" -ge 1 ]; then + systemctl -q daemon-reload +fi + +%postun server +if [ "$1" -eq "0" ]; then + systemctl -q daemon-reload +fi + +%files +%defattr(-,root,root) +%{_bindir}/vncviewer +%{_datadir}/applications/vncviewer.desktop +%{_mandir}/man1/vncviewer.1* +%doc LICENCE.TXT +#% doc ChangeLog README + +%files server +%defattr(-,root,root) +#%attr(0755,root,root) %config /etc/rc.d/init.d/vncserver +%config(noreplace) %{_sysconfdir}/tightvncserver.conf +%config(noreplace) /etc/sysconfig/vncservers +%{_bindir}/Xvnc +%{_bindir}/vncserver +%{_bindir}/vncpasswd +%{_bindir}/vncconnect +%dir %{_datadir}/vnc +%{_datadir}/vnc/classes/*.class +%{_datadir}/vnc/classes/VncViewer.jar +%{_datadir}/vnc/classes/index.vnc +/lib/systemd/system/vncserver@.service +%{_mandir}/man1/Xvnc.1* +%{_mandir}/man1/vncserver.1* +%{_mandir}/man1/vncconnect.1* +%{_mandir}/man1/vncpasswd.1* +%doc LICENCE.TXT +#README WhatsNew ChangeLog + +%changelog +* Sun May 11 2014 Silvan Calarco 1.3.10-5mamba +- fix vncserver@ service template to use PIDFile and support pam + +* Sat May 03 2014 Silvan Calarco 1.3.10-4mamba +- fix X11 font path +- add systemd service file + +* Sat Dec 04 2010 Silvan Calarco 1.3.10-3mamba +- vncserver: added requirement for X11 fonts and apps + +* Tue Nov 30 2010 Silvan Calarco 1.3.10-2mamba +- added configuration patch to fix fonts and rgb.txt paths and install it in /etc + +* Wed Jun 17 2009 Silvan Calarco 1.3.10-1mamba +- update to 1.3.10 + +* Tue Sep 11 2007 Silvan Calarco 1.3.9_unixsrc-1mamba +- package created by autospec diff --git a/vncserver@.service b/vncserver@.service new file mode 100644 index 0000000..8304248 --- /dev/null +++ b/vncserver@.service @@ -0,0 +1,32 @@ +# The vncserver service unit file +# +# 1. Copy this file to /etc/systemd/system/vncserver@:.service +# 2. Edit User= and PIDFile= +# ("User=foo") +# 3. Edit and vncserver parameters appropriately +# ("/usr/bin/vncserver %i -arg1 -arg2 -argn") +# 4. Run `systemctl --system daemon-reload` +# 5. Run `systemctl enable vncserver@:.service` +# +# DO NOT RUN THIS SERVICE if your local area network is untrusted! +# +# See the wiki page for more on security +# https://wiki.archlinux.org/index.php/Vncserver + +[Unit] +Description=Remote desktop service (VNC) +After=syslog.target network.target + +[Service] +Type=forking +User=root +PAMName=login + +# Clean any existing files in /tmp/.X11-unix environment +ExecStartPre=-/usr/bin/vncserver -kill %i +ExecStart=/usr/bin/vncserver %i +PIDFile=/root/.vnc/%H%i.pid +ExecStop=/usr/bin/vncserver -kill %i + +[Install] +WantedBy=multi-user.target