]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - man/environment.d.xml
sulogin-shell: simplify returns from a function
[thirdparty/systemd.git] / man / environment.d.xml
index 4022c25c3631e29e0c79c01af217a9e50fffdbcd..c050061abc0712abdb3dc8f982a01d683c0ad3e2 100644 (file)
@@ -2,6 +2,8 @@
 <!--*-nxml-*-->
 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
 <!--
+  SPDX-License-Identifier: LGPL-2.1+
+
   This file is part of systemd.
 
   Copyright 2016 Red Hat, Inc.
@@ -20,7 +22,8 @@
   You should have received a copy of the GNU Lesser General Public License
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 -->
-<refentry id="environment.d" xmlns:xi="http://www.w3.org/2001/XInclude">
+<refentry id="environment.d" conditional='ENABLE_ENVIRONMENT_D'
+    xmlns:xi="http://www.w3.org/2001/XInclude">
 
   <refentryinfo>
     <title>environment.d</title>
     <literal><replaceable>KEY</replaceable>=<replaceable>VALUE</replaceable></literal> environment
     variable assignments, separated by newlines. The right hand side of these assignments may
     reference previously defined environment variables, using the <literal>${OTHER_KEY}</literal>
-    and <literal>$OTHER_KEY</literal> format. No other elements of shell syntax are supported.
-    </para>
+    and <literal>$OTHER_KEY</literal> format. It is also possible to use
+
+    <literal>${<replaceable>FOO</replaceable>:-<replaceable>DEFAULT_VALUE</replaceable>}</literal>
+    to expand in the same way as <literal>${<replaceable>FOO</replaceable>}</literal> unless the
+    expansion would be empty, in which case it expands to <replaceable>DEFAULT_VALUE</replaceable>,
+    and use
+    <literal>${<replaceable>FOO</replaceable>:+<replaceable>ALTERNATE_VALUE</replaceable>}</literal>
+    to expand to <replaceable>ALTERNATE_VALUE</replaceable> as long as
+    <literal>${<replaceable>FOO</replaceable>}</literal> would have expanded to a non-empty value.
+    No other elements of shell syntax are supported.</para>
 
     <para>Each<replaceable>KEY</replaceable> must be a valid variable name. Empty lines
     and lines beginning with the comment character <literal>#</literal> are ignored.</para>
         <programlisting>
         FOO_DEBUG=force-software-gl,log-verbose
         PATH=/opt/foo/bin:$PATH
-        LD_LIBRARY_PATH=/opt/foo/lib
-        XDG_DATA_DIRS=/opt/foo/share:${XDG_DATA_DIRS}
+        LD_LIBRARY_PATH=/opt/foo/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
+        XDG_DATA_DIRS=/opt/foo/share:${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}
         </programlisting>
       </example>
     </refsect2>