diff mbox series

[kmod,11/20] man: depmod.d: document the config file order handling

Message ID 20240611-man-v1-11-bd6864d49639@gmail.com (mailing list archive)
State Handled Elsewhere
Headers show
Series man: convert to scdoc and minor improvements | expand

Commit Message

Emil Velikov via B4 Relay June 11, 2024, 3:05 p.m. UTC
From: Emil Velikov <emil.l.velikov@gmail.com>

The depmod.d configuration order/handling aligns with existing tools
such as sysctl.d, even though there is no mention in the manual.

Reorder the list in SYNOPSIS and add a bit of verbiage describing things.

Section is copied^Winspired by sysctl.d(5) ;-)

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
---
 man/Makefile.am    |  1 +
 man/depmod.d.5.scd | 22 ++++++++++++++++++----
 2 files changed, 19 insertions(+), 4 deletions(-)

Comments

Lucas De Marchi June 29, 2024, 5:26 p.m. UTC | #1
On Tue, Jun 11, 2024 at 04:05:11PM GMT, Emil Velikov via B4 Relay wrote:
>From: Emil Velikov <emil.l.velikov@gmail.com>
>
>The depmod.d configuration order/handling aligns with existing tools
>such as sysctl.d, even though there is no mention in the manual.
>
>Reorder the list in SYNOPSIS and add a bit of verbiage describing things.
>
>Section is copied^Winspired by sysctl.d(5) ;-)
>
>Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
>---
> man/Makefile.am    |  1 +
> man/depmod.d.5.scd | 22 ++++++++++++++++++----
> 2 files changed, 19 insertions(+), 4 deletions(-)
>
>diff --git a/man/Makefile.am b/man/Makefile.am
>index 25135e9..181f619 100644
>--- a/man/Makefile.am
>+++ b/man/Makefile.am
>@@ -15,6 +15,7 @@ CLEANFILES = $(dist_man_MANS)
>
> define generate_manpage
> 	$(AM_V_SCDOC)cat $< | \
>+	sed -e 's|@SYSCONFDIR@|$(sysconfdir)|g' | \
> 	sed -e 's|@DISTCONFDIR@|$(distconfdir)|g' | \
> 	sed -e 's|@MODULE_DIRECTORY@|$(module_directory)|g' | \
> 	$(SCDOC) > $@
>diff --git a/man/depmod.d.5.scd b/man/depmod.d.5.scd
>index 9cf99d5..9ee35e8 100644
>--- a/man/depmod.d.5.scd
>+++ b/man/depmod.d.5.scd
>@@ -6,15 +6,15 @@ depmod.d - Configuration directory for depmod
>
> # SYNOPSIS
>
>-/lib/depmod.d/\*.conf
>+@SYSCONFDIR@/depmod.d/\*.conf
>
>-@DISTCONFDIR@/depmod.d/\*.conf
>+/run/depmod.d/\*.conf
>
> /usr/local/lib/depmod.d/\*.conf
>
>-/run/depmod.d/\*.conf
>+@DISTCONFDIR@/depmod.d/\*.conf
>
>-/etc/depmod.d/\*.conf
>+/lib/depmod.d/\*.conf
>
> # DESCRIPTION
>
>@@ -29,6 +29,20 @@ lines and lines starting with '#' ignored (useful for adding comments). A '\\'
> at the end of a line causes it to continue on the next line, which makes the
> files a bit neater.
>
>+# CONFIGURATION DIRECTORIES AND PRECEDENCE
>+
>+Configuration files are read from directories in @SYSCONFDIR@/, /run/,
>+/usr/local/lib/, @DISTCONFDIR@/, and /lib/ in order of precedence, as listed in
>+the SYNOPSIS section above. Files must have the ".conf" extension. Files in
>+@SYSCONFDIR@/ override files with the same name in /run/, /usr/local/lib/,

ok until here.

>+@DISTCONFDIR@/, and /lib/. Files in /run/ override files with the same name
>+under /usr/, @DISTCONFDIR@/ and /lib/.

I actually find this odd. Why mention /run overriding /usr/ (that
was not mentioneed before), and not mention the other overrides?

>+
>+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
>+will take precedence.

Looking at sysctl(8) and systemd-system.conf for inspiration, I'd write
something like:

	# CONFIGURATION DIRECTORIES AND PRECEDENCE

	Configuration files are read from directories in listed in SYNOPSYS in
	that order of precedence. Once a file of a given filename is loaded, any
	file of the same name in subsequent directories is ignored.

	All configuration files are sorted in lexicographic order, regardless of
	the directory they reside in. Configuration files can either be
	completely replaced (by having a new configuration file with the same
	name in a directory of higher priority) or partially replaced (by having
	a configuration file that is ordered later).

... or maybe also repeat the list of files like sysctl does to have it
all in one place.


thanks
Lucas De Marchi

>+
> # COMMANDS
>
> search _subdirectory..._
>
>-- 
>2.45.0
>
>
diff mbox series

Patch

diff --git a/man/Makefile.am b/man/Makefile.am
index 25135e9..181f619 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -15,6 +15,7 @@  CLEANFILES = $(dist_man_MANS)
 
 define generate_manpage
 	$(AM_V_SCDOC)cat $< | \
+	sed -e 's|@SYSCONFDIR@|$(sysconfdir)|g' | \
 	sed -e 's|@DISTCONFDIR@|$(distconfdir)|g' | \
 	sed -e 's|@MODULE_DIRECTORY@|$(module_directory)|g' | \
 	$(SCDOC) > $@
diff --git a/man/depmod.d.5.scd b/man/depmod.d.5.scd
index 9cf99d5..9ee35e8 100644
--- a/man/depmod.d.5.scd
+++ b/man/depmod.d.5.scd
@@ -6,15 +6,15 @@  depmod.d - Configuration directory for depmod
 
 # SYNOPSIS
 
-/lib/depmod.d/\*.conf
+@SYSCONFDIR@/depmod.d/\*.conf
 
-@DISTCONFDIR@/depmod.d/\*.conf
+/run/depmod.d/\*.conf
 
 /usr/local/lib/depmod.d/\*.conf
 
-/run/depmod.d/\*.conf
+@DISTCONFDIR@/depmod.d/\*.conf
 
-/etc/depmod.d/\*.conf
+/lib/depmod.d/\*.conf
 
 # DESCRIPTION
 
@@ -29,6 +29,20 @@  lines and lines starting with '#' ignored (useful for adding comments). A '\\'
 at the end of a line causes it to continue on the next line, which makes the
 files a bit neater.
 
+# CONFIGURATION DIRECTORIES AND PRECEDENCE
+
+Configuration files are read from directories in @SYSCONFDIR@/, /run/,
+/usr/local/lib/, @DISTCONFDIR@/, and /lib/ in order of precedence, as listed in
+the SYNOPSIS section above. Files must have the ".conf" extension. Files in
+@SYSCONFDIR@/ override files with the same name in /run/, /usr/local/lib/,
+@DISTCONFDIR@/, and /lib/. Files in /run/ override files with the same name
+under /usr/, @DISTCONFDIR@/ and /lib/.
+
+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
+will take precedence.
+
 # COMMANDS
 
 search _subdirectory..._