env_helper

Bradley Giesbrecht brad at pixilla.com
Sun Mar 15 15:25:38 PDT 2009


I'm thinking I like this.

I just added paths for ${PREFIX}/apach2/bin and ${PREFIX}/lib/mysql5/ 
bin to /opt/local/etc/env_helper/paths/PATH/(apache2 & mysql5).

So port apache2 and mysql5 could add /opt/local/etc/env_helper/paths/ 
PATH/apache2 and /opt/local/etc/env_helper/paths/PATH/mysql5 during  
install and with the one line added to .profile you pick up their bin  
dirs.

I've done the same for MANPATH where I installed p5 man pages to /opt/ 
local/share/p5/man. The p5 module man pages show up first, then the  
port perl5.8 base modules and then the apple perl5.8 man pages.

This can probably be done better but I do think this adds value with  
little cost.

//Brad

On Mar 15, 2009, at 2:26 PM, Bradley Giesbrecht wrote:

>
> On Mar 15, 2009, at 1:28 PM, Bradley Giesbrecht wrote:
>
>> I have modeled an env setup script after the one apple supplies at / 
>> usr/libexec/path_helper which is evaluated by /etc/profile.
>>
>> My idea is to add a line like this at the top of ones .profile file.
>> eval `/opt/local/libexec/env_helper`
>>
>> I don't know if this list allows file attachments so if the tar  
>> file is not attached I will upload it somewhere and send another  
>> email with a link.
>> If I should open a trac ticket someone tell me to and I will.
>>
>> I was thinking this might be a nice way to allow ports to modify  
>> the users env in a managed fashion. They can drop their env files  
>> in the proper place and they will be automatically added to the  
>> users env.
>>
>> Also, since the files would be registered to the port if the port  
>> is deactivated the files can be removed.
>>
>> I was thinking of making this as a port (env_helper or  
>> macports_env) that other ports could use or if people thought it  
>> useful adding it directly to macports.
>>
>> I started with just path vars and only bash at this point but  
>> looking at /usr/libexc/path_helper it shouldn't be difficult to add  
>> support for other shells.
>>
>> I'm simply naming the files the same as the env var and looping  
>> over the directory.
>>
>>
>> //Brad
>
> I modified /opt/local/libexec/env_helper to evaluate the paths so $ 
> {PREFIX} can be used in the conf files. This would not NEED to be  
> done because any installer could create the path properly but it  
> does remove that necessary step.
>
> //Brad



More information about the macports-dev mailing list