launchd plist -- userid, home directory

Craig Treleaven ctreleaven at macports.org
Thu Feb 4 07:40:25 PST 2016


> On Feb 4, 2016, at 9:41 AM, Rainer Müller <raimue at macports.org> wrote:
> 
> On 2016-02-04 15:15, Craig Treleaven wrote:
>> I was looking at modifying the buildbot / buildbot-slave ports to include a sample launchd plist.  I would like to be able to default the UserName and WorkingDirectory keys for the userid that is installing the port.
>> 
>> <key>UserName</key>
>> <string>@someusername@</string>
>> <key>WorkingDirectory</key>
>> <string>/Users/@someusername@/buildarea</string>
>> 
>> For example, if I’m installing the port and my userid is ‘wct’, I’d like to s/@someusername@/wct’/g .  
>> 
>> Within the portfile, how can I determine the userid that invoked ‘port install …'?
> 
> I would advise against doing this. The installed sample files would
> change depending on the user that ran the port command. The contents of
> all files installed by a port should be reflected by the canonical
> identifier of name/version/revision/epoch/variants.
> 
> Also this would not help if the user installs the port with a binary
> archive from one of our buildbots, they would always get a pre-defined
> username.
> 
> Wouldn't it make more sense to create a dedicated user to run the
> buildbot daemon? See add_users in portfile(7) and grep for examples in
> the ports tree. If you use some working directory in ${prefix}/var/ it
> could even be used out of the box without further configuration.
> 
> Rainer
> 
> [1] https://trac.macports.org/wiki/ReproducibleBuilds

Ah, yes, good points.  I wasn’t thinking of reproducible buids or the binary packages.  I was hoping to make it a little easier for a user to install a basic working buildslave*.   After the install, our user must run the ‘buildslave create …’ command (with parameters we can’t determine ahead of time) to initialize the the files that the plist will be pointed to.  All that is beyond the scope of the portfile so I guess just providing a template of the plist is a reasonable approach.

Craig

*Our buildbot port is currently non-functional as we have a newer version of sqlalchemy-migrate than it can use.  Being looked at upstream:

http://trac.buildbot.net/ticket/3425#ticket



More information about the macports-dev mailing list