From owner-freebsd-arch@FreeBSD.ORG Tue Jun 26 19:05:15 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 64F011065689 for ; Tue, 26 Jun 2012 19:05:15 +0000 (UTC) (envelope-from sjg@juniper.net) Received: from exprod7og127.obsmtp.com (exprod7og127.obsmtp.com [64.18.2.210]) by mx1.freebsd.org (Postfix) with ESMTP id 515CC8FC18 for ; Tue, 26 Jun 2012 19:05:14 +0000 (UTC) Received: from P-EMHUB03-HQ.jnpr.net ([66.129.224.36]) (using TLSv1) by exprod7ob127.postini.com ([64.18.6.12]) with SMTP ID DSNKT+oH41RN6oSSjb+px7vYznLNNQvNPWgW@postini.com; Tue, 26 Jun 2012 12:05:15 PDT Received: from magenta.juniper.net (172.17.27.123) by P-EMHUB03-HQ.jnpr.net (172.24.192.33) with Microsoft SMTP Server (TLS) id 8.3.213.0; Tue, 26 Jun 2012 12:03:50 -0700 Received: from chaos.jnpr.net (chaos.jnpr.net [172.24.29.229]) by magenta.juniper.net (8.11.3/8.11.3) with ESMTP id q5QJ3nh03738; Tue, 26 Jun 2012 12:03:50 -0700 (PDT) (envelope-from sjg@juniper.net) Received: from chaos.jnpr.net (localhost [127.0.0.1]) by chaos.jnpr.net (Postfix) with ESMTP id 98D5B58081; Tue, 26 Jun 2012 12:03:49 -0700 (PDT) To: Peter Wemm In-Reply-To: References: <20120626063017.D05DA58081@chaos.jnpr.net> <86wr2uwdgf.fsf@ds4.des.no> Comments: In-reply-to: Peter Wemm message dated "Tue, 26 Jun 2012 10:36:41 -0700." From: "Simon J. Gerraty" X-Mailer: MH-E 7.82+cvs; nmh 1.3; GNU Emacs 22.3.1 Date: Tue, 26 Jun 2012 12:03:49 -0700 Message-ID: <20120626190349.98D5B58081@chaos.jnpr.net> MIME-Version: 1.0 Content-Type: text/plain Cc: =?ISO-8859-1?Q?Dag=2DErling_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:05:15 -0000 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(____)