summaryrefslogtreecommitdiffstats
path: root/src/core/unit-printf.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-06-26 22:42:33 +0200
committerLennart Poettering <lennart@poettering.net>2023-06-28 22:01:55 +0200
commitf9c91932b4d83faf0f95624dc82db353d0726425 (patch)
tree98e3fef1790e0b3214832dfc3d84e5bcbb1e8d40 /src/core/unit-printf.c
parentexecute: when recursively chowning StateDirectory= when spawning services, fo... (diff)
downloadsystemd-f9c91932b4d83faf0f95624dc82db353d0726425.tar.xz
systemd-f9c91932b4d83faf0f95624dc82db353d0726425.zip
execute: add support for XDG_STATE_HOME for placing service state data in --user mode
This adds support for the new XDG_STATE_HOME env var that was added to the xdg basedir spec. Previously, because the basedir spec didn't know the concept we'd alias the backing dir for StateDirectory= to the one for ConfigurationDirectory= when runnin in --user mode. With this change we'll make separate. This brings us various benefits, such as proper "systemctl clean" support, where we can clear service state separately from service configuration, now in user mode too. This does not come without complications: retaining compatibility with older setups is difficult, because we cannot possibly identitfy which files in existing populated config dirs are actually "state" and which one are true" configuration. Hence let's deal with this pragmatically: if we detect that a service that has both dirs configured only has the configuration dir existing, then symlink the state dir to the configuration dir to retain compatibility. This is not great, but it's the only somewhat reasonable way out I can see. Fixes: #25739
Diffstat (limited to 'src/core/unit-printf.c')
-rw-r--r--src/core/unit-printf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/unit-printf.c b/src/core/unit-printf.c
index 3977082cc1..9f95984eb6 100644
--- a/src/core/unit-printf.c
+++ b/src/core/unit-printf.c
@@ -209,8 +209,8 @@ int unit_full_printf_full(const Unit *u, const char *format, size_t max_length,
* %C: the cache directory root (e.g. /var/cache or $XDG_CACHE_HOME)
* %d: the credentials directory ($CREDENTIALS_DIRECTORY)
* %E: the configuration directory root (e.g. /etc or $XDG_CONFIG_HOME)
- * %L: the log directory root (e.g. /var/log or $XDG_CONFIG_HOME/log)
- * %S: the state directory root (e.g. /var/lib or $XDG_CONFIG_HOME)
+ * %L: the log directory root (e.g. /var/log or $XDG_STATE_HOME/log)
+ * %S: the state directory root (e.g. /var/lib or $XDG_STATE_HOME)
* %t: the runtime directory root (e.g. /run or $XDG_RUNTIME_DIR)
*
* %h: the homedir of the running user