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

Frediano Ziglio fziglio at redhat.com
Wed May 23 09:03:53 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                  | 10 ++++++++++
 spice-streaming-agent.spec.in |  4 +++-
 3 files changed, 17 insertions(+), 1 deletion(-)

Changes since v2:
- use pkg-config to get default udev directory

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..9e3dd5a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,6 +52,16 @@ 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"],
+    [PKG_CHECK_VAR([UDEVRULESDIR], [udev], [udevdir],
+        [UDEVRULESDIR="$UDEVRULESDIR/rules.d"],
+        [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..6e221ac 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 %{?_udevrulesdir:--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