Tar output mode for installworld

Tim Kientzle kientzle at freebsd.org
Sun Jul 15 03:21:49 UTC 2007


Joerg Sonnenberger wrote:
> On Sat, Jul 14, 2007 at 01:20:15PM -0700, Tim Kientzle wrote:
> 
>>This is easy to implement using a trick that I stumbled
>>across a few years ago.  The idea is to just build
>>a description of the final archive in a nice verbose
>>text format such as:
> 
> ...which is done by NetBSD for the unprivileged release building via
> build.sh. Anyone interested in working on this should possibly have a
> look there.

Interesting.  I hadn't looked at NetBSD's unprivileged
release build before.  I just skimmed through some of it.
Parts of it seems a little roundabout, but I like the
use of a modified mtree format as the specification format:

usr/bin/su type=file mode=04555 uname=root gname=wheel 
time=1057493599.102665

I would make two changes:

1) Add a contents=<path> option.  With this, DESTDIR is
mostly irrelevant, since the path can just refer to the
file in the build tree.

2) Allow multiple lines for any file.  This complicates
the consumer of this file a bit, but simplifies the build
process, since you can emit separate information as you find
it.  For example, the regular install process could install
rcp by emitting:
    bin/rcp type=file mode=04555 contents=/usr/obj/usr/src/bin/rcp
and then a later point in the build process could add the
flag by adding the line:
    bin/rcp flags=schg

Hmmm...  It would be easy for libarchive to parse this
format and then bsdtar's existing "archive conversion"
feature could trivially generate a tar.gz output from
such a specification.

Another idea would be to create an install program that
accepted this format as the command line:
   mtree_install usr/bin/su type=file mode=04555 uname=root ...
Then the build logic gets scary simple:  A regular build
sets INSTALL=mtree_install, a tar.gz build sets INSTALL=echo.
(Hmmm... Maybe a tad more complex than this, but close.)
(You could also modify the specification file so that the
file specs mimicked 'install' options.)

Tim Kientzle


More information about the freebsd-hackers mailing list