Re: Bug#704054: /etc/environment.d
On Thu, Mar 28, 2013 at 01:58:36PM +0800, Thomas Goirand wrote:
> On 03/27/2013 08:54 PM, adrelanos wrote:
> > Package: general
> > Severity: wishlist
> > I'd like to have a /etc/environment.d folder. Contributing that code
> > shouldn't be hard for me. But I don't know where the would be the best
> > place to implement it and how?
> > http://codesearch.debian.net tells, that many packages read
> > /etc/environment directly, not using some system mechanism to get the
> > contents of it, which makes the implementation harder.
> > Asking all affected packages to read /etc/environment.d as well or to
> > start using a system function to do that seems unlikely?
> > The most realistic option could be to write something similar to
> > resolvconf, i.e. creating a package which phrases /etc/environment.d
> > and dynamically creates /etc/environment.
> > Please tell me what you think.
> I might sound silly, but ... what is /etc/environment for? What
> are the packages reading it, and for what use?
It is the default environment file for the pam_env.so module from
libpam-modules package. It allows (un)setting specific environment
variables. See for example for the su service, in the session
,---- [ /etc/pam.d/su ]
| # This module parses environment configuration file(s)
| # and also allows you to use an extended config
| # file /etc/security/pam_env.conf.
| # parsing /etc/environment needs "readenv=1"
| session required pam_env.so readenv=1
| # locale variables are also kept into /etc/default/locale in etch
| # reading this file *in addition to /etc/environment* does not hurt
| session required pam_env.so readenv=1 envfile=/etc/default/locale