]>
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 | ||
96b2fb93 | 7 | Copyright © 2016 Red Hat, Inc. |
79d615d5 | 8 | --> |
232bd677 | 9 | <refentry id="environment.d" conditional='ENABLE_ENVIRONMENT_D' |
10 | xmlns:xi="http://www.w3.org/2001/XInclude"> | |
79d615d5 RS |
11 | |
12 | <refentryinfo> | |
13 | <title>environment.d</title> | |
14 | <productname>systemd</productname> | |
79d615d5 RS |
15 | </refentryinfo> |
16 | ||
17 | <refmeta> | |
18 | <refentrytitle>environment.d</refentrytitle> | |
19 | <manvolnum>5</manvolnum> | |
20 | </refmeta> | |
21 | ||
22 | <refnamediv> | |
23 | <refname>environment.d</refname> | |
24 | <refpurpose>Definition of user session environment</refpurpose> | |
25 | </refnamediv> | |
26 | ||
27 | <refsynopsisdiv> | |
28 | <para><filename>~/.config/environment.d/*.conf</filename></para> | |
29 | <para><filename>/etc/environment.d/*.conf</filename></para> | |
30 | <para><filename>/run/environment.d/*.conf</filename></para> | |
31 | <para><filename>/usr/lib/environment.d/*.conf</filename></para> | |
32 | <para><filename>/etc/environment</filename></para> | |
33 | </refsynopsisdiv> | |
34 | ||
35 | <refsect1> | |
36 | <title>Description</title> | |
37 | ||
38 | <para>The <filename>environment.d</filename> directories contain a list of "global" environment | |
39 | variable assignments for the user environment. | |
40 | <citerefentry><refentrytitle>systemd-environment-d-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
41 | parses them and updates the environment exported by the systemd user instance to the services it | |
42 | starts.</para> | |
43 | ||
44 | <para>It is recommended to use numerical prefixes for file names to simplify ordering.</para> | |
45 | ||
46 | <para>For backwards compatibility, a symlink to <filename>/etc/environment</filename> is | |
47 | installed, so this file is also parsed.</para> | |
48 | </refsect1> | |
49 | ||
50 | <xi:include href="standard-conf.xml" xpointer="confd" /> | |
51 | ||
52 | <refsect1> | |
53 | <title>Configuration Format</title> | |
54 | ||
55 | <para>The configuration files contain a list of | |
56 | <literal><replaceable>KEY</replaceable>=<replaceable>VALUE</replaceable></literal> environment | |
57 | variable assignments, separated by newlines. The right hand side of these assignments may | |
58 | reference previously defined environment variables, using the <literal>${OTHER_KEY}</literal> | |
b82f58bf RS |
59 | and <literal>$OTHER_KEY</literal> format. It is also possible to use |
60 | ||
61 | <literal>${<replaceable>FOO</replaceable>:-<replaceable>DEFAULT_VALUE</replaceable>}</literal> | |
62 | to expand in the same way as <literal>${<replaceable>FOO</replaceable>}</literal> unless the | |
63 | expansion would be empty, in which case it expands to <replaceable>DEFAULT_VALUE</replaceable>, | |
64 | and use | |
65 | <literal>${<replaceable>FOO</replaceable>:+<replaceable>ALTERNATE_VALUE</replaceable>}</literal> | |
66 | to expand to <replaceable>ALTERNATE_VALUE</replaceable> as long as | |
67 | <literal>${<replaceable>FOO</replaceable>}</literal> would have expanded to a non-empty value. | |
68 | No other elements of shell syntax are supported.</para> | |
79d615d5 | 69 | |
164147c3 | 70 | <para>Each <replaceable>KEY</replaceable> must be a valid variable name. Empty lines |
184d1904 ZJS |
71 | and lines beginning with the comment character <literal>#</literal> are ignored.</para> |
72 | ||
79d615d5 RS |
73 | <refsect2> |
74 | <title>Example</title> | |
75 | <example> | |
76 | <title>Setup environment to allow access to a program installed in | |
77 | <filename noindex='true'>/opt/foo</filename></title> | |
78 | ||
79 | <para><filename>/etc/environment.d/60-foo.conf</filename>: | |
80 | </para> | |
81 | <programlisting> | |
82 | FOO_DEBUG=force-software-gl,log-verbose | |
ccad1fd0 | 83 | PATH=/opt/foo/bin:$PATH |
af92daeb | 84 | LD_LIBRARY_PATH=/opt/foo/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} |
b82f58bf | 85 | XDG_DATA_DIRS=/opt/foo/share:${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/} |
79d615d5 RS |
86 | </programlisting> |
87 | </example> | |
88 | </refsect2> | |
89 | </refsect1> | |
90 | ||
91 | <refsect1> | |
92 | <title>See Also</title> | |
93 | <para> | |
94 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
95 | <citerefentry><refentrytitle>systemd-environment-d-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>, | |
96 | <citerefentry><refentrytitle>systemd.environment-generator</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
97 | </para> | |
98 | </refsect1> | |
99 | ||
100 | </refentry> |