From owner-freebsd-arch@FreeBSD.ORG Tue Jun 26 19:11:40 2012 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AAD561065676 for ; Tue, 26 Jun 2012 19:11:40 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 671CC8FC19 for ; Tue, 26 Jun 2012 19:11:40 +0000 (UTC) Received: by obbun3 with SMTP id un3so355552obb.13 for ; Tue, 26 Jun 2012 12:11:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer :x-gm-message-state; bh=gyNzKD8QxsQAeWCzo6318wlBhx05nWBGnfMZpE+G93c=; b=fQMVXF9Xul6skQBwBkUp9T9pZ76pojvuskgP7Y/DTfQEYiBUXudd2iEicc+HAfH2S4 fAiW8erJ/Q4/yC6rIch381+3NoZjewn3VB99jj2S4vL7eP2WZP5TtgDYlZWv230NJNJZ xO9XcQ7TDZa64k6Tu29SYURYxzMrwWiPclbCO95jeAY67OXr/KjG6RNf+PxTDxPZeQht f0sQtAYrI19r9dniz7artx7rbROAHcqD7mHE45ed7IMMU/DBAg9pFbikDQmeT/3JowzN SOwQnDbA1M4b9001fgTBNyUS4EAnwpG584qv6h8zsYu3k1HFNj3rgdi9GPENp9ah7S4d p2WA== Received: by 10.182.17.42 with SMTP id l10mr17525695obd.52.1340737899731; Tue, 26 Jun 2012 12:11:39 -0700 (PDT) Received: from [10.30.101.53] ([209.117.142.2]) by mx.google.com with ESMTPS id n6sm7534653oba.9.2012.06.26.12.11.38 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 26 Jun 2012 12:11:38 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <20120626190349.98D5B58081@chaos.jnpr.net> Date: Tue, 26 Jun 2012 13:11:36 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <97FE8A0B-1836-4C60-9086-9C30A1123CE9@bsdimp.com> References: <20120626063017.D05DA58081@chaos.jnpr.net> <86wr2uwdgf.fsf@ds4.des.no> <20120626190349.98D5B58081@chaos.jnpr.net> To: "Simon J. Gerraty" X-Mailer: Apple Mail (2.1084) X-Gm-Message-State: ALoCoQlCPXsPoSOusJJBGzErPEENCGo9lHHRzKwqmnzYym99w8b0yQaTW02Kx2RkyCKOVb4uv1W6 Cc: =?iso-8859-1?Q?Dag-Erling_Sm=F8rgrav?= , 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 19:11:40 -0000 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=3D3D`id -u` BINGRP=3D3D`id -g` SHAREOWN=3D3D`id -u` ... = NO_FSCHG=3D3D=3D >> y >=20 >> 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. >=20 > Good point. >=20 >> 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} \ >>=20 >> It works either way for me, of course. >=20 > 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} >=20 > So the patch would become just something like the following to > bsd.own.mk (WITH_INSTALL_AS_USER ignored for root)=20 > and the result looks like: >=20 > $ make -C bin/cat -n install -DWITH_INSTALL_AS_USER DESTDIR=3D/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 > $ >=20 > Index: share/mk/bsd.own.mk > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- 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=3D @: > .endif=20 >=20 > +_uid!=3D id -u > +.if ${MK_INSTALL_AS_USER} !=3D "no" && ${_uid} !=3D 0 > +_gid!=3D id -g > +.for x in BIN CONF DOC INFO KMOD LIB MAN NLS SHARE > +$xOWN =3D ${_uid} > +$xGRP =3D ${_gid} > +.endfor > +.endif > + > .endif # !_WITHOUT_SRCCONF >=20 > .endif # !target(____) I like this a lot more. Warner