diff --git a/.spice-vdagent.metadata b/.spice-vdagent.metadata new file mode 100644 index 0000000..6c42438 --- /dev/null +++ b/.spice-vdagent.metadata @@ -0,0 +1 @@ +2b1e913251906087cf85389051801377f38a62a3 SOURCES/spice-vdagent-0.14.0.tar.bz2 diff --git a/README.md b/README.md deleted file mode 100644 index 0e7897f..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 - -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/0001-vdagent-d-Add-printing-of-version-to-h-output.patch b/SOURCES/0001-vdagent-d-Add-printing-of-version-to-h-output.patch new file mode 100644 index 0000000..211c0fc --- /dev/null +++ b/SOURCES/0001-vdagent-d-Add-printing-of-version-to-h-output.patch @@ -0,0 +1,60 @@ +From 256e01c8c7b0c386525a0fac71537bb7bb05d271 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 6 Jun 2013 17:00:22 +0200 +Subject: [linux-vdagent PATCH 1/3] vdagent[d]: Add printing of version to -h + output + +Signed-off-by: Hans de Goede +--- + src/vdagent.c | 6 +++--- + src/vdagentd.c | 4 ++-- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/vdagent.c b/src/vdagent.c +index 7e1b474..9e238d3 100644 +--- a/src/vdagent.c ++++ b/src/vdagent.c +@@ -132,15 +132,15 @@ static void usage(FILE *fp) + { + fprintf(fp, + "Usage: spice-vdagent [OPTIONS]\n\n" +- "Spice guest agent X11 session agent.\n\n" ++ "Spice guest agent X11 session agent, version %s.\n\n" + "Options:\n" + " -h print this text\n" + " -d log debug messages\n" + " -s set virtio serial port\n" + " -x don't daemonize\n" + " -f file xfer save dir\n" +- " -o <0|1> open dir on file xfer completion\n" +- ); ++ " -o <0|1> open dir on file xfer completion\n", ++ VERSION); + } + + static void quit_handler(int sig) +diff --git a/src/vdagentd.c b/src/vdagentd.c +index 888a80a..da25329 100644 +--- a/src/vdagentd.c ++++ b/src/vdagentd.c +@@ -718,7 +718,7 @@ static void usage(FILE *fp) + { + fprintf(fp, + "Usage: spice-vdagentd [OPTIONS]\n\n" +- "Spice guest agent daemon.\n\n" ++ "Spice guest agent daemon, version %s.\n\n" + "Options:\n" + " -h print this text\n" + " -d log debug messages (use twice for extra info)\n" +@@ -731,7 +731,7 @@ static void usage(FILE *fp) + #ifdef HAVE_LIBSYSTEMD_LOGIN + " -X Disable systemd-logind integration\n" + #endif +- ,portdev, uinput_device); ++ ,VERSION, portdev, uinput_device); + } + + void daemonize(void) +-- +1.8.3.1 + diff --git a/SOURCES/0002-vdagentd-Advertise-VD_AGENT_CAP_GUEST_LINEEND_LF.patch b/SOURCES/0002-vdagentd-Advertise-VD_AGENT_CAP_GUEST_LINEEND_LF.patch new file mode 100644 index 0000000..da04db7 --- /dev/null +++ b/SOURCES/0002-vdagentd-Advertise-VD_AGENT_CAP_GUEST_LINEEND_LF.patch @@ -0,0 +1,26 @@ +From 43cde1cbedc56138a857100f634e7cb644477e7e Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Mon, 24 Jun 2013 10:34:27 +0200 +Subject: [linux-vdagent PATCH 2/3] vdagentd: Advertise + VD_AGENT_CAP_GUEST_LINEEND_LF + +Signed-off-by: Hans de Goede +--- + src/vdagentd.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/vdagentd.c b/src/vdagentd.c +index da25329..f4cea44 100644 +--- a/src/vdagentd.c ++++ b/src/vdagentd.c +@@ -95,6 +95,7 @@ static void send_capabilities(struct vdagent_virtio_port *vport, + VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND); + VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_CLIPBOARD_SELECTION); + VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_SPARSE_MONITORS_CONFIG); ++ VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_GUEST_LINEEND_LF); + + vdagent_virtio_port_write(vport, VDP_CLIENT_PORT, + VD_AGENT_ANNOUNCE_CAPABILITIES, 0, +-- +1.8.3.1 + diff --git a/SOURCES/0003-buildsys-Build-vdagentd-as-pie-relro-when-possible.patch b/SOURCES/0003-buildsys-Build-vdagentd-as-pie-relro-when-possible.patch new file mode 100644 index 0000000..9c38452 --- /dev/null +++ b/SOURCES/0003-buildsys-Build-vdagentd-as-pie-relro-when-possible.patch @@ -0,0 +1,82 @@ +From 71b8e75c6f1bc6c482d28cf29b82643d6b38cf34 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 3 Jul 2013 11:16:20 +0200 +Subject: [linux-vdagent PATCH 3/3] buildsys: Build vdagentd as pie + relro + when possible + +Signed-off-by: Hans de Goede +--- + Makefile.am | 6 ++++-- + configure.ac | 32 ++++++++++++++++++++++++++++++++ + 2 files changed, 36 insertions(+), 2 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index fa2803a..74cc313 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -8,8 +8,10 @@ src_spice_vdagent_CFLAGS = $(X_CFLAGS) $(SPICE_CFLAGS) $(GLIB2_CFLAGS) + src_spice_vdagent_LDADD = $(X_LIBS) $(SPICE_LIBS) $(GLIB2_LIBS) + src_spice_vdagent_SOURCES = src/vdagent.c src/vdagent-x11.c src/vdagent-x11-randr.c src/vdagent-file-xfers.c src/udscs.c + +-src_spice_vdagentd_CFLAGS = $(DBUS_CFLAGS) $(LIBSYSTEMD_LOGIN_CFLAGS) $(PCIACCESS_CFLAGS) $(SPICE_CFLAGS) $(GLIB2_CFLAGS) +-src_spice_vdagentd_LDADD = $(DBUS_LIBS) $(LIBSYSTEMD_LOGIN_LIBS) $(PCIACCESS_LIBS) $(SPICE_LIBS) $(GLIB2_LIBS) ++src_spice_vdagentd_CFLAGS = $(DBUS_CFLAGS) $(LIBSYSTEMD_LOGIN_CFLAGS) \ ++ $(PCIACCESS_CFLAGS) $(SPICE_CFLAGS) $(GLIB2_CFLAGS) $(PIE_CFLAGS) ++src_spice_vdagentd_LDADD = $(DBUS_LIBS) $(LIBSYSTEMD_LOGIN_LIBS) \ ++ $(PCIACCESS_LIBS) $(SPICE_LIBS) $(GLIB2_LIBS) $(PIE_LDFLAGS) + src_spice_vdagentd_SOURCES = src/vdagentd.c \ + src/vdagentd-uinput.c \ + src/vdagentd-xorg-conf.c \ +diff --git a/configure.ac b/configure.ac +index 91a24ff..a1ce6c0 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -141,6 +141,37 @@ if test "$ac_test_CFLAGS" != set; then + done + fi + ++AC_ARG_ENABLE([pie], ++ AS_HELP_STRING([--enable-pie=@<:@auto/yes/no@:>@], ++ [Enable position-independent-executable support (for spice-vdagentd)@<:@default=auto@:>@]), ++ [], ++ [enable_pie="auto"]) ++ ++if test "x$enable_pie" != "xno"; then ++ save_CFLAGS="$CFLAGS" ++ save_LDFLAGS="$LDFLAGS" ++ CFLAGS="$CFLAGS -fPIE" ++ LDFLAGS="$LDFLAGS -pie -Wl,-z,relro -Wl,-z,now" ++ AC_MSG_CHECKING([for PIE support]) ++ AC_LINK_IFELSE([AC_LANG_SOURCE([int main () { return 0; }])], ++ [have_pie=yes], ++ [have_pie=no]) ++ AC_MSG_RESULT([$have_pie]) ++ if test "x$have_pie" = "xno" && test "x$enable_pie" = "xyes"; then ++ AC_MSG_ERROR([pie support explicitly requested, but your toolchain does not support it]) ++ fi ++ if test "x$have_pie" = "xyes"; then ++ PIE_CFLAGS="-fPIE" ++ PIE_LDFLAGS="-pie -Wl,-z,relro -Wl,-z,now" ++ AC_SUBST(PIE_CFLAGS) ++ AC_SUBST(PIE_LDFLAGS) ++ fi ++ CFLAGS="$save_CFLAGS" ++ LDFLAGS="$save_LDFLAGS" ++else ++ have_pie=no ++fi ++ + AC_CONFIG_FILES([ + Makefile + data/spice-vdagent.1 +@@ -160,6 +191,7 @@ AC_MSG_NOTICE([ + session-info: ${with_session_info} + pciaccess: ${enable_pciaccess} + static uinput: ${enable_static_uinput} ++ vdagentd pie + relro: ${have_pie} + + install RH initscript: ${init_redhat} + install systemd service: ${init_systemd} +-- +1.8.3.1 + diff --git a/SOURCES/0004-Not-having-the-virtio-channel-is-not-an-error-instea.patch b/SOURCES/0004-Not-having-the-virtio-channel-is-not-an-error-instea.patch new file mode 100644 index 0000000..c72822d --- /dev/null +++ b/SOURCES/0004-Not-having-the-virtio-channel-is-not-an-error-instea.patch @@ -0,0 +1,43 @@ +From 99a2628b0ff04e0aadd130e45aa2598c4df64690 Mon Sep 17 00:00:00 2001 +From: Colin Walters +Date: Tue, 11 Jun 2013 15:21:13 -0400 +Subject: [linux-vdagent PATCH 04/12] Not having the virtio channel is not an + error; instead silently do nothing + +Fedora for example bundles the SPICE agent by default; however, we +don't want to spew an error when running non-virtualized, or with +plain VNC. + +Let's just silently exit; while we could change LOG_ERR -> LOG_INFO +or something, that's still pointless noise in most people's syslog. + +Someone who was debugging a misconfigured SPICE setup would pretty +quickly notice that they were missing the virtio port. + +(This patch is part of a larger initiative to reduce error + spew on default startup in common deployment scenarios such as + KVM+VNC.) + +Signed-off-by: Hans de Goede +--- + src/vdagent.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/src/vdagent.c b/src/vdagent.c +index 9e238d3..10ebf6e 100644 +--- a/src/vdagent.c ++++ b/src/vdagent.c +@@ -226,9 +226,7 @@ int main(int argc, char *argv[]) + LOG_USER); + + if (file_test(portdev) != 0) { +- syslog(LOG_ERR, "Missing virtio device '%s': %s", +- portdev, strerror(errno)); +- return 1; ++ return 0; + } + + if (do_daemonize) +-- +1.8.3.1 + diff --git a/SOURCES/0005-vdagent-x11-Release-clipboard-on-client-disconnect-i.patch b/SOURCES/0005-vdagent-x11-Release-clipboard-on-client-disconnect-i.patch new file mode 100644 index 0000000..8ef6b7b --- /dev/null +++ b/SOURCES/0005-vdagent-x11-Release-clipboard-on-client-disconnect-i.patch @@ -0,0 +1,64 @@ +From ad6ea7594a11d8a35be84a8ae2e8403ea3344a3b Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Mon, 9 Sep 2013 15:50:39 +0200 +Subject: [linux-vdagent PATCH 5/5] vdagent-x11: Release clipboard on client + disconnect if owned by client + +https://bugzilla.redhat.com/show_bug.cgi?id=1003977 + +Signed-off-by: Hans de Goede +--- + src/vdagent-x11.c | 10 ++++++++++ + src/vdagent-x11.h | 2 ++ + src/vdagent.c | 1 + + 3 files changed, 13 insertions(+) + +diff --git a/src/vdagent-x11.c b/src/vdagent-x11.c +index 4588b3d..5ce6000 100644 +--- a/src/vdagent-x11.c ++++ b/src/vdagent-x11.c +@@ -1305,6 +1305,16 @@ void vdagent_x11_clipboard_release(struct vdagent_x11 *x11, uint8_t selection) + vdagent_x11_do_read(x11); + } + ++void vdagent_x11_client_disconnected(struct vdagent_x11 *x11) ++{ ++ int sel; ++ ++ for (sel = 0; sel < VD_AGENT_CLIPBOARD_SELECTION_SECONDARY; sel++) { ++ if (x11->clipboard_owner[sel] == owner_client) ++ vdagent_x11_clipboard_release(x11, sel); ++ } ++} ++ + /* Function used to determine the default location to save file-xfers, + xdg desktop dir or xdg download dir. We error on the save side and use a + whitelist approach, so any unknown desktops will end up with saving +diff --git a/src/vdagent-x11.h b/src/vdagent-x11.h +index a2a2485..d64a42a 100644 +--- a/src/vdagent-x11.h ++++ b/src/vdagent-x11.h +@@ -46,6 +46,8 @@ void vdagent_x11_clipboard_data(struct vdagent_x11 *x11, uint8_t selection, + uint32_t type, uint8_t *data, uint32_t size); + void vdagent_x11_clipboard_release(struct vdagent_x11 *x11, uint8_t selection); + ++void vdagent_x11_client_disconnected(struct vdagent_x11 *x11); ++ + int vdagent_x11_has_icons_on_desktop(struct vdagent_x11 *x11); + + #endif +diff --git a/src/vdagent.c b/src/vdagent.c +index f270615..d7f7aba 100644 +--- a/src/vdagent.c ++++ b/src/vdagent.c +@@ -104,6 +104,7 @@ void daemon_read_complete(struct udscs_connection **connp, + free(data); + break; + case VDAGENTD_CLIENT_DISCONNECTED: ++ vdagent_x11_client_disconnected(x11); + vdagent_file_xfers_destroy(vdagent_file_xfers); + vdagent_file_xfers = vdagent_file_xfers_create(client, fx_dir, + fx_open_dir, debug); +-- +1.8.3.1 + diff --git a/SPECS/spice-vdagent.spec b/SPECS/spice-vdagent.spec new file mode 100644 index 0000000..b30a7bc --- /dev/null +++ b/SPECS/spice-vdagent.spec @@ -0,0 +1,158 @@ +Name: spice-vdagent +Version: 0.14.0 +Release: 5%{?dist} +Summary: Agent for Spice guests +Group: Applications/System +License: GPLv3+ +URL: http://spice-space.org/ +Source0: http://spice-space.org/download/releases/%{name}-%{version}.tar.bz2 +# Fixes from upstream git +Patch1: 0001-vdagent-d-Add-printing-of-version-to-h-output.patch +Patch2: 0002-vdagentd-Advertise-VD_AGENT_CAP_GUEST_LINEEND_LF.patch +Patch3: 0003-buildsys-Build-vdagentd-as-pie-relro-when-possible.patch +Patch4: 0004-Not-having-the-virtio-channel-is-not-an-error-instea.patch +Patch5: 0005-vdagent-x11-Release-clipboard-on-client-disconnect-i.patch +BuildRequires: systemd-devel glib2-devel spice-protocol >= 0.12.6 +BuildRequires: libpciaccess-devel libXrandr-devel libXinerama-devel +BuildRequires: libXfixes-devel systemd-units desktop-file-utils libtool +Requires(post): systemd-units +Requires(preun): systemd-units +Requires(postun): systemd-units + +%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 -q +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +autoreconf -fi + + +%build +%configure --with-session-info=systemd --with-init-script=systemd +make %{?_smp_mflags} V=2 + + +%install +make install DESTDIR=$RPM_BUILD_ROOT V=2 +# rhbz#963201 +rm $RPM_BUILD_ROOT%{_sysconfdir}/modules-load.d/spice-vdagentd.conf + + +%post +%systemd_post spice-vdagentd.service + +%preun +%systemd_preun spice-vdagentd.service + +%postun +%systemd_postun_with_restart spice-vdagentd.service + + +%files +%doc COPYING ChangeLog README TODO +%config(noreplace) %{_sysconfdir}/rsyslog.d/spice-vdagentd.conf +/lib/udev/rules.d/70-spice-vdagentd.rules +%{_unitdir}/spice-vdagentd.service +%{_unitdir}/spice-vdagentd.target +%{_prefix}/lib/tmpfiles.d/spice-vdagentd.conf +%{_bindir}/spice-vdagent +%{_sbindir}/spice-vdagentd +%{_var}/run/spice-vdagentd +%{_sysconfdir}/xdg/autostart/spice-vdagent.desktop +# For /usr/share/gdm/autostart/LoginWindow/spice-vdagent.desktop +# We own the dir too, otherwise we must Require gdm +%{_datadir}/gdm +%{_mandir}/man1/%{name}*.1* + + +%changelog +* Tue Sep 10 2013 Hans de Goede - 0.14.0-5 +- Silence session agent error logging when not running in a vm (rhbz#999804) +- Release guest clipboard ownership on client disconnect (rhbz#1003977) + +* Sun Aug 04 2013 Fedora Release Engineering - 0.14.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Wed Jul 3 2013 Hans de Goede - 0.14.0-3 +- Advertise clipboard line-endings for copy and paste line-ending conversion +- Build spice-vdagentd as pie + relro + +* Mon May 20 2013 Hans de Goede - 0.14.0-2 +- Drop the no longer needed /etc/modules-load.d/spice-vdagentd.conf (#963201) + +* Fri Apr 12 2013 Hans de Goede - 0.14.0-1 +- New upstream release 0.14.0 +- Adds support for file transfers from client to guest +- Adds manpages for spice-vdagent and spice-vdagentd + +* Fri Feb 15 2013 Fedora Release Engineering - 0.12.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Tue Jan 8 2013 Hans de Goede - 0.12.1-1 +- New upstream release 0.12.1 +- Fixes various issues with dynamic monitor / resolution support + +* Mon Nov 12 2012 Hans de Goede - 0.12.0-2 +- Fix setting of mode on non arbitrary resolution capable X driver +- Fix wrong mouse coordinates on vms with multiple qxl devices + +* Sat Sep 1 2012 Hans de Goede - 0.12.0-1 +- New upstream release 0.12.0 +- This moves the tmpfiles.d to /usr/lib/tmpfiles.d (rhbz#840194) +- This adds a systemd .service file (rhbz#848102) + +* Sat Jul 21 2012 Fedora Release Engineering - 0.10.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Tue Mar 27 2012 Hans de Goede - 0.10.1-1 +- New upstream release 0.10.1 + +* Thu Mar 22 2012 Hans de Goede - 0.10.0-1 +- New upstream release 0.10.0 +- This supports using systemd-logind instead of console-kit (rhbz#756398) + +* Sat Jan 14 2012 Fedora Release Engineering - 0.8.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Mon Jul 18 2011 Hans de Goede 0.8.1-1 +- New upstream release 0.8.1 + +* Fri Jul 15 2011 Hans de Goede 0.8.0-2 +- Make the per session agent process automatically reconnect to the system + spice-vdagentd when the system daemon gets restarted + +* Tue Apr 19 2011 Hans de Goede 0.8.0-1 +- New upstream release 0.8.0 + +* Mon Mar 07 2011 Hans de Goede 0.6.3-6 +- Fix setting of the guest resolution from a multi monitor client + +* Wed Feb 09 2011 Fedora Release Engineering - 0.6.3-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Mon Jan 10 2011 Hans de Goede 0.6.3-4 +- Make sysvinit script exit cleanly when not running on a spice enabled vm + +* Fri Nov 19 2010 Hans de Goede 0.6.3-3 +- Put the pid and log files into their own subdir (#648553) + +* Mon Nov 8 2010 Hans de Goede 0.6.3-2 +- Fix broken multiline description in initscript lsb header (#648549) + +* Sat Oct 30 2010 Hans de Goede 0.6.3-1 +- Initial Fedora package