From owner-freebsd-arch@FreeBSD.ORG Tue Jun 26 19:42:55 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 3EE451065675 for ; Tue, 26 Jun 2012 19:42:55 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from aussmtpmrkps320.us.dell.com (aussmtpmrkps320.us.dell.com [143.166.224.254]) by mx1.freebsd.org (Postfix) with ESMTP id 064CE8FC16 for ; Tue, 26 Jun 2012 19:42:54 +0000 (UTC) X-Loopcount0: from 64.238.244.148 X-IronPort-AV: E=Sophos;i="4.77,480,1336366800"; d="scan'208";a="535457048" Received: from mail.compellent.com ([64.238.244.148]) by aussmtpmrkps320.us.dell.com with ESMTP; 26 Jun 2012 14:42:54 -0500 Message-ID: <4FEA10BD.2080504@vangyzen.net> Date: Tue, 26 Jun 2012 14:42:53 -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: Warner Losh References: <20120626063017.D05DA58081@chaos.jnpr.net> <86wr2uwdgf.fsf@ds4.des.no> <20120626190349.98D5B58081@chaos.jnpr.net> <97FE8A0B-1836-4C60-9086-9C30A1123CE9@bsdimp.com> In-Reply-To: <97FE8A0B-1836-4C60-9086-9C30A1123CE9@bsdimp.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Cc: =?ISO-8859-1?Q?rgrav?= , freebsd-arch@freebsd.org, =?ISO-8859-1?Q?Dag-Erling_Sm=F8?=, "Simon J. Gerraty" 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 19:42:55 -0000 On 06/26/2012 14:11, Warner Losh wrote: > > On Jun 26, 2012, at 1:03 PM, Simon J. Gerraty wrote: >> On Tue, 26 Jun 2012 10:36:41 -0700, Peter Wemm writes: >>>> make BINOWN=3D`id -u` BINGRP=3D`id -g` SHAREOWN=3D`id -u` ... NO_FSCHG=3D= >>> y >> >>> For what its worth, the footprint of the diff can be reduced >>> considerably if you take advantage of the fact that "install -o $you >>> -g $you ..." works and is a no-op. >> >> Good point. >> >>> In the attached patch, things like this wouldn't strictly be needed if >>> it was done that way. >>> - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ >>> + ${INSTALL} ${BIN_INSTALL_OWN} -m ${BINMODE} \ >>> >>> It works either way for me, of course. >> >> Well if folk don't think -o ${USER} etc is too ugly (I've used that >> approach before too ;-) >> It has the distinct advantage of not needing to frob every Makefile >> that uses ${INSTALL} >> >> So the patch would become just something like the following to >> bsd.own.mk (WITH_INSTALL_AS_USER ignored for root) >> and the result looks like: >> >> $ make -C bin/cat -n install -DWITH_INSTALL_AS_USER DESTDIR=/tmp >> install -s -o 420 -g 690 -m 555 cat /tmp/bin >> install -o 420 -g 690 -m 444 cat.1.gz /tmp/usr/share/man/man1 >> $ >> >> Index: share/mk/bsd.own.mk >> =================================================================== >> --- share/mk/bsd.own.mk (revision 237964) >> +++ share/mk/bsd.own.mk (working copy) >> @@ -427,6 +427,7 @@ >> HESIOD \ >> ICONV \ >> IDEA \ >> + INSTALL_AS_USER \ >> LIBCPLUSPLUS \ >> NAND \ >> OFED \ >> @@ -645,6 +646,15 @@ >> CTFCONVERT_CMD= @: >> .endif >> >> +_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} >> +.endfor >> +.endif >> + >> .endif # !_WITHOUT_SRCCONF >> >> .endif # !target(____) > > I like this a lot more. Me too. We're doing almost exactly that, directly in make.conf. Yours is cleaner, of course. Eric