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