summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-06-22 21:14:23 +0200
committerLudovic Courtès <ludo@gnu.org>2014-06-22 21:14:23 +0200
commit528b6a3dcea1edab7a8d1ce62a616a0ff6c8c597 (patch)
tree18e11dbb4fa12fe28811c3b904a133abdc470510
parentd7d42d6b242518b5bc664d7e2644a2a78d15225a (diff)
downloadguix-528b6a3dcea1edab7a8d1ce62a616a0ff6c8c597.tar.gz
gnu: kmod: Honor $LINUX_MODULE_DIRECTORY.
* gnu/packages/patches/kmod-module-directory.patch: New file.
* gnu-system.am (dist_patch_DATA): Add it.
* gnu/packages/linux.scm (kmod)[origin]: Use it.
-rw-r--r--gnu-system.am1
-rw-r--r--gnu/packages/linux.scm3
-rw-r--r--gnu/packages/patches/kmod-module-directory.patch31
3 files changed, 34 insertions, 1 deletions
diff --git a/gnu-system.am b/gnu-system.am
index eb3c55d180..3c057b36d8 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -318,6 +318,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/hop-bigloo-4.0b.patch			\
   gnu/packages/patches/icu4c-test-date-format.patch		\
   gnu/packages/patches/inkscape-stray-comma.patch               \
+  gnu/packages/patches/kmod-module-directory.patch		\
   gnu/packages/patches/libevent-dns-tests.patch			\
   gnu/packages/patches/libffi-mips-n32-fix.patch		\
   gnu/packages/patches/liboop-mips64-deplibs-fix.patch		\
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 9c5d59ce70..841ec581d9 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -1204,7 +1204,8 @@ to use Linux' inotify mechanism, which allows file accesses to be monitored.")
                               "kmod-" version ".tar.xz"))
               (sha256
                (base32
-                "1yid3a9b64a60ybj66fk2ysrq5klnl0ijl4g624cl16y8404g9rv"))))
+                "1yid3a9b64a60ybj66fk2ysrq5klnl0ijl4g624cl16y8404g9rv"))
+              (patches (list (search-patch "kmod-module-directory.patch")))))
     (build-system gnu-build-system)
     (native-inputs
      `(("pkg-config" ,pkg-config)))
diff --git a/gnu/packages/patches/kmod-module-directory.patch b/gnu/packages/patches/kmod-module-directory.patch
new file mode 100644
index 0000000000..b4b1a3b3db
--- /dev/null
+++ b/gnu/packages/patches/kmod-module-directory.patch
@@ -0,0 +1,31 @@
+This patch changes libkmod so it honors the 'LINUX_MODULE_DIRECTORY'
+environment variable, rather than looking for modules exclusively in
+/lib/modules.
+
+Patch by Shea Levy, from Nixpkgs; adjusted to use 'LINUX_MODULE_DIRECTORY'
+rather than 'MODULE_DIR' as the variable name.
+
+
+--- kmod-7/libkmod/libkmod.c	2012-03-15 08:19:16.750010226 -0400
++++ kmod-7/libkmod/libkmod.c	2012-04-04 15:21:29.532074313 -0400
+@@ -200,7 +200,7 @@
+ static char *get_kernel_release(const char *dirname)
+ {
+ 	struct utsname u;
+-	char *p;
++	char *p, *dirname_prefix;
+ 
+ 	if (dirname != NULL)
+ 		return path_make_absolute_cwd(dirname);
+@@ -208,7 +208,10 @@
+ 	if (uname(&u) < 0)
+ 		return NULL;
+ 
+-	if (asprintf(&p, "%s/%s", dirname_default_prefix, u.release) < 0)
++	if ((dirname_prefix = getenv("LINUX_MODULE_DIRECTORY")) == NULL)
++		dirname_prefix = dirname_default_prefix;
++
++	if (asprintf(&p, "%s/%s", dirname_prefix, u.release) < 0)
+ 		return NULL;
+ 
+ 	return p;