]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
build-sys,man: load /etc/environment and describe the new environment.d syntax
authorRay Strode <rstrode@redhat.com>
Fri, 29 Jul 2016 17:52:55 +0000 (13:52 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 20 Feb 2017 23:49:14 +0000 (18:49 -0500)
Add support for /etc/environment and document the changes to the user manager
to automatically import environment *.conf files from:

        ~/.config/environment.d/
        /etc/environment.d/
        /run/environment.d/
        /usr/local/lib/environment.d/
        /usr/lib/environment.d/
        /etc/environment

Makefile-man.am
Makefile.am
man/environment.d.xml [new file with mode: 0644]

index 2413d5b6c81d6d818adbae62a1e627cba2778048..4249e13ec348659164e4497a7aed92e44b27c7a9 100644 (file)
@@ -11,6 +11,7 @@ MANPAGES += \
        man/bootup.7 \
        man/busctl.1 \
        man/daemon.7 \
+       man/environment.d.5 \
        man/file-hierarchy.7 \
        man/halt.8 \
        man/hostname.5 \
@@ -2642,6 +2643,7 @@ EXTRA_DIST += \
        man/crypttab.xml \
        man/daemon.xml \
        man/dnssec-trust-anchors.d.xml \
+       man/environment.d.xml \
        man/file-hierarchy.xml \
        man/halt.xml \
        man/hostname.xml \
index 70bdcf7076710ad1abd79d700c5cacc1c2a815df..337a053eade8ef5db42024525d3a3ac459f5ee1d 100644 (file)
@@ -68,6 +68,7 @@ catalogstatedir=$(systemdstatedir)/catalog
 xinitrcdir=$(sysconfdir)/X11/xinit/xinitrc.d
 
 # Our own, non-special dirs
+environmentdir=$(prefix)/lib/environment.d
 pkgsysconfdir=$(sysconfdir)/systemd
 userunitdir=$(prefix)/lib/systemd/user
 userpresetdir=$(prefix)/lib/systemd/user-preset
@@ -308,6 +309,10 @@ endef
 install-directories-hook:
        $(MKDIR_P) $(addprefix $(DESTDIR),$(INSTALL_DIRS))
 
+install-environment-conf-hook: install-directories-hook
+       $(AM_V_LN)$(LN_S) --relative -f $(DESTDIR)$(sysconfdir)/environment \
+               $(DESTDIR)$(environmentdir)/99-environment.conf
+
 install-aliases-hook:
        set -- $(SYSTEM_UNIT_ALIASES) && \
                dir=$(systemunitdir) && $(install-aliases)
@@ -340,6 +345,7 @@ install-touch-usr-hook:
 INSTALL_EXEC_HOOKS += \
        install-target-wants-hook \
        install-directories-hook \
+       install-environment-conf-hook \
        install-aliases-hook \
        install-touch-usr-hook
 
@@ -6491,6 +6497,7 @@ INSTALL_DIRS += \
 endif
 
 INSTALL_DIRS += \
+       $(environmentdir) \
        $(prefix)/lib/modules-load.d \
        $(sysconfdir)/modules-load.d \
        $(prefix)/lib/systemd/network \
diff --git a/man/environment.d.xml b/man/environment.d.xml
new file mode 100644 (file)
index 0000000..4f3e038
--- /dev/null
@@ -0,0 +1,111 @@
+<?xml version="1.0"?>
+<!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+<!--
+  This file is part of systemd.
+
+  Copyright 2016 Red Hat, Inc.
+  Copyright 2017 Zbigniew Jędrzejewski-Szmek
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  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">
+
+  <refentryinfo>
+    <title>environment.d</title>
+    <productname>systemd</productname>
+
+    <authorgroup>
+      <author>
+        <contrib>Developer</contrib>
+        <firstname>Ray</firstname>
+        <surname>Strode</surname>
+        <email>rstrode@redhat.com</email>
+      </author>
+    </authorgroup>
+  </refentryinfo>
+
+  <refmeta>
+    <refentrytitle>environment.d</refentrytitle>
+    <manvolnum>5</manvolnum>
+  </refmeta>
+
+  <refnamediv>
+    <refname>environment.d</refname>
+    <refpurpose>Definition of user session environment</refpurpose>
+  </refnamediv>
+
+  <refsynopsisdiv>
+    <para><filename>~/.config/environment.d/*.conf</filename></para>
+    <para><filename>/etc/environment.d/*.conf</filename></para>
+    <para><filename>/run/environment.d/*.conf</filename></para>
+    <para><filename>/usr/lib/environment.d/*.conf</filename></para>
+    <para><filename>/etc/environment</filename></para>
+  </refsynopsisdiv>
+
+  <refsect1>
+    <title>Description</title>
+
+    <para>The <filename>environment.d</filename> directories contain a list of "global" environment
+    variable assignments for the user environment.
+    <citerefentry><refentrytitle>systemd-environment-d-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+    parses them and updates the environment exported by the systemd user instance to the services it
+    starts.</para>
+
+    <para>It is recommended to use numerical prefixes for file names to simplify ordering.</para>
+
+    <para>For backwards compatibility, a symlink to <filename>/etc/environment</filename> is
+    installed, so this file is also parsed.</para>
+  </refsect1>
+
+  <xi:include href="standard-conf.xml" xpointer="confd" />
+
+  <refsect1>
+    <title>Configuration Format</title>
+
+    <para>The configuration files contain a list of
+    <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>
+    format. No other elements of shell syntax are supported.
+    </para>
+
+    <refsect2>
+      <title>Example</title>
+      <example>
+        <title>Setup environment to allow access to a program installed in
+        <filename noindex='true'>/opt/foo</filename></title>
+
+        <para><filename>/etc/environment.d/60-foo.conf</filename>:
+        </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}
+        </programlisting>
+      </example>
+    </refsect2>
+  </refsect1>
+
+  <refsect1>
+    <title>See Also</title>
+    <para>
+      <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+      <citerefentry><refentrytitle>systemd-environment-d-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+      <citerefentry><refentrytitle>systemd.environment-generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+    </para>
+  </refsect1>
+
+</refentry>