Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jun 2012 16:54:10 -0500
From:      Eric van Gyzen <eric@vangyzen.net>
To:        "Simon J. Gerraty" <sjg@juniper.net>
Cc:        =?ISO-8859-1?Q?v?= <des@des.no>, Warner Losh <wlosh@bsdimp.com>, =?ISO-8859-1?Q?Dag-Erling_Sm=F8rgra?=, freebsd-arch@freebsd.org
Subject:   Re: Allow user install
Message-ID:  <4FEA2F82.3080705@vangyzen.net>
In-Reply-To: <20120626202452.3028158081@chaos.jnpr.net>
References:  <20120626063017.D05DA58081@chaos.jnpr.net> <86wr2uwdgf.fsf@ds4.des.no> <CAGE5yCobmB6PyCzqSxVgbBomuE7AHWmUd5e4pEqHNeFvxpZCAQ@mail.gmail.com> <CAGE5yCqy5bRoNNDc_4hK9wtvVxEzoQrjNvGyLOvJy2VZAF=tZw@mail.gmail.com> <20120626190349.98D5B58081@chaos.jnpr.net> <97FE8A0B-1836-4C60-9086-9C30A1123CE9@bsdimp.com> <4FEA10BD.2080504@vangyzen.net> <20120626202452.3028158081@chaos.jnpr.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4FEA2F82.3080705>