]>
Commit | Line | Data |
---|---|---|
79d615d5 RS |
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 | <!-- | |
572eb058 ZJS |
5 | SPDX-License-Identifier: LGPL-2.1+ |
6 | ||
79d615d5 RS |
7 | This file is part of systemd. |
8 | ||
9 | Copyright 2016 Red Hat, Inc. | |
10 | Copyright 2017 Zbigniew Jędrzejewski-Szmek | |
11 | ||
12 | systemd is free software; you can redistribute it and/or modify it | |
13 | under the terms of the GNU Lesser General Public License as published by | |
14 | the Free Software Foundation; either version 2.1 of the License, or | |
15 | (at your option) any later version. | |
16 | ||
17 | systemd is distributed in the hope that it will be useful, but | |
18 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
20 | Lesser General Public License for more details. | |
21 | ||
22 | You should have received a copy of the GNU Lesser General Public License | |
23 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
24 | --> | |
232bd677 | 25 | <refentry id="environment.d" conditional='ENABLE_ENVIRONMENT_D' |
26 | xmlns:xi="http://www.w3.org/2001/XInclude"> | |
79d615d5 RS |
27 | |
28 | <refentryinfo> | |
29 | <title>environment.d</title> | |
30 | <productname>systemd</productname> | |
31 | ||
32 | <authorgroup> | |
33 | <author> | |
34 | <contrib>Developer</contrib> | |
35 | <firstname>Ray</firstname> | |
36 | <surname>Strode</surname> | |
37 | <email>rstrode@redhat.com</email> | |
38 | </author> | |
39 | </authorgroup> | |
40 | </refentryinfo> | |
41 | ||
42 | <refmeta> | |
43 | <refentrytitle>environment.d</refentrytitle> | |
44 | <manvolnum>5</manvolnum> | |
45 | </refmeta> | |
46 | ||
47 | <refnamediv> | |
48 | <refname>environment.d</refname> | |
49 | <refpurpose>Definition of user session environment</refpurpose> | |
50 | </refnamediv> | |
51 | ||
52 | <refsynopsisdiv> | |
53 | <para><filename>~/.config/environment.d/*.conf</filename></para> | |
54 | <para><filename>/etc/environment.d/*.conf</filename></para> | |
55 | <para><filename>/run/environment.d/*.conf</filename></para> | |
56 | <para><filename>/usr/lib/environment.d/*.conf</filename></para> | |
57 | <para><filename>/etc/environment</filename></para> | |
58 | </refsynopsisdiv> | |
59 | ||
60 | <refsect1> | |
61 | <title>Description</title> | |
62 | ||
63 | <para>The <filename>environment.d</filename> directories contain a list of "global" environment | |
64 | variable assignments for the user environment. | |
65 | <citerefentry><refentrytitle>systemd-environment-d-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
66 | parses them and updates the environment exported by the systemd user instance to the services it | |
67 | starts.</para> | |
68 | ||
69 | <para>It is recommended to use numerical prefixes for file names to simplify ordering.</para> | |
70 | ||
71 | <para>For backwards compatibility, a symlink to <filename>/etc/environment</filename> is | |
72 | installed, so this file is also parsed.</para> | |
73 | </refsect1> | |
74 | ||
75 | <xi:include href="standard-conf.xml" xpointer="confd" /> | |
76 | ||
77 | <refsect1> | |
78 | <title>Configuration Format</title> | |
79 | ||
80 | <para>The configuration files contain a list of | |
81 | <literal><replaceable>KEY</replaceable>=<replaceable>VALUE</replaceable></literal> environment | |
82 | variable assignments, separated by newlines. The right hand side of these assignments may | |
83 | reference previously defined environment variables, using the <literal>${OTHER_KEY}</literal> | |
b82f58bf RS |
84 | and <literal>$OTHER_KEY</literal> format. It is also possible to use |
85 | ||
86 | <literal>${<replaceable>FOO</replaceable>:-<replaceable>DEFAULT_VALUE</replaceable>}</literal> | |
87 | to expand in the same way as <literal>${<replaceable>FOO</replaceable>}</literal> unless the | |
88 | expansion would be empty, in which case it expands to <replaceable>DEFAULT_VALUE</replaceable>, | |
89 | and use | |
90 | <literal>${<replaceable>FOO</replaceable>:+<replaceable>ALTERNATE_VALUE</replaceable>}</literal> | |
91 | to expand to <replaceable>ALTERNATE_VALUE</replaceable> as long as | |
92 | <literal>${<replaceable>FOO</replaceable>}</literal> would have expanded to a non-empty value. | |
93 | No other elements of shell syntax are supported.</para> | |
79d615d5 | 94 | |
164147c3 | 95 | <para>Each <replaceable>KEY</replaceable> must be a valid variable name. Empty lines |
184d1904 ZJS |
96 | and lines beginning with the comment character <literal>#</literal> are ignored.</para> |
97 | ||
79d615d5 RS |
98 | <refsect2> |
99 | <title>Example</title> | |
100 | <example> | |
101 | <title>Setup environment to allow access to a program installed in | |
102 | <filename noindex='true'>/opt/foo</filename></title> | |
103 | ||
104 | <para><filename>/etc/environment.d/60-foo.conf</filename>: | |
105 | </para> | |
106 | <programlisting> | |
107 | FOO_DEBUG=force-software-gl,log-verbose | |
ccad1fd0 | 108 | PATH=/opt/foo/bin:$PATH |
af92daeb | 109 | LD_LIBRARY_PATH=/opt/foo/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} |
b82f58bf | 110 | XDG_DATA_DIRS=/opt/foo/share:${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/} |
79d615d5 RS |
111 | </programlisting> |
112 | </example> | |
113 | </refsect2> | |
114 | </refsect1> | |
115 | ||
116 | <refsect1> | |
117 | <title>See Also</title> | |
118 | <para> | |
119 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
120 | <citerefentry><refentrytitle>systemd-environment-d-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>, | |
121 | <citerefentry><refentrytitle>systemd.environment-generator</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
122 | </para> | |
123 | </refsect1> | |
124 | ||
125 | </refentry> |