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>
next in thread | previous in thread | raw e-mail | index | archive | help
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(__<bsd.own.mk>__) I like this a lot more. Warner
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?97FE8A0B-1836-4C60-9086-9C30A1123CE9>