]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/environment.d.xml
Merge pull request #8417 from brauner/2018-03-09/add_bind_mount_fallback_to_private_d...
[thirdparty/systemd.git] / man / environment.d.xml
1 <?xml version="1.0"?>
2 <!--*-nxml-*-->
3 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!--
5 SPDX-License-Identifier: LGPL-2.1+
6
7 This file is part of systemd.
8
9 Copyright 2016 Red Hat, Inc.
10 Copyright 2017 Zbigniew Jędrzejewski-Szmek
11 -->
12 <refentry id="environment.d" conditional='ENABLE_ENVIRONMENT_D'
13 xmlns:xi="http://www.w3.org/2001/XInclude">
14
15 <refentryinfo>
16 <title>environment.d</title>
17 <productname>systemd</productname>
18
19 <authorgroup>
20 <author>
21 <contrib>Developer</contrib>
22 <firstname>Ray</firstname>
23 <surname>Strode</surname>
24 <email>rstrode@redhat.com</email>
25 </author>
26 </authorgroup>
27 </refentryinfo>
28
29 <refmeta>
30 <refentrytitle>environment.d</refentrytitle>
31 <manvolnum>5</manvolnum>
32 </refmeta>
33
34 <refnamediv>
35 <refname>environment.d</refname>
36 <refpurpose>Definition of user session environment</refpurpose>
37 </refnamediv>
38
39 <refsynopsisdiv>
40 <para><filename>~/.config/environment.d/*.conf</filename></para>
41 <para><filename>/etc/environment.d/*.conf</filename></para>
42 <para><filename>/run/environment.d/*.conf</filename></para>
43 <para><filename>/usr/lib/environment.d/*.conf</filename></para>
44 <para><filename>/etc/environment</filename></para>
45 </refsynopsisdiv>
46
47 <refsect1>
48 <title>Description</title>
49
50 <para>The <filename>environment.d</filename> directories contain a list of "global" environment
51 variable assignments for the user environment.
52 <citerefentry><refentrytitle>systemd-environment-d-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
53 parses them and updates the environment exported by the systemd user instance to the services it
54 starts.</para>
55
56 <para>It is recommended to use numerical prefixes for file names to simplify ordering.</para>
57
58 <para>For backwards compatibility, a symlink to <filename>/etc/environment</filename> is
59 installed, so this file is also parsed.</para>
60 </refsect1>
61
62 <xi:include href="standard-conf.xml" xpointer="confd" />
63
64 <refsect1>
65 <title>Configuration Format</title>
66
67 <para>The configuration files contain a list of
68 <literal><replaceable>KEY</replaceable>=<replaceable>VALUE</replaceable></literal> environment
69 variable assignments, separated by newlines. The right hand side of these assignments may
70 reference previously defined environment variables, using the <literal>${OTHER_KEY}</literal>
71 and <literal>$OTHER_KEY</literal> format. It is also possible to use
72
73 <literal>${<replaceable>FOO</replaceable>:-<replaceable>DEFAULT_VALUE</replaceable>}</literal>
74 to expand in the same way as <literal>${<replaceable>FOO</replaceable>}</literal> unless the
75 expansion would be empty, in which case it expands to <replaceable>DEFAULT_VALUE</replaceable>,
76 and use
77 <literal>${<replaceable>FOO</replaceable>:+<replaceable>ALTERNATE_VALUE</replaceable>}</literal>
78 to expand to <replaceable>ALTERNATE_VALUE</replaceable> as long as
79 <literal>${<replaceable>FOO</replaceable>}</literal> would have expanded to a non-empty value.
80 No other elements of shell syntax are supported.</para>
81
82 <para>Each <replaceable>KEY</replaceable> must be a valid variable name. Empty lines
83 and lines beginning with the comment character <literal>#</literal> are ignored.</para>
84
85 <refsect2>
86 <title>Example</title>
87 <example>
88 <title>Setup environment to allow access to a program installed in
89 <filename noindex='true'>/opt/foo</filename></title>
90
91 <para><filename>/etc/environment.d/60-foo.conf</filename>:
92 </para>
93 <programlisting>
94 FOO_DEBUG=force-software-gl,log-verbose
95 PATH=/opt/foo/bin:$PATH
96 LD_LIBRARY_PATH=/opt/foo/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
97 XDG_DATA_DIRS=/opt/foo/share:${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}
98 </programlisting>
99 </example>
100 </refsect2>
101 </refsect1>
102
103 <refsect1>
104 <title>See Also</title>
105 <para>
106 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
107 <citerefentry><refentrytitle>systemd-environment-d-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
108 <citerefentry><refentrytitle>systemd.environment-generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>
109 </para>
110 </refsect1>
111
112 </refentry>