From 79d615d56c186475089bc617f6d6850d89687e38 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Fri, 29 Jul 2016 13:52:55 -0400 Subject: build-sys,man: load /etc/environment and describe the new environment.d syntax 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 | 2 + Makefile.am | 7 ++++ man/environment.d.xml | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+) create mode 100644 man/environment.d.xml diff --git a/Makefile-man.am b/Makefile-man.am index 2413d5b6c8..4249e13ec3 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -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 \ diff --git a/Makefile.am b/Makefile.am index 70bdcf7076..337a053ead 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 index 0000000000..4f3e03825a --- /dev/null +++ b/man/environment.d.xml @@ -0,0 +1,111 @@ + + + + + + + + environment.d + systemd + + + + Developer + Ray + Strode + rstrode@redhat.com + + + + + + environment.d + 5 + + + + environment.d + Definition of user session environment + + + + ~/.config/environment.d/*.conf + /etc/environment.d/*.conf + /run/environment.d/*.conf + /usr/lib/environment.d/*.conf + /etc/environment + + + + Description + + The environment.d directories contain a list of "global" environment + variable assignments for the user environment. + systemd-environment-d-generator8 + parses them and updates the environment exported by the systemd user instance to the services it + starts. + + It is recommended to use numerical prefixes for file names to simplify ordering. + + For backwards compatibility, a symlink to /etc/environment is + installed, so this file is also parsed. + + + + + + Configuration Format + + The configuration files contain a list of + KEY=VALUE environment + variable assignments, separated by newlines. The right hand side of these assignments may + reference previously defined environment variables, using the ${OTHER_KEY} + format. No other elements of shell syntax are supported. + + + + Example + + Setup environment to allow access to a program installed in + <filename noindex='true'>/opt/foo</filename> + + /etc/environment.d/60-foo.conf: + + + 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} + + + + + + + See Also + + systemd1, + systemd-environment-d-generator8, + systemd.environment-generator7 + + + + -- cgit v1.2.3-54-g00ecf