Re: [PATCH kmod v2 4/4] libkmod, depmod, modprobe: Search for kernel modules under ${module_prefix}

From: Jan Engelhardt
Date: Fri Jul 14 2023 - 09:55:01 EST



On Wednesday 2023-07-12 16:00, Michal Suchanek wrote:

>modprobe.d is now searched under ${prefix}/lib, add ${module_prefix} to
>specify the directory where to search for kernel modules.
>
>With this distributions that do not want to ship files in /lib can also
>move kernel modules to /usr while others can keep them in /lib.

>+# Ideally this would be $prefix but default to empty for compatibility with earlier versions
>+AC_ARG_WITH([module_prefix],
>+ AS_HELP_STRING([--with-module-prefix=DIR], [directory in which to look for /lib/modules directory with kernel modules - typically '' or ${prefix}]),
>+ [], [with_module_prefix=])
>+AC_SUBST([module_prefix], [$with_module_prefix])

Why stop there, let's make it fully configurable such that

./configure --with-module-prefix=/usr/lib/modules

works. Then one can specify arbitrary paths without fearing of getting a
/lib/modules tacked on anywhere down the line.