.gear/rules | 3 + .../tags/1b9ad612c512784ae4ecb7b11e9a8da6791370ae | 22 +++ .gear/tags/list | 1 + .gear/upstream/filter-tag | 1 + .gear/upstream/remotes | 3 + .gear/upstream/transform-tag | 1 + Makefile.am | 5 +- data/spice-vdagent.desktop | 1 + data/spice-vdagent.service | 2 + data/spice-vdagentd.service | 2 + spice-vdagent.spec | 161 +++++++++++++++++++++ spice-vdagentd.init-alt | 95 ++++++++++++ src/vdagent/display.c | 6 +- 13 files changed, 297 insertions(+), 6 deletions(-) diff --git a/.gear/rules b/.gear/rules new file mode 100644 index 0000000..77bbb6b --- /dev/null +++ b/.gear/rules @@ -0,0 +1,3 @@ +tar: spice-vdagent-@version@:. +diff: spice-vdagent-@version@:. . name=@name@-@version@.patch +copy: spice-vdagentd.init-alt diff --git a/.gear/tags/1b9ad612c512784ae4ecb7b11e9a8da6791370ae b/.gear/tags/1b9ad612c512784ae4ecb7b11e9a8da6791370ae new file mode 100644 index 0000000..2ef153b --- /dev/null +++ b/.gear/tags/1b9ad612c512784ae4ecb7b11e9a8da6791370ae @@ -0,0 +1,22 @@ +object a9bb1752cede50757c47f6f8e1f52fb6bed93cd6 +type commit +tag spice-vdagent-0.22.1 +tagger Victor Toso 1644838285 +0100 + +Release 0.22.1 +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCAAdFiEEIG07NS9WbzsOZXLpl9kSPeN6SE8FAmIKPY0ACgkQl9kSPeN6 +SE+pAA//dQyFLzzTGw/W3HvBbMtyPcE2z8LmhDIDynf7nxJF3napwXBzJz/cdwJ8 +i5QIxru7fLFRp1bv3vHBGqAtH377nSYS674dXa5NyDEvrg9S+rrbrt5GaagD+ZCX ++89lE305W2t88rNioWpkqAHf+lkk7Jv1n51i0lJZrE/Cdunz8PDD+cCCMJMETfp5 +PaCnSNiiRJbkP5Ka5jlLKKospPMWPSe5Z7RnGLcyc3dMqhez9g/07LpClf/F0zxv +KuEtRul+vFw07g4QfGquZVTWvRce1FTad03Ltx8VL61MMFpbkqULuPaPO4p8ZtE1 +UuPWkwNZdXUA0eQbAE+Pqa0PiZzasbzjJegbQJthP6dnzSKmrcg1CZh+SlyeFxd3 +tdeUmf3m4+x1TyF7p0niY53VrcVTK30GLwYNGHjwiIfV4lHlHvZ/yl0ufZarV1nh +HAm/F/8OyGI01xz+w+H58dCswh7/W6AbxMdAJRVgmhjTCCira2Ojhzr6JrYcUnj2 +QxmM63UdvmX3+tDvcT1/T4n1Lc3D+0lrYJ4ofjLiOLeEUZLCt7F/xKaJIMstayGN +sBgPGaivbYgxTZtx5gxozJksiF8ft3N08uPtUFYJErkz4zmUQDqo0V/bELiXDr3X +f6HD6XI/8z7sgUwjU+b3GZkNyIb8/u6CQQCCXwmIHzB5oUDHeuA= +=6RWG +-----END PGP SIGNATURE----- diff --git a/.gear/tags/list b/.gear/tags/list new file mode 100644 index 0000000..26c22cb --- /dev/null +++ b/.gear/tags/list @@ -0,0 +1 @@ +1b9ad612c512784ae4ecb7b11e9a8da6791370ae spice-vdagent-0.22.1 diff --git a/.gear/upstream/filter-tag b/.gear/upstream/filter-tag new file mode 100755 index 0000000..8868f79 --- /dev/null +++ b/.gear/upstream/filter-tag @@ -0,0 +1 @@ +grep spice-vdagent- diff --git a/.gear/upstream/remotes b/.gear/upstream/remotes new file mode 100644 index 0000000..3cdefa7 --- /dev/null +++ b/.gear/upstream/remotes @@ -0,0 +1,3 @@ +[remote "upstream"] + url = https://gitlab.freedesktop.org/spice/linux/vd_agent.git + fetch = +refs/heads/*:refs/remotes/upstream/* diff --git a/.gear/upstream/transform-tag b/.gear/upstream/transform-tag new file mode 100755 index 0000000..cf63766 --- /dev/null +++ b/.gear/upstream/transform-tag @@ -0,0 +1 @@ +sed 's,^spice-vdagent-,,;' diff --git a/Makefile.am b/Makefile.am index 9c30bae..416bd23 100644 --- a/Makefile.am +++ b/Makefile.am @@ -153,9 +153,6 @@ gdmautostart_DATA = $(top_srcdir)/data/spice-vdagent.desktop gdmautostart2dir = $(datadir)/gdm/autostart/LoginWindow gdmautostart2_DATA = $(top_srcdir)/data/spice-vdagent.desktop -install-data-local: - $(mkdir_p) $(DESTDIR)$(localstatedir)/run/spice-vdagentd - if INIT_SCRIPT_RED_HAT initdir = $(sysconfdir)/rc.d/init.d init_SCRIPTS = $(top_srcdir)/data/spice-vdagentd @@ -174,7 +171,7 @@ userunit_DATA = \ udevrulesdir = $(udevdir)/rules.d udevrules_DATA = $(top_srcdir)/data/70-spice-vdagentd.rules -tmpfilesdir = $(prefix)/lib/tmpfiles.d +tmpfilesdir = /lib/tmpfiles.d tmpfiles_DATA = $(top_srcdir)/data/tmpfiles.d/spice-vdagentd.conf endif diff --git a/data/spice-vdagent.desktop b/data/spice-vdagent.desktop index 4424061..729a5f6 100644 --- a/data/spice-vdagent.desktop +++ b/data/spice-vdagent.desktop @@ -7,3 +7,4 @@ Type=Application Categories= X-GNOME-Autostart-Phase=WindowManager NoDisplay=true +X-systemd-skip=true diff --git a/data/spice-vdagent.service b/data/spice-vdagent.service index a18f4ff..f5510b8 100644 --- a/data/spice-vdagent.service +++ b/data/spice-vdagent.service @@ -1,5 +1,7 @@ [Unit] Description=Spice guest session agent +# Make sure the display is reachable +PartOf=graphical-session.target [Service] ExecStart=/usr/bin/spice-vdagent -x diff --git a/data/spice-vdagentd.service b/data/spice-vdagentd.service index 9c70b30..3ea63f5 100644 --- a/data/spice-vdagentd.service +++ b/data/spice-vdagentd.service @@ -8,6 +8,8 @@ Type=forking EnvironmentFile=-/etc/sysconfig/spice-vdagentd ExecStart=/usr/sbin/spice-vdagentd $SPICE_VDAGENTD_EXTRA_ARGS PIDFile=/run/spice-vdagentd/spice-vdagentd.pid +RuntimeDirectory=spice-vdagentd +RuntimeDirectoryPreserve=yes PrivateTmp=true Restart=on-failure diff --git a/spice-vdagent.spec b/spice-vdagent.spec new file mode 100644 index 0000000..29a5569 --- /dev/null +++ b/spice-vdagent.spec @@ -0,0 +1,161 @@ +%define _unpackaged_files_terminate_build 1 +%define _runtimedir /run +%define _localstatedir /var +#Use GTK+ instead of Xlib +%def_with gtk + +Name: spice-vdagent +Version: 0.22.1 +Release: alt1.1 +Epoch: 1 +Summary: Agent for Spice guests +Group: Networking/Remote access +License: GPLv3+ +Url: http://spice-space.org/ + +# VCS-git: https://gitlab.freedesktop.org/spice/linux/vd_agent.git +Source: %name-%version.tar +Source2: spice-vdagentd.init-alt +Patch: %name-%version.patch + +BuildRequires(pre): rpm-macros-systemd +BuildRequires: pkgconfig(gio-unix-2.0) >= 2.50 +%{?_with_gtk:BuildRequires: pkgconfig(gtk+-3.0) >= 3.22} +BuildRequires: pkgconfig(xfixes) pkgconfig(xrandr) >= 1.3 pkgconfig(xinerama) pkgconfig(x11) +BuildRequires: pkgconfig(spice-protocol) >= 0.14.3 +BuildRequires: pkgconfig(alsa) >= 1.0.22 +BuildRequires: pkgconfig(dbus-1) +BuildRequires: pkgconfig(libdrm) +BuildRequires: pkgconfig(pciaccess) >= 0.10 +BuildRequires: desktop-file-utils +BuildRequires: pkgconfig(systemd) pkgconfig(libsystemd) >= 209 +BuildRequires: pkgconfig(udev) +BuildRequires: desktop-file-utils + +%description +Spice agent for Linux guests offering the following features: + +Features: +* Client mouse mode (no need to grab mouse by client, no mouse lag) + this is handled by the daemon by feeding mouse events into the kernel + via uinput. This will only work if the active X-session is running a + spice-vdagent process so that its resolution can be determined. +* Automatic adjustment of the X-session resolution to the client resolution +* Support of copy and paste (text and images) between the active X-session + and the client + +%prep +%setup +%patch -p1 + +%build +%autoreconf +%configure \ + %{subst_with gtk} \ + --with-session-info=auto \ + --with-init-script=systemd+redhat + +%make_build + +%install +%makeinstall_std +install -m 0755 %SOURCE2 %buildroot%_initdir/spice-vdagentd + +# fix autostart in KDE Plasma +cp -ar %buildroot/%_sysconfdir/xdg/autostart/spice-vdagent{,-kde}.desktop +desktop-file-install --mode=0644 --dir %buildroot/%_sysconfdir/xdg/autostart \ + --add-not-show-in="KDE" \ + %buildroot/%_sysconfdir/xdg/autostart/spice-vdagent.desktop +desktop-file-install --mode=0644 --dir %buildroot/%_sysconfdir/xdg/autostart \ + --add-only-show-in="KDE" \ + --remove-key="X-GNOME-Autostart-Phase" \ + --set-key="Exec" --set-value="/usr/bin/spice-vdagent -x" \ + %buildroot/%_sysconfdir/xdg/autostart/spice-vdagent-kde.desktop + +%post +%post_service spice-vdagentd +%systemd_user_post spice-vdagent.service + +%preun +%preun_service spice-vdagentd +%systemd_user_preun spice-vdagent.service + +%files +%doc COPYING CHANGELOG.md README.md +/lib/udev/rules.d/*.rules +/lib/tmpfiles.d/spice-vdagentd.conf +%_initddir/spice-vdagentd +%_unitdir/* +%_userunitdir/* +%_bindir/spice-vdagent +%_sbindir/spice-vdagentd +%_sysconfdir/xdg/autostart/spice-vdagent*.desktop +%_datadir/gdm/autostart/LoginWindow/spice-vdagent.desktop +%_datadir/gdm/greeter/autostart/spice-vdagent.desktop +%_man1dir/* + +%changelog +* Mon Sep 11 2023 Sergey V Turchin 1:0.22.1-alt1.1 +- NMU: fix systemd user session startup loop (closes: 47329) + +* Tue Jul 04 2023 Alexey Shabalin 1:0.22.1-alt1 +- 0.22.1 + +* Mon Sep 26 2022 Slava Aseev 1:0.21.0-alt3 +- fix autostart in KDE Plasma (attempt number 2) + +* Fri Sep 23 2022 Sergey V Turchin 1:0.21.0-alt2 +- fix autostart in KDE Plasma + +* Thu Jan 21 2021 Aleksei Nikiforov 1:0.21.0-alt1 +- new version 0.21.0 (Fixes CVE-2020-25650, CVE-2020-25651, CVE-2020-25652, CVE-2020-25653). + +* Wed Mar 25 2020 Alexey Shabalin 1:0.20.0-alt1 +- new version 0.20.0 + +* Sun Jun 02 2019 Alexey Shabalin 1:0.19.0-alt1 +- 0.19.0 + +* Tue Apr 23 2019 Alexey Shabalin 1:0.18.0-alt3 +- downgrade to 0.18.0 + +* Tue Apr 16 2019 Alexey Shabalin 0.19.0-alt1 +- 0.19.0 + +* Fri Apr 05 2019 Alexey Shabalin 0.18.0-alt2 +- backport some patches from upstream +- Update all paths /var/run -> /run + +* Mon Jul 09 2018 Alexey Shabalin 0.18.0-alt1 +- 0.18.0 +- Use GTK+ instead of Xlib + +* Thu Jun 16 2016 Alexey Shabalin 0.17.0-alt1 +- 0.17.0 + +* Fri Jul 03 2015 Alexey Shabalin 0.16.0-alt1 +- 0.16.0 + +* Fri Apr 25 2014 Alexey Shabalin 0.15.0-alt1.git7d858d +- upstream git snaphot 7d858d5064fd0c26454b72bf9fe3e0472f31e34f + +* Mon May 20 2013 Alexey Shabalin 0.14.0-alt1 +- 0.14.0 + +* Thu Apr 11 2013 Alexey Shabalin 0.12.1-alt1 +- 0.12.1 + +* Tue Sep 04 2012 Alexey Shabalin 0.12.0-alt1 +- 0.12.0 + +* Tue Apr 10 2012 Alexey Shabalin 0.10.1-alt1 +- 0.10.1 + +* Wed Aug 10 2011 Alexey Shabalin 0.8.1-alt1 +- 0.8.1 + +* Wed May 11 2011 Alexey Shabalin 0.8.0-alt1 +- 0.8.0 + +* Mon Mar 21 2011 Alexey Shabalin 0.6.3-alt1 +- initial build for ALT Linux Sisyphus diff --git a/spice-vdagentd.init-alt b/spice-vdagentd.init-alt new file mode 100644 index 0000000..5058771 --- /dev/null +++ b/spice-vdagentd.init-alt @@ -0,0 +1,95 @@ +#!/bin/sh +# +# spice-vdagentd Agent daemon for Spice guests +# +# chkconfig: 345 70 30 +# description: Together with a per X-session agent process the spice agent \ +# daemon enhances the spice guest user experience with client \ +# mouse mode, guest <-> client copy and paste support and more. + +### BEGIN INIT INFO +# Provides: spice-vdagentd +# Required-Start: $local_fs messagebus +# Required-Stop: $local_fs messagebus +# Should-Start: $local_fs messagebus +# Should-Stop: $local_fs messagebus +# Default-Start: 5 +# Default-Stop: 0 1 2 3 4 6 +# Short-Description: Agent daemon for Spice guests +# Description: Together with a per X-session agent process the spice agent +# daemon enhances the spice guest user experience with client +# mouse mode, guest <-> client copy and paste support and more. +### END INIT INFO + +# Do not load RH compatibility interface. +WITHOUT_RC_COMPAT=1 + +# Source function library. +. /etc/rc.d/init.d/functions + +EXEC=spice-vdagentd +PORT=/dev/virtio-ports/com.redhat.spice.0 +PIDFILE=/run/spice-vdagentd/spice-vdagentd.pid + +SourceIfNotEmpty /etc/sysconfig/$EXEC + +LOCKFILE=/run/lock/subsys/$EXEC +RETVAL=0 + +start() { + modprobe uinput > /dev/null 2>&1 + start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user root -- $EXEC $SPICE_VDAGENTD_EXTRA_ARGS + RETVAL=$? + return $RETVAL +} + +stop() { + stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user root -- $EXEC + RETVAL=$? + return $RETVAL +} + +restart() { + stop + start +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status --pidfile "$PIDFILE" --expect-user root -- $EXEC + RETVAL=$? + ;; + reload) + restart + ;; + restart) + restart + ;; + condstop) + if [ -e "$LOCKFILE" ]; then + stop + fi + ;; + condreload) + if [ -e "$LOCKFILE" ]; then + reload + fi + ;; + condrestart) + if [ -e "$LOCKFILE" ]; then + restart + fi + ;; + *) + msg_usage "${0##*/} {start|stop|status|reload|restart|condstop|condrestart|condreload}" + RETVAL=1 +esac + +exit $RETVAL diff --git a/src/vdagent/display.c b/src/vdagent/display.c index 790d9ad..602ab65 100644 --- a/src/vdagent/display.c +++ b/src/vdagent/display.c @@ -60,6 +60,7 @@ struct VDAgentDisplay { UdscsConnection *vdagentd; int debug; GIOChannel *x11_channel; + guint io_watch_source_id; VDAgentMutterDBus *mutter; }; @@ -296,7 +297,8 @@ VDAgentDisplay* vdagent_display_create(UdscsConnection *vdagentd, int debug, int return NULL; } - g_io_add_watch(display->x11_channel, G_IO_IN, x11_io_channel_cb, display); + display->io_watch_source_id = + g_io_add_watch(display->x11_channel, G_IO_IN, x11_io_channel_cb, display); /* Since we are started at the same time as the wm, @@ -323,7 +325,7 @@ void vdagent_display_destroy(VDAgentDisplay *display, int vdagentd_disconnected) return; } - + g_source_remove(display->io_watch_source_id); g_clear_pointer(&display->x11_channel, g_io_channel_unref); vdagent_x11_destroy(display->x11, vdagentd_disconnected);