man: document what variables are allowed

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-10-23 15:47:33 +02:00
parent ff461576de
commit 0dc9fd56a5
2 changed files with 28 additions and 16 deletions

View file

@ -1060,6 +1060,14 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
<refsect2> <refsect2>
<title>Environment Commands</title> <title>Environment Commands</title>
<para><command>systemd</command> supports an environment block that is passed to processes the manager
spawns. The names of the variables can contain ASCII letters, digits, and the underscore
character. Variable names cannot be empty or start with a digit. In variable values, most characters
are allowed, but non-printable characters are currently rejected. The total length of the environment
block is limited to <constant>_SC_ARG_MAX</constant> value defined by
<citerefentry project='man-pages'><refentrytitle>sysconf</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
</para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><command>show-environment</command></term> <term><command>show-environment</command></term>
@ -1091,8 +1099,9 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
<term><command>set-environment <replaceable>VARIABLE=VALUE</replaceable></command></term> <term><command>set-environment <replaceable>VARIABLE=VALUE</replaceable></command></term>
<listitem> <listitem>
<para>Set one or more systemd manager environment variables, <para>Set one or more systemd manager environment variables, as specified on the command
as specified on the command line.</para> line. This command will fail if variable names and values do not conform to the rules listed
above.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
@ -1113,13 +1122,11 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
</term> </term>
<listitem> <listitem>
<para>Import all, one or more environment variables set on <para>Import all, one or more environment variables set on the client into the systemd manager
the client into the systemd manager environment block. If environment block. If no arguments are passed, the entire environment block is imported.
no arguments are passed, the entire environment block is Otherwise, a list of one or more environment variable names should be passed, whose client-side
imported. Otherwise, a list of one or more environment values are then imported into the manager's environment block. This command will silently ignore
variable names should be passed, whose client-side values any assignments which do not conform to the rules listed above.</para>
are then imported into the manager's environment
block.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>

View file

@ -2186,13 +2186,18 @@ SystemCallErrorNumber=EPERM</programlisting>
<varlistentry> <varlistentry>
<term><varname>Environment=</varname></term> <term><varname>Environment=</varname></term>
<listitem><para>Sets environment variables for executed processes. Takes a space-separated list of variable <listitem><para>Sets environment variables for executed processes. Takes a space-separated list of
assignments. This option may be specified more than once, in which case all listed variables will be set. If variable assignments. This option may be specified more than once, in which case all listed variables
the same variable is set twice, the later setting will override the earlier setting. If the empty string is will be set. If the same variable is set twice, the later setting will override the earlier
assigned to this option, the list of environment variables is reset, all prior assignments have no setting. If the empty string is assigned to this option, the list of environment variables is reset,
effect. Variable expansion is not performed inside the strings, however, specifier expansion is possible. The $ all prior assignments have no effect. Variable expansion is not performed inside the strings,
character has no special meaning. If you need to assign a value containing spaces or the equals sign to a however, specifier expansion is possible. The <literal>$</literal> character has no special
variable, use double quotes (") for the assignment.</para> meaning. If you need to assign a value containing spaces or the equals sign to a variable, use double
quotes (") for the assignment.</para>
<para>The names of the variables can contain ASCII letters, digits, and the underscore
character. Variable names cannot be empty or start with a digit. In variable values, most characters
are allowed, but non-printable characters are currently rejected.</para>
<para>Example: <para>Example:
<programlisting>Environment="VAR1=word1 word2" VAR2=word3 "VAR3=$word 5 6"</programlisting> <programlisting>Environment="VAR1=word1 word2" VAR2=word3 "VAR3=$word 5 6"</programlisting>