From owner-freebsd-arch@FreeBSD.ORG Tue Jun 26 21:54:12 2012 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B089106566C for ; Tue, 26 Jun 2012 21:54:12 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from aussmtpmrkpc120.us.dell.com (aussmtpmrkpc120.us.dell.com [143.166.82.159]) by mx1.freebsd.org (Postfix) with ESMTP id 05A6C8FC0C for ; Tue, 26 Jun 2012 21:54:11 +0000 (UTC) X-Loopcount0: from 64.238.244.148 X-IronPort-AV: E=Sophos;i="4.77,480,1336366800"; d="scan'208";a="506489892" Received: from mail.compellent.com ([64.238.244.148]) by aussmtpmrkpc120.us.dell.com with ESMTP; 26 Jun 2012 16:54:11 -0500 Message-ID: <4FEA2F82.3080705@vangyzen.net> Date: Tue, 26 Jun 2012 16:54:10 -0500 From: Eric van Gyzen User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:12.0) Gecko/20120531 Thunderbird/12.0.1 MIME-Version: 1.0 To: "Simon J. Gerraty" References: <20120626063017.D05DA58081@chaos.jnpr.net> <86wr2uwdgf.fsf@ds4.des.no> <20120626190349.98D5B58081@chaos.jnpr.net> <97FE8A0B-1836-4C60-9086-9C30A1123CE9@bsdimp.com> <4FEA10BD.2080504@vangyzen.net> <20120626202452.3028158081@chaos.jnpr.net> In-Reply-To: <20120626202452.3028158081@chaos.jnpr.net> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Cc: =?ISO-8859-1?Q?v?= , Warner Losh , =?ISO-8859-1?Q?Dag-Erling_Sm=F8rgra?=, freebsd-arch@freebsd.org Subject: Re: Allow user install X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 21:54:12 -0000 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