From ca23eeb54c7e164cd16a3a0a631b7f1b73584d89 Mon Sep 17 00:00:00 2001 From: ayekat Date: Fri, 24 Nov 2017 12:44:08 +0100 Subject: [PATCH] tmpfiles: Add specifiers to allow running as user instance This commit adds specifiers %U, %u and %h for the user UID, name and home directory, respectively. [zj: drop untrue copy-pasted comments and move the next text to the new "Specifiers" section. Now that #7444 has been merged, also drop the specifier functions.] --- man/tmpfiles.d.xml | 15 +++++++++++++++ src/tmpfiles/tmpfiles.c | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/man/tmpfiles.d.xml b/man/tmpfiles.d.xml index 642a124eac1..5278c7e7cc9 100644 --- a/man/tmpfiles.d.xml +++ b/man/tmpfiles.d.xml @@ -630,6 +630,21 @@ r! /tmp/.X[0-9]*-lock Kernel release Identical to uname -r output. + + %U + User UID + This is the numeric UID of the user running the service manager instance. In case of the system manager this resolves to 0. + + + %u + User name + This is the name of the user running the service manager instance. In case of the system manager this resolves to root. + + + %h + User home directory + This is the home directory of the user running the service manager instance. In case of the system manager this resolves to /root. + %% Escaped % diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index c49c208078c..4a9c55462f7 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -174,6 +174,10 @@ static const Specifier specifier_table[] = { { 'b', specifier_boot_id, NULL }, { 'H', specifier_host_name, NULL }, { 'v', specifier_kernel_release, NULL }, + + { 'U', specifier_user_id, NULL }, + { 'u', specifier_user_name, NULL }, + { 'h', specifier_user_home, NULL }, {} }; -- 2.39.2