Update to 1.9.90 (1.10 beta)
This commit is contained in:
parent
0f57494169
commit
0838880d2e
@ -1,9 +1,9 @@
|
||||
diff --git a/unix/xserver/hw/vnc/InputXKB.c b/unix/xserver/hw/vnc/InputXKB.c
|
||||
index a9bd11d..7b54b43 100644
|
||||
index f84a6e4..4eac939 100644
|
||||
--- a/unix/xserver/hw/vnc/InputXKB.c
|
||||
+++ b/unix/xserver/hw/vnc/InputXKB.c
|
||||
@@ -214,10 +214,7 @@ void vncPrepareInputDevices(void)
|
||||
|
||||
@@ -226,10 +226,7 @@ void vncPrepareInputDevices(void)
|
||||
|
||||
unsigned vncGetKeyboardState(void)
|
||||
{
|
||||
- DeviceIntPtr master;
|
||||
@ -12,75 +12,75 @@ index a9bd11d..7b54b43 100644
|
||||
- return XkbStateFieldFromRec(&master->key->xkbInfo->state);
|
||||
+ return XkbStateFieldFromRec(&vncKeyboardDev->master->key->xkbInfo->state);
|
||||
}
|
||||
|
||||
|
||||
unsigned vncGetLevelThreeMask(void)
|
||||
@@ -238,7 +235,7 @@ unsigned vncGetLevelThreeMask(void)
|
||||
@@ -250,7 +247,7 @@ unsigned vncGetLevelThreeMask(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
- xkb = GetMaster(vncKeyboardDev, KEYBOARD_OR_FLOAT)->key->xkbInfo->desc;
|
||||
+ xkb = vncKeyboardDev->master->key->xkbInfo->desc;
|
||||
|
||||
|
||||
act = XkbKeyActionPtr(xkb, keycode, state);
|
||||
if (act == NULL)
|
||||
@@ -263,7 +260,7 @@ KeyCode vncPressShift(void)
|
||||
@@ -275,7 +272,7 @@ KeyCode vncPressShift(void)
|
||||
if (state & ShiftMask)
|
||||
return 0;
|
||||
|
||||
|
||||
- xkb = GetMaster(vncKeyboardDev, KEYBOARD_OR_FLOAT)->key->xkbInfo->desc;
|
||||
+ xkb = vncKeyboardDev->master->key->xkbInfo->desc;
|
||||
for (key = xkb->min_key_code; key <= xkb->max_key_code; key++) {
|
||||
XkbAction *act;
|
||||
unsigned char mask;
|
||||
@@ -303,7 +300,7 @@ size_t vncReleaseShift(KeyCode *keys, size_t maxKeys)
|
||||
|
||||
@@ -315,7 +312,7 @@ size_t vncReleaseShift(KeyCode *keys, size_t maxKeys)
|
||||
|
||||
count = 0;
|
||||
|
||||
|
||||
- master = GetMaster(vncKeyboardDev, KEYBOARD_OR_FLOAT);
|
||||
+ master = vncKeyboardDev->master;
|
||||
xkb = master->key->xkbInfo->desc;
|
||||
for (key = xkb->min_key_code; key <= xkb->max_key_code; key++) {
|
||||
XkbAction *act;
|
||||
@@ -359,7 +356,7 @@ KeyCode vncPressLevelThree(void)
|
||||
@@ -371,7 +368,7 @@ KeyCode vncPressLevelThree(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
- xkb = GetMaster(vncKeyboardDev, KEYBOARD_OR_FLOAT)->key->xkbInfo->desc;
|
||||
+ xkb = vncKeyboardDev->master->key->xkbInfo->desc;
|
||||
|
||||
|
||||
act = XkbKeyActionPtr(xkb, keycode, state);
|
||||
if (act == NULL)
|
||||
@@ -390,7 +387,7 @@ size_t vncReleaseLevelThree(KeyCode *keys, size_t maxKeys)
|
||||
|
||||
@@ -402,7 +399,7 @@ size_t vncReleaseLevelThree(KeyCode *keys, size_t maxKeys)
|
||||
|
||||
count = 0;
|
||||
|
||||
|
||||
- master = GetMaster(vncKeyboardDev, KEYBOARD_OR_FLOAT);
|
||||
+ master = vncKeyboardDev->master;
|
||||
xkb = master->key->xkbInfo->desc;
|
||||
for (key = xkb->min_key_code; key <= xkb->max_key_code; key++) {
|
||||
XkbAction *act;
|
||||
@@ -433,7 +430,7 @@ KeyCode vncKeysymToKeycode(KeySym keysym, unsigned state, unsigned *new_state)
|
||||
if (new_state != NULL)
|
||||
@@ -447,7 +444,7 @@ KeyCode vncKeysymToKeycode(KeySym keysym, unsigned state, unsigned *new_state)
|
||||
*new_state = state;
|
||||
|
||||
|
||||
fallback = 0;
|
||||
- xkb = GetMaster(vncKeyboardDev, KEYBOARD_OR_FLOAT)->key->xkbInfo->desc;
|
||||
+ xkb = vncKeyboardDev->master->key->xkbInfo->desc;
|
||||
for (key = xkb->min_key_code; key <= xkb->max_key_code; key++) {
|
||||
unsigned int state_out;
|
||||
KeySym dummy;
|
||||
@@ -511,7 +508,7 @@ int vncIsAffectedByNumLock(KeyCode keycode)
|
||||
@@ -551,7 +548,7 @@ int vncIsAffectedByNumLock(KeyCode keycode)
|
||||
if (numlock_keycode == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
- xkb = GetMaster(vncKeyboardDev, KEYBOARD_OR_FLOAT)->key->xkbInfo->desc;
|
||||
+ xkb = vncKeyboardDev->master->key->xkbInfo->desc;
|
||||
|
||||
|
||||
act = XkbKeyActionPtr(xkb, numlock_keycode, state);
|
||||
if (act == NULL)
|
||||
@@ -545,7 +542,7 @@ KeyCode vncAddKeysym(KeySym keysym, unsigned state)
|
||||
@@ -585,7 +582,7 @@ KeyCode vncAddKeysym(KeySym keysym, unsigned state)
|
||||
KeySym *syms;
|
||||
KeySym upper, lower;
|
||||
|
||||
|
||||
- master = GetMaster(vncKeyboardDev, KEYBOARD_OR_FLOAT);
|
||||
+ master = vncKeyboardDev->master;
|
||||
xkb = master->key->xkbInfo->desc;
|
||||
|
@ -1,27 +0,0 @@
|
||||
From be88293952175258992c1ed2f5a1b7d8f78fe7cc Mon Sep 17 00:00:00 2001
|
||||
From: Pierre Ossman <ossman@cendio.se>
|
||||
Date: Tue, 31 Jul 2018 16:06:59 +0200
|
||||
Subject: Ignore buttons in mouse leave events
|
||||
|
||||
For KDE we can sometimes get a bunch of stray FL_LEAVE events before
|
||||
gaining focus. Sending their included button information gets things
|
||||
in the incorrect order with regard to other synchronisation we do on
|
||||
focus. So just ignore buttons as the only information we want out of
|
||||
the leave information is a position update.
|
||||
|
||||
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx
|
||||
index ff27f7bf..7b5df572 100644
|
||||
--- a/vncviewer/Viewport.cxx
|
||||
+++ b/vncviewer/Viewport.cxx
|
||||
@@ -587,7 +587,10 @@ int Viewport::handle(int event)
|
||||
|
||||
case FL_LEAVE:
|
||||
window()->cursor(FL_CURSOR_DEFAULT);
|
||||
- // Fall through as we want a last move event to help trigger edge stuff
|
||||
+ // We want a last move event to help trigger edge stuff
|
||||
+ handlePointerEvent(Point(Fl::event_x() - x(), Fl::event_y() - y()), 0);
|
||||
+ return 1;
|
||||
+
|
||||
case FL_PUSH:
|
||||
case FL_RELEASE:
|
||||
case FL_DRAG:
|
@ -1,8 +1,8 @@
|
||||
diff --git a/unix/vncserver b/unix/vncserver
|
||||
index 9e7a6ac..139f960 100755
|
||||
index 68be032..ac0e993 100755
|
||||
--- a/unix/vncserver
|
||||
+++ b/unix/vncserver
|
||||
@@ -684,6 +684,7 @@ sub Usage
|
||||
@@ -678,6 +678,7 @@ sub Usage
|
||||
" [-geometry <width>x<height>]\n".
|
||||
" [-pixelformat rgbNNN|bgrNNN]\n".
|
||||
" [-fp <font-path>]\n".
|
||||
@ -10,19 +10,3 @@ index 9e7a6ac..139f960 100755
|
||||
" [-fg]\n".
|
||||
" [-autokill]\n".
|
||||
" [-noxstartup]\n".
|
||||
diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx
|
||||
index f076565..05669a4 100644
|
||||
--- a/vncviewer/vncviewer.cxx
|
||||
+++ b/vncviewer/vncviewer.cxx
|
||||
@@ -352,6 +352,11 @@ static void usage(const char *programName)
|
||||
" %s [parameters] -listen [port] [parameters]\n"
|
||||
" %s [parameters] [.tigervnc file]\n",
|
||||
programName, programName, programName);
|
||||
+ fprintf(stderr,"\n"
|
||||
+ "Options:\n\n"
|
||||
+ " -display Xdisplay - Specifies the X display for the viewer window\n"
|
||||
+ " -geometry geometry - Standard X position and sizing specification.\n");
|
||||
+
|
||||
fprintf(stderr,"\n"
|
||||
"Parameters can be turned on with -<param> or off with -<param>=0\n"
|
||||
"Parameters which take a value can be specified as "
|
||||
|
@ -1,26 +1,26 @@
|
||||
diff --git a/common/rfb/Password.cxx b/common/rfb/Password.cxx
|
||||
index 240c9d4..cf9362e 100644
|
||||
index 240c9d4..eb830d9 100644
|
||||
--- a/common/rfb/Password.cxx
|
||||
+++ b/common/rfb/Password.cxx
|
||||
@@ -55,7 +55,7 @@ PlainPasswd::~PlainPasswd() {
|
||||
|
||||
|
||||
void PlainPasswd::replaceBuf(char* b) {
|
||||
if (buf)
|
||||
- memset(buf, 0, strlen(buf));
|
||||
+ memset(buf, 0, length ? length : strlen(buf));
|
||||
CharArray::replaceBuf(b);
|
||||
}
|
||||
|
||||
|
||||
diff --git a/common/rfb/util.h b/common/rfb/util.h
|
||||
index b678b89..fffe322 100644
|
||||
index 8503519..d463316 100644
|
||||
--- a/common/rfb/util.h
|
||||
+++ b/common/rfb/util.h
|
||||
@@ -50,16 +50,21 @@ namespace rfb {
|
||||
@@ -51,16 +51,21 @@ namespace rfb {
|
||||
CharArray() : buf(0) {}
|
||||
CharArray(char* str) : buf(str) {} // note: assumes ownership
|
||||
CharArray(int len) {
|
||||
+ length = len;
|
||||
buf = new char[len];
|
||||
buf = new char[len]();
|
||||
}
|
||||
~CharArray() {
|
||||
- delete [] buf;
|
||||
|
@ -1,6 +1,6 @@
|
||||
Name: tigervnc
|
||||
Version: 1.9.0
|
||||
Release: 7%{?dist}
|
||||
Version: 1.9.90
|
||||
Release: 1%{?dist}
|
||||
Summary: A TigerVNC remote display system
|
||||
|
||||
%global _hardened_build 1
|
||||
@ -9,18 +9,19 @@ License: GPLv2+
|
||||
URL: http://www.tigervnc.com
|
||||
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
Source1: vncserver.service
|
||||
Source2: vncserver.sysconfig
|
||||
Source3: 10-libvnc.conf
|
||||
Source4: xvnc.service
|
||||
Source5: xvnc.socket
|
||||
Source1: vncserver-system.service
|
||||
Source2: vncserver-user.service
|
||||
Source3: vncserver.sysconfig
|
||||
Source4: 10-libvnc.conf
|
||||
Source5: xvnc.service
|
||||
Source6: xvnc.socket
|
||||
Source7: vncserver_wrapper
|
||||
|
||||
Patch1: tigervnc-manpages.patch
|
||||
Patch2: tigervnc-getmaster.patch
|
||||
Patch3: tigervnc-shebang.patch
|
||||
Patch4: tigervnc-xstartup.patch
|
||||
Patch5: tigervnc-utilize-system-crypto-policies.patch
|
||||
Patch6: tigervnc-ignore-buttons-in-mouse-leave-event.patch
|
||||
Patch7: tigervnc-passwd-crash-with-malloc-checks.patch
|
||||
|
||||
Patch100: tigervnc-xserver120.patch
|
||||
@ -32,10 +33,9 @@ BuildRequires: xorg-x11-xtrans-devel, xorg-x11-util-macros, libXtst-devel
|
||||
BuildRequires: libxkbfile-devel, openssl-devel, libpciaccess-devel
|
||||
BuildRequires: mesa-libGL-devel, libXinerama-devel,
|
||||
BuildRequires: freetype-devel, libXdmcp-devel, libxshmfence-devel
|
||||
BuildRequires: desktop-file-utils, java-devel, jpackage-utils
|
||||
BuildRequires: libjpeg-turbo-devel, gnutls-devel, pam-devel
|
||||
BuildRequires: libdrm-devel, libXt-devel, pixman-devel
|
||||
BuildRequires: systemd, cmake
|
||||
BuildRequires: systemd, cmake, desktop-file-utils,
|
||||
%if 0%{?fedora} > 24 || 0%{?rhel} >= 7
|
||||
BuildRequires: libXfont2-devel
|
||||
%else
|
||||
@ -105,15 +105,6 @@ Requires: tigervnc-license
|
||||
This package contains libvnc.so module to X server, allowing others
|
||||
to access the desktop on your machine.
|
||||
|
||||
%package server-applet
|
||||
Summary: Java TigerVNC viewer applet for TigerVNC server
|
||||
Requires: tigervnc-server, java, jpackage-utils
|
||||
BuildArch: noarch
|
||||
|
||||
%description server-applet
|
||||
The Java TigerVNC viewer applet for web browsers. Install this package to allow
|
||||
clients to use web browser when connect to the TigerVNC server.
|
||||
|
||||
%package license
|
||||
Summary: License of TigerVNC suite
|
||||
BuildArch: noarch
|
||||
@ -154,8 +145,6 @@ popd
|
||||
# Utilize system-wide crypto policies
|
||||
%patch5 -p1 -b .utilize-system-crypto-policies
|
||||
|
||||
%patch6 -p1 -b .ignore-buttons-in-mouse-leave-event
|
||||
|
||||
%patch7 -p1 -b .tigervnc-passwd-crash-with-malloc-checks
|
||||
|
||||
%build
|
||||
@ -196,12 +185,6 @@ pushd media
|
||||
make
|
||||
popd
|
||||
|
||||
# Build Java applet
|
||||
pushd java
|
||||
%{cmake} .
|
||||
JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8" make
|
||||
popd
|
||||
|
||||
%install
|
||||
%make_install
|
||||
rm -f %{buildroot}%{_docdir}/%{name}-%{version}/{README.rst,LICENCE.TXT}
|
||||
@ -212,11 +195,16 @@ popd
|
||||
|
||||
# Install systemd unit file
|
||||
mkdir -p %{buildroot}%{_unitdir}
|
||||
mkdir -p %{buildroot}%{_userunitdir}
|
||||
install -m644 %{SOURCE1} %{buildroot}%{_unitdir}/vncserver@.service
|
||||
install -m644 %{SOURCE2} %{buildroot}%{_userunitdir}/vncserver@.service
|
||||
install -m644 %{SOURCE4} %{buildroot}%{_unitdir}/xvnc@.service
|
||||
install -m644 %{SOURCE5} %{buildroot}%{_unitdir}/xvnc.socket
|
||||
rm -rf %{buildroot}%{_initrddir}
|
||||
|
||||
# Install vncserver wrapper script
|
||||
install -m744 %{SOURCE7} %{buildroot}%{_bindir}/vncserver_wrapper
|
||||
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
|
||||
install -m644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/vncservers
|
||||
|
||||
@ -229,14 +217,6 @@ install -m644 tigervnc_$s.png %{buildroot}%{_datadir}/icons/hicolor/${s}x$s/apps
|
||||
done
|
||||
popd
|
||||
|
||||
|
||||
# Install Java applet
|
||||
pushd java
|
||||
mkdir -p %{buildroot}%{_datadir}/vnc/classes
|
||||
install -m755 VncViewer.jar %{buildroot}%{_datadir}/vnc/classes
|
||||
install -m644 com/tigervnc/vncviewer/index.vnc %{buildroot}%{_datadir}/vnc/classes
|
||||
popd
|
||||
|
||||
%find_lang %{name} %{name}.lang
|
||||
|
||||
# remove unwanted files
|
||||
@ -268,11 +248,13 @@ install -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/X11/xorg.conf.d/10-libvnc.c
|
||||
|
||||
%files server
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/vncservers
|
||||
%{_userunitdir}/vncserver@.service
|
||||
%{_unitdir}/vncserver@.service
|
||||
%{_unitdir}/xvnc@.service
|
||||
%{_unitdir}/xvnc.socket
|
||||
%{_bindir}/x0vncserver
|
||||
%{_bindir}/vncserver
|
||||
%{_bindir}/vncserver_wrapper
|
||||
%{_mandir}/man1/vncserver.1*
|
||||
%{_mandir}/man1/x0vncserver.1*
|
||||
|
||||
@ -288,10 +270,6 @@ install -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/X11/xorg.conf.d/10-libvnc.c
|
||||
%{_libdir}/xorg/modules/extensions/libvnc.so
|
||||
%config %{_sysconfdir}/X11/xorg.conf.d/10-libvnc.conf
|
||||
|
||||
%files server-applet
|
||||
%doc java/com/tigervnc/vncviewer/README
|
||||
%{_datadir}/vnc/classes/*
|
||||
|
||||
%files license
|
||||
%license LICENCE.TXT
|
||||
|
||||
@ -299,10 +277,15 @@ install -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/X11/xorg.conf.d/10-libvnc.c
|
||||
%{_datadir}/icons/hicolor/*/apps/*
|
||||
|
||||
%changelog
|
||||
* Fri Oct 18 2019 Jan Grulich <jgrulich@redhat.com> - 1.9.90-1
|
||||
- Update to 1.9.90 (1.10 beta)
|
||||
- Add systemd user service file
|
||||
- Use a wrapper for systemd system service file to workaround systemd limitations
|
||||
|
||||
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.0-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Wed Jul 19 2019 Dan Horák <dan[at]danny.cz> - 1.9.0-6
|
||||
* Fri Jul 19 2019 Dan Horák <dan[at]danny.cz> - 1.9.0-6
|
||||
- drop the s390x special handling (related #1727029)
|
||||
|
||||
* Wed Jun 12 2019 Jan Grulich <jgrulich@redhat.com> - 1.9.0-5
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Quick HowTo:
|
||||
# 1. Copy this file to /etc/systemd/system/vncserver@.service
|
||||
# 2. Replace <USER> with the actual user name and edit vncserver
|
||||
# parameters appropriately
|
||||
# parameters in the wrapper script located in /usr/bin/vncserver_wrapper
|
||||
# 3. Run `systemctl daemon-reload`
|
||||
# 4. Run `systemctl enable vncserver@:<display>.service`
|
||||
#
|
||||
@ -34,19 +34,12 @@ Description=Remote desktop service (VNC)
|
||||
After=syslog.target network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
WorkingDirectory=/home/<USER>
|
||||
User=<USER>
|
||||
Group=<USER>
|
||||
|
||||
PIDFile=/home/<USER>/.vnc/%H%i.pid
|
||||
Type=simple
|
||||
|
||||
# Clean any existing files in /tmp/.X11-unix environment
|
||||
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
|
||||
ExecStart=/usr/bin/vncserver -autokill %i
|
||||
ExecStop=/usr/bin/vncserver -kill %i
|
||||
|
||||
Restart=on-success
|
||||
RestartSec=15
|
||||
ExecStart=/usr/bin/vncserver_wrapper <USER> %i
|
||||
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
59
vncserver-user.service
Normal file
59
vncserver-user.service
Normal file
@ -0,0 +1,59 @@
|
||||
# The vncserver service unit file
|
||||
#
|
||||
# Quick HowTo: As the User wanting to have this functionality
|
||||
#
|
||||
# 1. Copy this file to ~/.config/systemd/user/ (Optional, in case default settings are not suitable)
|
||||
#
|
||||
# $ mkdir -p ~/.config/systemd/user
|
||||
# $ cp /usr/lib/systemd/user/vncserver@.service ~/.config/systemd/user/
|
||||
#
|
||||
# 2. Reload user's systemd
|
||||
#
|
||||
# $ systemctl --user daemon-reload
|
||||
#
|
||||
# 3. Start the service immediately and enable it at boot
|
||||
#
|
||||
# $ systemctl --user enable vncserver@:<display>.service --now
|
||||
#
|
||||
# 4. Enable lingering
|
||||
#
|
||||
# $ loginctl enable-linger
|
||||
#
|
||||
# DO NOT RUN THIS SERVICE if your local area network is
|
||||
# untrusted! For a secure way of using VNC, you should
|
||||
# limit connections to the local host and then tunnel from
|
||||
# the machine you want to view VNC on (host A) to the machine
|
||||
# whose VNC output you want to view (host B)
|
||||
#
|
||||
# [user@hostA ~]$ ssh -v -C -L 590N:localhost:590M hostB
|
||||
#
|
||||
# this will open a connection on port 590N of your hostA to hostB's port 590M
|
||||
# (in fact, it ssh-connects to hostB and then connects to localhost (on hostB).
|
||||
# See the ssh man page for details on port forwarding)
|
||||
#
|
||||
# You can then point a VNC client on hostA at vncdisplay N of localhost and with
|
||||
# the help of ssh, you end up seeing what hostB makes available on port 590M
|
||||
#
|
||||
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
|
||||
#
|
||||
# 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.
|
||||
|
||||
|
||||
[Unit]
|
||||
Description=Remote desktop service (VNC)
|
||||
After=syslog.target network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
|
||||
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
|
||||
ExecStart=/usr/bin/vncserver %i
|
||||
ExecStop=/usr/bin/vncserver -kill %i
|
||||
|
||||
Restart=on-success
|
||||
RestartSec=15
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
42
vncserver_wrapper
Executable file
42
vncserver_wrapper
Executable file
@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
|
||||
USER="$1"
|
||||
INSTANCE="$2"
|
||||
|
||||
die() {
|
||||
echo "FATAL: ${@:-}" >&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
[ -n "$VNCPID" ] || return
|
||||
if kill -0 $VNCPID 2>/dev/null; then
|
||||
kill $VNCPID
|
||||
fi
|
||||
}
|
||||
|
||||
trap cleanup TERM INT HUP
|
||||
|
||||
[ -n "$USER" -a -n "$INSTANCE" ] || die "Invalid usage!"
|
||||
|
||||
/usr/sbin/runuser -l "$USER" -c "/usr/bin/vncserver ${INSTANCE}"
|
||||
[ $? -eq 0 ] || die "'runuser -l $USER' failed!"
|
||||
|
||||
# Wait up to 5 seconds for vncserver to be up
|
||||
for tries in $(seq 1 50); do
|
||||
[ -e "~$USER/.vnc/$(hostname)${INSTANCE}.pid" ] && break
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
eval HOME=~$USER
|
||||
|
||||
VNCPID=$(cat "$HOME/.vnc/$(hostname)${INSTANCE}.pid" 2>/dev/null || true)
|
||||
[ -n "$VNCPID" ] || die "'vncserver ${INSTANCE}' failed to start after 5 seconds!"
|
||||
|
||||
echo "'vncserver ${INSTANCE}' has PID $VNCPID, waiting until it exits ..."
|
||||
|
||||
while kill -0 $VNCPID 2>/dev/null; do
|
||||
sleep 5
|
||||
done
|
||||
|
||||
echo "PID $VNCPID exited, exiting ..."
|
Loading…
Reference in New Issue
Block a user