[Spice-devel] [PATCH spice-streaming-agent v4] Install udev rule
Frediano Ziglio
fziglio at redhat.com
Fri Jun 1 08:48:30 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 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 | 6 ++++++
configure.ac | 9 +++++++++
spice-streaming-agent.spec.in | 4 +++-
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 94ad7aa..a2da845 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,8 +15,14 @@ gdmautostart_DATA = $(builddir)/data/spice-streaming.desktop
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = spice-streaming-agent.pc
+AM_DISTCHECK_CONFIGURE_FLAGS = --with-udevrulesdir='$$(prefix)/$(UDEVRULESDIR)'
+
+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..8a7b7db 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,6 +53,15 @@ 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=`${PKG_CONFIG} --variable=udevdir udev 2> /dev/null`/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