Subject: Re: Unpriviledged installs (was Re: CVS commit: sharesrc)
To: Michael Richardson <mcr@sandelman.ottawa.on.ca>
From: Simon Burge <simonb@netbsd.org>
List: tech-install
Date: 08/16/1999 11:58:48
Michael Richardson wrote:

> >>>>> "Simon" == Simon Burge <simonb@netbsd.org> writes:
>     Simon> In bsd.doc.mk and bsd.files.mk "${INSTALL} ${RENAME} ${PRESERVE}" has
>     Simon> changed to "${INSTALL} ${PRESERVE}".  Is there a reason for this?  The
>     Simon> other files seem ok.
> 
>   This is a mistake. What is the intended purpose of ${RENAME}, btw.
> 
>     Simon> That said, wouldn't it be easier to use the -U option of install?  I'm
>     Simon> pretty sure that -U came well after PR #3563.  From the install(1)
>     Simon> manpage:
> 
>   This is new. Yes, it would be better. As such, I withdraw my patches.
> 
>     Simon>      -U      Indicate that install is running unpriviledged, and that it
>     Simon>              should not try to change the owner or the group of the destina-
>     Simon>              tion.  A future version of this file may log the owner/group in-
>     Simon>              formation elsewhere; currently, it's just discarded.
> 
>     Simon> Then we could just stick
> 
>     Simon> 	UNPRIVILEDGED?=
> 
>     Simon> in bsd.own.mk and use that on all the install commands...
> 
>   Yes, please!
>   Do you want me to do these patches?

I think there's a slightly better way of doing this.  In bsd.README:

	UNPRIVILEDGED   If defined, don't set the owner/group/mode when installing
			files or directories (incomplete).

and then in <bsd.own.mk>

	.if defined(UNPRIVILEDGED)
	INSTPRIV?=      -U
	.endif

and use ${INSTPRIV} in the ${INSTALL} lines.  This was UNPRIVILEDGED can
be used to tweak a class of things (mtree comes to mind - I'll look at
that next).

Sound good?

Simon.