a52f674
From 492427208b00f716de6f6d1bab8969b20ab6bf5e Mon Sep 17 00:00:00 2001
b12ff75
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
b12ff75
Date: Thu, 9 Jan 2014 22:23:32 -0500
b12ff75
Subject: [PATCH] man: mention which variables will be expanded in ExecStart
b12ff75
a52f674
(cherry picked from commit c5b37953b7835562348d71ad5514faefa4cfb10b)
a52f674
b12ff75
Conflicts:
b12ff75
	man/systemd.service.xml
b12ff75
---
b12ff75
 man/systemd.exec.xml    |  6 ++++--
b12ff75
 man/systemd.service.xml | 35 +++++++++++++++++++++++------------
b12ff75
 2 files changed, 27 insertions(+), 14 deletions(-)
b12ff75
b12ff75
diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml
b12ff75
index e213ec4..c8414d4 100644
b12ff75
--- a/man/systemd.exec.xml
b12ff75
+++ b/man/systemd.exec.xml
b12ff75
@@ -295,9 +295,11 @@
b12ff75
                                 for the assignment.</para>
b12ff75
 
b12ff75
                                 <para>Example:
b12ff75
-                                <programlisting>Environment="VAR1=word1 word2" VAR2=word3 "VAR3=word 5 6"</programlisting>
b12ff75
+                                <programlisting>Environment="VAR1=word1 word2" VAR2=word3 "VAR3=$word 5 6"</programlisting>
b12ff75
                                 gives three variables <literal>VAR1</literal>,
b12ff75
-                                <literal>VAR2</literal>, <literal>VAR3</literal>.
b12ff75
+                                <literal>VAR2</literal>, <literal>VAR3</literal>
b12ff75
+                                with the values <literal>word1 word2</literal>,
b12ff75
+                                <literal>word3</literal>, <literal>$word 5 6</literal>.
b12ff75
                                 </para>
b12ff75
 
b12ff75
                                 <para>
b12ff75
diff --git a/man/systemd.service.xml b/man/systemd.service.xml
b12ff75
index af3e0f2..4fb21ba 100644
b12ff75
--- a/man/systemd.service.xml
b12ff75
+++ b/man/systemd.service.xml
b12ff75
@@ -392,16 +392,32 @@
b12ff75
                                 replaced by the value of the
b12ff75
                                 environment variable including all
b12ff75
                                 whitespace it contains, resulting in a
b12ff75
-                                single argument.  Use
b12ff75
+                                single argument. Use
b12ff75
                                 <literal>$FOO</literal> as a separate
b12ff75
                                 word on the command line, in which
b12ff75
                                 case it will be replaced by the value
b12ff75
-                                of the environment variable split up
b12ff75
-                                at whitespace, resulting in zero or
b12ff75
-                                more arguments. To pass literal dollar sign
b12ff75
-                                use <literal>$$</literal>. Note that the first
b12ff75
-                                argument (i.e. the program to execute)
b12ff75
-                                may not be a variable.</para>
b12ff75
+                                of the environment variable split at
b12ff75
+                                whitespace, resulting in zero or more
b12ff75
+                                arguments. To pass a literal dollar
b12ff75
+                                sign, use <literal>$$</literal>.
b12ff75
+                                Variables whose value is not known at
b12ff75
+                                expansion time are treated as empty
b12ff75
+                                strings. Note that the first argument
b12ff75
+                                (i.e. the program to execute) may not
b12ff75
+                                be a variable.</para>
b12ff75
+
b12ff75
+                                <para>Variables to be used in this
b12ff75
+                                fashion may be defined through
b12ff75
+                                <varname>Environment=</varname> and
b12ff75
+                                <varname>EnvironmentFile=</varname>.
b12ff75
+                                In addition, variables listed in
b12ff75
+                                section "Environment variables in
b12ff75
+                                spawned processes" in
b12ff75
+                                <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
b12ff75
+                                which are considered "static
b12ff75
+                                configuration" may used (this includes
b12ff75
+                                e.g. <varname>$USER</varname>, but not
b12ff75
+                                <varname>$TERM</varname>).</para>
b12ff75
 
b12ff75
                                 <para>Optionally, if the absolute file
b12ff75
                                 name is prefixed with
b12ff75
@@ -429,11 +445,6 @@
b12ff75
                                 <programlisting>ExecStart=/bin/sh -c 'dmesg | tac'
b12ff75
                                 </programlisting>
b12ff75
 
b12ff75
-                                <para>Only select environment variables that
b12ff75
-                                are set for executed commands. See
b12ff75
-                                <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
b12ff75
-                                </para>
b12ff75
-
b12ff75
                                 <para>Example:</para>
b12ff75
                                 <programlisting>ExecStart=/bin/echo one ; /bin/echo "two two"
b12ff75
                                 </programlisting>