Allow user install

Eric van Gyzen eric at vangyzen.net
Tue Jun 26 21:54:12 UTC 2012


On 06/26/2012 15:24, Simon J. Gerraty wrote:
>
> On Tue, 26 Jun 2012 14:42:53 -0500, Eric van Gyzen writes:
>>>>
>>>> +_uid!= id -u
>>>> +.if ${MK_INSTALL_AS_USER} != "no"&&   ${_uid} != 0
>>>> +_gid!= id -g
>>>> +.for x in BIN CONF DOC INFO KMOD LIB MAN NLS SHARE
>>>> +$xOWN = ${_uid}
>>>> +$xGRP = ${_gid}
>
>>> I like this a lot more.
>>
>> Me too.  We're doing almost exactly that, directly in make.conf.  Yours
>> is cleaner, of course.
>
> A final? tweak, I've moved the _uid!= id -u inside the first .if and
> added another to avoid id -u if MK_INSTALL_AS_USER==no, the extra .if is
> much cheaper than running 'id'.
>
> +.if ${MK_INSTALL_AS_USER} != "no"
> +_uid!= id -u
> +.if ${_uid} != 0
> +_gid!= id -g
> +.for x in BIN CONF DOC INFO KMOD LIB MAN NLS SHARE
> +$xOWN= ${_uid}
> +$xGRP= ${_gid}

Nice catch.  Avoiding the "id" in the common case is a good thing.

IMHO, the uid test isn't necessary, but it's no big deal.

Looks good.  Thanks again for the work.

Eric


More information about the freebsd-arch mailing list