$prefix/etc/profile.d
Rainer Müller
raimue at macports.org
Wed Aug 17 01:30:09 PDT 2011
Hi,
On 2011-08-13 21:20, Blair Zajac wrote:
> I'm proposing that MacPorts support the $prefix/etc/profile.d as a standard place where ports can install scripts that set up the user's environment. We would tell users to source everything in that directory from their ~/.profile or ~/.bash_profile.
Yes, we could change the way we are adding the PATH environment and source a
small script instead. I had started some work on this once [1], but it doesn't
cover this yet. It's a bit old already, as MANPATH and DISPLAY shouldn't be
needed anymore, IIRC that was necessary for Tiger and below only.
Currently we are using wrapper scripts to set up any special environment
variables. For an example see the wine port.
The environment in the shell and graphical applications will differ on Mac OS X
as opposed to a Linux system where every login runs the profile.d scripts. The
GUI on Mac OS X will not source your shell profiles and thus miss PATH and other
variables. By using wrapper scripts you can still call the absolute path
/opt/local/bin/foo and it will work.
The profile.d directory wouldn't stop any user from overriding the custom
MacPorts additions with their own values later on in their
.bash_profile/.bashrc. But a command like 'port selftest' [2] could help to
diagnose such problems.
Rainer
[1] https://trac.macports.org/browser/trunk/base/setupenv.bash.in
[2] http://trac.macports.org/wiki/SummerOfCode#Configurationandenvironmentselftest
More information about the macports-dev
mailing list