man: document that $XDG_CONFIG_HOME affects environment.d lookup path

Align the documentation with the actual behavior: if $XDG_CONFIG_HOME is
set to an absolute path in the user service manager environment, it takes
precedence over the default ~/.config/ when locating environment.d files.
Also note the bootstrapping limitation that variables defined inside
environment.d files are not yet available when the generator runs.

Fixes: #42777
Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
This commit is contained in:
dongshengyuan
2026-06-29 13:24:51 +08:00
committed by Lennart Poettering
parent 25714364a9
commit b0d48e096c

View File

@@ -45,6 +45,13 @@
parses them and updates the environment exported by the systemd user instance. See below for an
discussion of which processes inherit those variables.</para>
<para>The user-level configuration directory defaults to <filename>~/.config/environment.d/</filename>.
If <varname>$XDG_CONFIG_HOME</varname> is set to an absolute path in the user service manager
environment (e.g. via PAM or <filename>/etc/environment</filename>), it takes precedence over
<filename>~/.config/</filename>. Note that this creates a bootstrapping consideration: variables
set in <filename>environment.d/</filename> files, including <varname>$XDG_CONFIG_HOME</varname>
itself, are not available when the generator determines which directory to read.</para>
<para>It is recommended to use numerical prefixes for file names to simplify ordering.</para>
<para>For backwards compatibility, a symlink to <filename>/etc/environment</filename> is