Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jun 2012 12:03:49 -0700
From:      "Simon J. Gerraty" <sjg@juniper.net>
To:        Peter Wemm <peter@wemm.org>
Cc:        =?ISO-8859-1?Q?Dag=2DErling_Sm=F8rgrav?= <des@des.no>, freebsd-arch@freebsd.org
Subject:   Re: Allow user install
Message-ID:  <20120626190349.98D5B58081@chaos.jnpr.net>
In-Reply-To: <CAGE5yCqy5bRoNNDc_4hK9wtvVxEzoQrjNvGyLOvJy2VZAF=tZw@mail.gmail.com>
References:  <20120626063017.D05DA58081@chaos.jnpr.net> <86wr2uwdgf.fsf@ds4.des.no> <CAGE5yCobmB6PyCzqSxVgbBomuE7AHWmUd5e4pEqHNeFvxpZCAQ@mail.gmail.com> <CAGE5yCqy5bRoNNDc_4hK9wtvVxEzoQrjNvGyLOvJy2VZAF=tZw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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(__<bsd.own.mk>__)



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