[Spice-devel] [PATCH spice-streaming-agent v2 1/5] Install udev rule

Frediano Ziglio fziglio at redhat.com
Mon May 21 10:45:27 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>
---
 Makefile.am                   | 4 ++++
 configure.ac                  | 7 +++++++
 spice-streaming-agent.spec.in | 5 ++++-
 3 files changed, 15 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 699dc3b..fe1bb41 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,6 +52,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=/usr/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..d9323bb 100644
--- a/spice-streaming-agent.spec.in
+++ b/spice-streaming-agent.spec.in
@@ -1,3 +1,5 @@
+%{!?_udevrulesdir:%define _udevrulesdir /usr/lib/udev/rules.d}
+
 Name:           spice-streaming-agent
 Version:        @VERSION@
 Release:        1%{?dist}
@@ -31,7 +33,7 @@ agent plugins.
 %setup -q
 
 %build
-%configure --enable-tests
+%configure --enable-tests --with-udevrulesdir=%{_udevrulesdir}
 make %{?_smp_mflags} V=1
 
 %check
@@ -55,6 +57,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