Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jun 2012 13:11:36 -0600
From:      Warner Losh <wlosh@bsdimp.com>
To:        "Simon J. Gerraty" <sjg@juniper.net>
Cc:        =?iso-8859-1?Q?Dag-Erling_Sm=F8rgrav?= <des@des.no>, freebsd-arch@freebsd.org
Subject:   Re: Allow user install
Message-ID:  <97FE8A0B-1836-4C60-9086-9C30A1123CE9@bsdimp.com>
In-Reply-To: <20120626190349.98D5B58081@chaos.jnpr.net>
References:  <20120626063017.D05DA58081@chaos.jnpr.net> <86wr2uwdgf.fsf@ds4.des.no> <CAGE5yCobmB6PyCzqSxVgbBomuE7AHWmUd5e4pEqHNeFvxpZCAQ@mail.gmail.com> <CAGE5yCqy5bRoNNDc_4hK9wtvVxEzoQrjNvGyLOvJy2VZAF=tZw@mail.gmail.com> <20120626190349.98D5B58081@chaos.jnpr.net>

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


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

I like this a lot more.

Warner



help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?97FE8A0B-1836-4C60-9086-9C30A1123CE9>