[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [libosinfo] Better udev rule installation



From: "Zeeshan Ali (Khattak)" <zeeshanak gnome org>

Provide a configure option to set the udev rule directory. If this
option is not set, udev directory defaults to '$prefix/lib/udev/rules.d'
unless $prefix is '/usr' in which case it defaults to '/lib/udev/rules.d'.
---
 configure.ac     |   14 ++++++++++++++
 data/Makefile.am |    6 ++----
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 390e053..76598a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -98,6 +98,20 @@ AC_ARG_ENABLE([udev],
         [], [enable_udev=no])
 AM_CONDITIONAL([WITH_UDEV], [test "x$enable_udev" = "xyes"])
 
+AC_ARG_WITH([udev-rulesdir],
+             [AS_HELP_STRING([--with-udev-rulesdir],[UDev rules directory])],
+             [], [])
+
+if test "x$with_udev_rulesdir" = "x"; then
+        if test "x$prefix" = "x/usr" ; then
+                with_udev_rulesdir=/lib/udev/rules.d
+        else
+                with_udev_rulesdir=$prefix/lib/udev/rules.d
+        fi
+fi
+
+AC_SUBST(with_udev_rulesdir)
+
 AC_ARG_ENABLE([coverage],
         AS_HELP_STRING([--enable-coverage], [enable GCC code coverage]),
         [], [enable_coverage=no])
diff --git a/data/Makefile.am b/data/Makefile.am
index ca93b62..3ef365b 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -12,11 +12,9 @@ BUILT_SOURCES = 95-osinfo.rules
 95-osinfo.rules: 95-osinfo.rules.in
 	sed 's,\ bindir\@,$(exec_prefix)/bin,' $< > $@
 
-# Now copy the rules file to where it needs to be but don't worry if it fails
-# since it can easily fail (e.g if `make install` is run unprivileged) and its
-# not a big deal if it does.
 install-data-hook: 95-osinfo.rules
-	-cp 95-osinfo.rules $(DESTDIR)/lib/udev/rules.d/
+	mkdir -p $(DESTDIR)$(with_udev_rulesdir)
+	$(INSTALL) -m 0644 95-osinfo.rules $(DESTDIR)$(with_udev_rulesdir)
 
 endif
 
-- 
1.7.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]