On Tue, Jun 11, 2024 at 04:05:17PM GMT, Emil Velikov via B4 Relay wrote:
From: Emil Velikov <emil.l.velikov@xxxxxxxxx> The environment variable alters the config file ordering, so mention it
nops, it's not about config.
in the man page. Signed-off-by: Emil Velikov <emil.l.velikov@xxxxxxxxx> --- Hi Lucas, Looking at modprobe(8), while the variable is mentioned there is no details about: - the format and it's stability across versions - is it ABI
yes
- is the same option (say config) allowed multiple times
this is not about config. This is about command line options. MODPROBE_OPTIONS="-R" modprobe ext4 is equivalent to: modprobe -R ext4 the format is as if you gave it as command line options, with a minimal of shlex parsing to allow quotes.
- if so, does the latest(?) instance override the previous ones, or - all instances are in effect, with the latest(?) having the highest priority
it depends on what arg you are passing. It's exactly the same as if you did: modprobe $MODPROBE_OPTIONS --foo --bar -x -y -z we will preprend MODPROBE_OPTIONS and expand it.
Can you shed some light? I'd be happy to put that in patch form :-)
yeah, it would be great to document it, although its use is kind of discouraged, together with the reason for it to exist, install rules. AFAIR the reason for it to exist is that when we have install rules, we will call system(install_rule). Once upon a time distros would do something like in their config: install foo modprobe bar || modprobe foo ... or to simulate pre/post softdep. Lucas De Marchi
Thanks Emil --- man/modprobe.d.5.scd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/man/modprobe.d.5.scd b/man/modprobe.d.5.scd index b300758..9d03c49 100644 --- a/man/modprobe.d.5.scd +++ b/man/modprobe.d.5.scd @@ -46,6 +46,10 @@ the SYNOPSIS section above. Files must have the ".conf" extension. Files in @DISTCONFDIR@/, and /lib/. Files in /run/ override files with the same name under /usr/, @DISTCONFDIR@/ and /lib/. +NOTE: Any configuration directories set via the MODPROBE_OPTIONS environment +variable are added with the top-most priority. See the ENVIRONMENT section in +*modprobe*(8). + All configuration files are sorted by their filename in lexicographic order, regardless of which of the directories they reside in. If multiple files specify the same option, the entry in the file with the lexicographically latest name -- 2.45.0