1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00

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.]
This commit is contained in:
ayekat 2017-11-24 12:44:08 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent e783f95718
commit ca23eeb54c
2 changed files with 19 additions and 0 deletions

View File

@ -630,6 +630,21 @@ r! /tmp/.X[0-9]*-lock</programlisting>
<entry>Kernel release</entry>
<entry>Identical to <command>uname -r</command> output.</entry>
</row>
<row>
<entry><literal>%U</literal></entry>
<entry>User UID</entry>
<entry>This is the numeric UID of the user running the service manager instance. In case of the system manager this resolves to <constant>0</constant>.</entry>
</row>
<row>
<entry><literal>%u</literal></entry>
<entry>User name</entry>
<entry>This is the name of the user running the service manager instance. In case of the system manager this resolves to <literal>root</literal>.</entry>
</row>
<row>
<entry><literal>%h</literal></entry>
<entry>User home directory</entry>
<entry>This is the home directory of the user running the service manager instance. In case of the system manager this resolves to <literal>/root</literal>.</entry>
</row>
<row>
<entry><literal>%%</literal></entry>
<entry>Escaped %</entry>

View File

@ -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 },
{}
};