core: add support for expanding state/cache/log directory root in unit files
authorLennart Poettering <lennart@poettering.net>
Wed, 11 Oct 2017 12:02:36 +0000 (14:02 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 26 Oct 2017 15:59:09 +0000 (17:59 +0200)
commit14068e17f32a06e6a1f8f72416018bc653b8ea2d
tree800aeb10cbde7ef432431fc8f5efbae9fe74cd30
parent530c1c3028c484c503725bbac769b9051af83da7
core: add support for expanding state/cache/log directory root in unit files

This augments %t which already resolves to the runtime directory root, and
should be useful for units that want to pass any of these paths in
command line arguments.

Example:

ExecStart=/usr/bin/mydaemon --datadir=%S/mydaemon

Why not expose a specifier resolving directly to the configured
state/runtime/cache/log dir? Three reasons:

1. Specifiers should be independent of configuration of the unit itself,
   and StateDirectory= and friends are unit configuration.  See
   03fc9c723cfc59467a7fccc305f34273f8564b25 and related work.

2. We permit multiple StateDirectory= values per unit, and it hence
   wouldn't be clear which one is passed.

3. We already have %t for the runtime directory root, and we should
   continue with the same scheme.
man/systemd.unit.xml
src/core/unit-printf.c