Allow user install
Eric van Gyzen
eric at vangyzen.net
Tue Jun 26 19:42:55 UTC 2012
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(__<bsd.own.mk>__)
>
> I like this a lot more.
Me too. We're doing almost exactly that, directly in make.conf. Yours
is cleaner, of course.
Eric
More information about the freebsd-arch
mailing list