Execution of shell instruction in Portfile

Joshua Root jmr at macports.org
Sun Oct 2 06:40:05 PDT 2011


On 2011-10-3 00:15 , Nicolas Pavillon wrote:
> Hello, 
> 
> While preparing a new Portfile for kdevelop (ticket #14890, https://trac.macports.org/ticket/14890), I realized that it is required to run kbuildsycoca4 after installation to enable kdevelop to find the components it requires for running. 
> Ideally, I would have wanted to run this command after activation step directly in the port, but the command needs to be run by the user (not root), and the tcl "exec" command does not enable saying with which user the command should be run. 
> 
> The best I found for now is to display a message to the user saying that he should run the command himself. Would there be another better way to make it automatic ?

You can certainly change users with su or sudo as part of a shell
command you run with system or exec, but the real problem is knowing
which user you want to run the command as. There could be more than one
user that wants to use kdevelop on the machine, and the user who ran the
port install might not even be one of them.

Ideally of course the application would do all required setup
automatically...

- Josh


More information about the macports-dev mailing list