[packages/kmod] patch to load configs from depmod.d/<kernel version>

atler atler at pld-linux.org
Sun Mar 31 14:02:50 CEST 2019


commit 601b1eecd5ea50cf9e0c398c4b932fcf0ff95fc9
Author: Jan Palus <atler at pld-linux.org>
Date:   Sun Mar 31 14:01:12 2019 +0200

    patch to load configs from depmod.d/<kernel version>
    
    mimic same behavior as for modprobe.d

 kmod-depmod.d-kver.patch | 31 +++++++++++++++++++++++++++++++
 kmod.spec                |  2 ++
 2 files changed, 33 insertions(+)
---
diff --git a/kmod.spec b/kmod.spec
index 97ae95e..d6bb020 100644
--- a/kmod.spec
+++ b/kmod.spec
@@ -21,6 +21,7 @@ Source0:	https://www.kernel.org/pub/linux/utils/kernel/kmod/%{name}-%{version}.t
 Source1:	%{name}-blacklist
 Source2:	%{name}-usb
 Patch0:		%{name}-modprobe.d-kver.patch
+Patch1:		%{name}-depmod.d-kver.patch
 URL:		https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git
 BuildRequires:	autoconf >= 2.64
 BuildRequires:	automake >= 1:1.11
@@ -141,6 +142,7 @@ Wiązania Pythona 3 do API kmod.
 %prep
 %setup -q
 %patch0 -p1
+%patch1 -p1
 
 %build
 %{__libtoolize}
diff --git a/kmod-depmod.d-kver.patch b/kmod-depmod.d-kver.patch
new file mode 100644
index 0000000..1b25599
--- /dev/null
+++ b/kmod-depmod.d-kver.patch
@@ -0,0 +1,31 @@
+--- kmod-26/tools/depmod.c.orig	2019-03-31 13:50:56.277614760 +0200
++++ kmod-26/tools/depmod.c	2019-03-31 13:53:23.093456646 +0200
+@@ -50,7 +50,9 @@
+ 
+ static const char CFG_BUILTIN_KEY[] = "built-in";
+ static const char CFG_EXTERNAL_KEY[] = "external";
++static char kver_config_path[PATH_MAX] = SYSCONFDIR "/depmod.d/X.Y.Z";
+ static const char *default_cfg_paths[] = {
++	kver_config_path,
+ 	"/run/depmod.d",
+ 	SYSCONFDIR "/depmod.d",
+ 	"/lib/depmod.d",
+@@ -815,8 +817,16 @@
+ 	size_t i, n_files = 0;
+ 	struct cfg_file **files = NULL;
+ 
+-	if (cfg_paths == NULL)
+-		cfg_paths = default_cfg_paths;
++	if (cfg_paths == NULL) {
++		struct utsname u;
++
++		if (uname(&u) < 0) {
++			cfg_paths = &default_cfg_paths[1];
++		} else {
++			snprintf(kver_config_path, PATH_MAX, SYSCONFDIR "/depmod.d/%s", u.release);
++			cfg_paths = default_cfg_paths;
++		}
++	}
+ 
+ 	for (i = 0; cfg_paths[i] != NULL; i++)
+ 		cfg_files_list(&files, &n_files, cfg_paths[i]);
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/kmod.git/commitdiff/601b1eecd5ea50cf9e0c398c4b932fcf0ff95fc9



More information about the pld-cvs-commit mailing list