[Spice-devel] [PATCH spice-streaming-agent v5] Install udev rule

Frediano Ziglio fziglio at redhat.com
Fri Jun 1 10:31:32 UTC 2018


The udev rule is used to do some action when the device is added to the
system. Current rule change the permission of the special file to allow to
open it by any user.
Some systems use /lib/udev while others use /usr/lib/udev.
Allow to specify the full path to support both type of systems.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
--
Changes since v4:
- remove AM_DISTCHECK_CONFIGURE_FLAGS "workaround";
- use prefix for default udev rules directory, this is similar to
  what LVM2 package is doing, use RPM to override with proper
  directory if needed;
- spec file was checking for _udevrulesdir existence in one place
  and not in another. Should be defined if we have pkgconfig(udev)
  dependency so assume it exists.

Changes since v3:
- fix make distcheck redirecting udev directory. distcheck uses
  --prefix which does not redirect system directories;
- do not use PKG_CHECK_VAR, not available in RHEL7 as requires
  pkg-config 0.28.
---
 Makefile.am                   | 4 ++++
 configure.ac                  | 7 +++++++
 spice-streaming-agent.spec.in | 4 +++-
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 94ad7aa..32fdaff 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,8 +15,12 @@ gdmautostart_DATA = $(builddir)/data/spice-streaming.desktop
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = spice-streaming-agent.pc
 
+udevrulesdir = $(UDEVRULESDIR)
+udevrules_DATA = $(srcdir)/data/90-spice-guest-streaming.rules
+
 EXTRA_DIST = \
 	spice-streaming-agent.spec \
 	spice-streaming-agent.pc \
+	data/90-spice-guest-streaming.rules \
 	data/spice-streaming.desktop \
 	$(NULL)
diff --git a/configure.ac b/configure.ac
index 407f17b..d8af9a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,6 +53,13 @@ PKG_CHECK_MODULES(JPEG, libjpeg, , [
 ])
 AC_SUBST(JPEG_LIBS)
 
+AC_ARG_WITH(udevrulesdir,
+    [AS_HELP_STRING([--with-udevrulesdir=DIR], [udev rules.d directory])],
+    [UDEVRULESDIR="$withval"],
+    [UDEVRULESDIR='${prefix}/lib/udev/rules.d']
+)
+AC_SUBST(UDEVRULESDIR)
+
 dnl ===========================================================================
 dnl check compiler flags
 
diff --git a/spice-streaming-agent.spec.in b/spice-streaming-agent.spec.in
index 132a851..843bf07 100644
--- a/spice-streaming-agent.spec.in
+++ b/spice-streaming-agent.spec.in
@@ -10,6 +10,7 @@ BuildRequires:  spice-protocol >= @SPICE_PROTOCOL_MIN_VER@
 BuildRequires:  libX11-devel libXfixes-devel
 BuildRequires:  libjpeg-turbo-devel
 BuildRequires:  catch-devel
+BuildRequires:  pkgconfig(udev)
 # we need /usr/sbin/semanage program which is available on different
 # packages depending on distribution
 Requires(post): /usr/sbin/semanage
@@ -31,7 +32,7 @@ agent plugins.
 %setup -q
 
 %build
-%configure --enable-tests
+%configure --enable-tests --with-udevrulesdir=%{_udevrulesdir}
 make %{?_smp_mflags} V=1
 
 %check
@@ -55,6 +56,7 @@ fi
 
 %files
 %doc COPYING ChangeLog README
+%{_udevrulesdir}/90-spice-guest-streaming.rules
 %{_bindir}/spice-streaming-agent
 %{_sysconfdir}/xdg/autostart/spice-streaming.desktop
 %{_datadir}/gdm/greeter/autostart/spice-streaming.desktop
-- 
2.17.0



More information about the Spice-devel mailing list