]> git.ipfire.org Git - thirdparty/systemd.git/commit - man/systemd.exec.xml
execute: add support for XDG_STATE_HOME for placing service state data in --user...
authorLennart Poettering <lennart@poettering.net>
Mon, 26 Jun 2023 20:42:33 +0000 (22:42 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 28 Jun 2023 20:01:55 +0000 (22:01 +0200)
commitf9c91932b4d83faf0f95624dc82db353d0726425
tree98e3fef1790e0b3214832dfc3d84e5bcbb1e8d40
parentd5602c16324ec545c82bb59a3d60a349da7c370c
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
man/systemd.exec.xml
man/systemd.unit.xml
src/core/execute.c
src/core/manager.c
src/core/unit-printf.c
test/test-execute/exec-specifier-user.service