[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Need clarification about /etc/environment



On Sun, 22 Sep 2002 16:49:15 +0200, Andreas Metzler
<ametzler@downhill.at.eu.org> wrote:
>Marc Haber <mh+debian-devel@zugschlus.de> wrote:
>> I need some explanation about /etc/environment. Here is what I have
>> found out:
>[...]
>> - Is evaluated for example by pam_env, causing "NAME=\VALUE" to be
>>  parsed into the environment variable NAME with a value starting with
>>  an actual backslash
>[...]
>
>Hello,
>Afaics today it is exclusively evaluated by pam_env on Debian-systems;
>take look at #17309 for an historical account.

So I should probably use this code:

  set -a
  eval "`/bin/sed 's/\([$"\`\\]\)/\\\\\1/g
    s/^ *\([^# =][^=]*\)=\(.*\)$/\1="\2"/' < /etc/environment`"
  set +a


>> - Virtually every shell script I have seen simply sources the file
>>  instead of properly parsing it.
>[...]
>
>Is there one shipped with Debian? - I just zgrepped /{usr/,}{s,}bin
>/etc /usr/share/doc and /usr/share/man in vain.

locales.postinst from woody creates that file.

>> What is the canonical way of handling /etc/environment?
>
>Imho you can expect that every setting you make in /etc/environment is
>available in every interactive login (console, xdm, ssh, ...), but
>_not_ in system services started via init or /etc/rc*. At least this
>is the current practice, none of the daemons running on my machine
>have the variables from /etc/environment in their environment.

I concur with that.

>> I don't want to simply source the file in my init.d script to fix
>> bug #158981, since I now know this is wrong.
>[...]
>
>I'd close it and tell the submitter to edit /etc/init.d/console-log or
>make setting the locale available via /etc/defaults/console-log or
>extentend /etc/console-log.conf to make it possible to tail a
>Russian file on tty8 and and German on on tty9.

*yuck*

Slowly, this calls for a "real" config file :(

>Evaluating /etc/environment seems wrong to me.

Why not pull the locale settings only from /etc/environment?

Greetings
Marc

-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber          |   " Questions are the         | Mailadresse im Header
Karlsruhe, Germany  |     Beginning of Wisdom "     | Fon: *49 721 966 32 15
Nordisch by Nature  | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29



Reply to: