[109333] trunk/dports/devel/akonadi/Portfile

Joshua Root jmr at macports.org
Wed Aug 14 20:32:35 PDT 2013


On 2013-8-15 11:53 , Ryan Schmidt wrote:
> 
> On Aug 13, 2013, at 10:01, nicos at macports.org wrote:
> 
>> +variant no_root description {Run the akonadi server start as MacPorts install user.} {
>> +    pre-fetch {
>> +        if { ${install.user}=="root" || ${install.group}=="wheel" } {
>> +            ui_error "The akonadi server should not be run as root with no_root variant."
>> +            error "Please do not use this variant with your MacPorts configuration."
>> +        }
>> +    }
>> +
>> +    set startup_root  [join [lrange [exec /usr/bin/dscl . -read Users/${install.user} NFSHomeDirectory] 1 end]]
>> +    # Files are installed into user's startup directory.
>> +    destroot.violate_mtree  yes
>> +}
> 
> Variant names beginning with "no_" are deprecated; please don't create new ones. Usually you should instead use a positively-named variant and use default_variants to turn it on by default, but in this case that would be weird too since this variant implements a nonstandard function. Is a variant really needed at all? Couldn't the port detect whether the user's MacPorts install is as root or not, and react accordingly? That would seem best.

Yes it could check [getuid], but since this is affecting where the plist
is installed, that wouldn't help if the port is built (as root) on a
different machine than it's installed on (as not-root).

This whole installing the plist in the user's home dir thing seems odd
though, as all the ports using base's StartupItem code don't do that for
non-root installs. The plist is still present in
${prefix}/Library/LaunchDaemons even if it's not linked into
/Library/LaunchDaemons, and presumably you could tell the user to load
it from there.

- Josh


More information about the macports-dev mailing list