Subject: Re: UNPRIVED & DESTDIR
To: None <Richard.Earnshaw@arm.com>
From: Luke Mewburn <lukem@wasabisystems.com>
List: tech-toolchain
Date: 05/03/2002 11:16:09
On Tue, Apr 23, 2002 at 03:02:47PM +0100, Richard Earnshaw wrote:
  | Hmm, it seems that the build system doesn't fault attempts to do an 
  | UNPRIVED build into /, at least, it still continues to pass the options to 
  | install to update the METALOG file.
  | 
  | Does install still attempt to correctly set the install flags in this 
  | case, or should the Makefiles be altered to fault this case?
  | 
  | Is there any way to force a privileged re-install into / after an unprived 
  | build?  UNPRIVED is only tested for being defined, not for its value, so 
  | it isn't possible to override the setting through the nbmake-wrapper prog.

If you've built UNPRIVED into a DESTDIR, you can use something like
the following to copy all the files under DESTDIR into / except for
those in ./etc and ./var, retaining the privileges:

	# cd $DESTDIR
	# ( cat etc/mtree/NetBSD.dist $MAKEOBJDIRPREFIX/usr/src/METALOG ) | \
	    sed -e "s,^.$DESTDIR,.,' | \
	    egrep -v '^./(etc|var)/' | \
	    nbpax -rwMvpe /

(change the path to the METALOG as appropriate)

Of course, your mileage may vary, use at your own risk, (...)

Luke.