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

Re: /etc/profile.d



Piotr Roszatycki <dexter@fnet.pl> writes:

> I noticed an /etc/profile.d directory in RH distribution.
> 
> I think it is good idea. Some packages require to set correct environment
> variables, etc.
> 
> i.e qt1 requires QTDIR=/usr/lib/qt1g variable. It could be set by
> /etc/profile.d/qt1g.sh conffile.
> 
> Another example - a choise of default language in /etc/profile.d/lang.sh file.
> 
> It is very simple to implement this feature in /etc/profile:
> 
> for i in /etc/profile.d/*.sh; do
>     . $i
> done  
> 
> Of course, Debian Policy tells 
> 
> "No program may depend on environment variables to get reasonable
> defaults. (That's because these environment variables would have to be
> set in a system-wide configuration file like /etc/profile, which is
> not supported by all shells.)"
> 
> but I think this directory could be useful in some cases.

How should the scripts work? What shell should they use?

If they use setenv, they will only work with csh compatible shells, if 
they use export they will only work with bash like shells.

If you exec the scripts, the right shell will be used, but you can´t
export variables to a parent shell. If they are sourced, they will use 
the users shell and fail on some shells.

It just doesn´t work. Thats the reason why enviroment variables should 
never be used in debian packages.

The only way to set a enviroment variable would be to add it to
/etc/enviroment and if thats against policy, who ses LANG in
/etc/enviroment?

May the Source be with you.
			Goswin

Ps: qt is a bad example for a enviroment variable, because under
debian QTDIR will allways be the same.


Reply to: