summaryrefslogtreecommitdiffstats
path: root/src/core/unit-printf.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-05-29 11:25:26 +0200
committerLennart Poettering <lennart@poettering.net>2018-05-29 11:39:15 +0200
commitb294e5943f06bc96e2898e769cfe610bbf10b767 (patch)
treee6b7188d1af3b78d88a5ca6d60849cddf7bf5a93 /src/core/unit-printf.c
parentman: sort specifier list in systemd.unit(5) alphabetically (diff)
downloadsystemd-b294e5943f06bc96e2898e769cfe610bbf10b767.tar.xz
systemd-b294e5943f06bc96e2898e769cfe610bbf10b767.zip
core: introduce specifiers for /tmp and /var/tmp
This corresponds nicely with the specifiers we already pass for /var/lib, /var/cache, /run and so on. This is particular useful to update the test-path service files to operate without guessable files, thus allowing multiple parallel test-path invocations to pass without issues (the idea is to set $TMPDIR early on in the test to some private directory, and then only use the new %T or %V specifier to refer to it).
Diffstat (limited to 'src/core/unit-printf.c')
-rw-r--r--src/core/unit-printf.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core/unit-printf.c b/src/core/unit-printf.c
index d2948ab6aa..20891200ba 100644
--- a/src/core/unit-printf.c
+++ b/src/core/unit-printf.c
@@ -232,6 +232,8 @@ int unit_full_printf(Unit *u, const char *format, char **ret) {
* %S: the state directory root (e.g. /var/lib or $XDG_CONFIG_HOME)
* %C: the cache directory root (e.g. /var/cache or $XDG_CACHE_HOME)
* %L: the log directory root (e.g. /var/log or $XDG_CONFIG_HOME/log)
+ * %T: the temporary directory (e.g. /tmp, or $TMPDIR, $TEMP, $TMP)
+ * %V: the temporary directory for large, persistent stuff (e.g. /var/tmp, or $TMPDIR, $TEMP, $TMP)
*
* %h: the homedir of the running user
* %s: the shell of the running user
@@ -257,10 +259,13 @@ int unit_full_printf(Unit *u, const char *format, char **ret) {
{ 'c', specifier_cgroup, NULL },
{ 'r', specifier_cgroup_slice, NULL },
{ 'R', specifier_cgroup_root, NULL },
+
{ 't', specifier_special_directory, UINT_TO_PTR(EXEC_DIRECTORY_RUNTIME) },
{ 'S', specifier_special_directory, UINT_TO_PTR(EXEC_DIRECTORY_STATE) },
{ 'C', specifier_special_directory, UINT_TO_PTR(EXEC_DIRECTORY_CACHE) },
{ 'L', specifier_special_directory, UINT_TO_PTR(EXEC_DIRECTORY_LOGS) },
+ { 'T', specifier_tmp_dir, NULL },
+ { 'V', specifier_var_tmp_dir, NULL },
{ 'U', specifier_user_id, NULL },
{ 'u', specifier_user_name, NULL },