How to make "sudo port install" run a post-activate script with only user permission?

Kevin Reid kpreid at switchb.org
Thu Oct 4 07:19:37 PDT 2012


On Oct 4, 2012, at 7:13, Jeremy Lavergne wrote:

>> Is it possible to tell the port command (normally called with sudo) that it should run a post-activate script with the permissions of the installing user (i.e. not user macports or root)?
> 
> Perhaps we could add that. 
> 
> We could use $SUDO_USER or logname, but I'm not sure how fragile an assumption those will be. I imagine it'd be messy if they're wrong and end up installing a bunch of files and directories with the wrong owner.

I would like to offer the opinion that having this dependence at all is bad user interface design -- it's a piece of context the experienced user doesn't expect to matter when they write 'sudo ...', and not only that:

And I run as a non-admin user, so I have to 'su' to another user before 'sudo' installing a port. Who is the proper 'installing user', and can you tell?

What if you want to 'install for' multiple users?

Better to have user-dependent operations done independently of MacPorts and independent of system-wide directories, IMO.

-- 
Kevin Reid                                  <http://switchb.org/kpreid/>



More information about the macports-dev mailing list