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