From 4d0fdc5e6bba1bd058bfb58ea11764e5cca9fb51 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Wed, 4 Apr 2012 19:24:07 +0000 Subject: [PATCH] kmod: respect MODULE_DIR svn path=/nixpkgs/trunk/; revision=33578 --- pkgs/os-specific/linux/kmod/default.nix | 2 ++ pkgs/os-specific/linux/kmod/module-dir.patch | 24 ++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 pkgs/os-specific/linux/kmod/module-dir.patch diff --git a/pkgs/os-specific/linux/kmod/default.nix b/pkgs/os-specific/linux/kmod/default.nix index c75b8bec146..32e4215d6c6 100644 --- a/pkgs/os-specific/linux/kmod/default.nix +++ b/pkgs/os-specific/linux/kmod/default.nix @@ -12,6 +12,8 @@ stdenv.mkDerivation { configureFlags = [ "--with-xz" "--with-zlib" ]; + patches = [ ./module-dir.patch ]; + meta = { homepage = http://www.kernel.org/pub/linux/utils/kernel/kmod/; description = "Tools for loading and managing Linux kernel modules"; diff --git a/pkgs/os-specific/linux/kmod/module-dir.patch b/pkgs/os-specific/linux/kmod/module-dir.patch new file mode 100644 index 00000000000..95d08da4580 --- /dev/null +++ b/pkgs/os-specific/linux/kmod/module-dir.patch @@ -0,0 +1,24 @@ +diff -Naur kmod-7-orig/libkmod/libkmod.c kmod-7/libkmod/libkmod.c +--- kmod-7-orig/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("MODULE_DIR")) == NULL) ++ dirname_prefix = dirname_default_prefix; ++ ++ if (asprintf(&p, "%s/%s", dirname_prefix, u.release) < 0) + return NULL; + + return p;