Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Sep 2012 15:19:19 -0500
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        arch@freebsd.org
Subject:   Importing NetBSD's mtree (and install)
Message-ID:  <20120917201919.GA43626@lor.one-eyed-alien.net>

next in thread | raw e-mail | index | archive | help

--SLDf9lqlvOQaIe6s
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

As part of an effort to improve our ability to create full system images
without root access I would like to import NetBSD's version of mtree.
By doing so we would gain the -C option which produces mtree files
compatible with libarchive and makefs (one line per file with full
path) and the -N option which allows a stand alone set of passwd and
group files.

When mated with the -U and -M options to NetBSD's install we will have
most[0] of the pieces require to allow installworld to run as a user and
then build images containing proper permissions.  The rest of this post
will focus on my plans for mtree since it is the logical next step.

NetBSD's mtree is missing a few features present in our mtree.  Most of
them looks simple to implement and I plan to do so before any import.
The only exception is -i which implements indenting of old-style mtree
files to match the format of the files in /etc/mtree/.  It will either
need another name or to be dropped.  I honestly don't see the point in
it so I'm not sure if it's worth keeping if people will need to alter
their scripts regardless, but I'm willing to be convinced otherwise.

Importing mtree requires importing or implementing some enhancements to
libc.  First, the strsvis() function is required which is most
easily handled by importing NetBSD's vis/unvis implementations with the
addition of the VIS_GLOB set of characters.  Compatibly wrappers will
be required for existing vis(3) functions and for unvis() due to ABI
changes, but they will be minimal.

Second, pwcache_userdb(), uid_from_user(), pwcache_groupdb(), and
gid_from_group() provide useful enhancements to the uid_from_user()
and group_from_gid().  They appear to be entirely compatible with our
current implementation so simply importing the enhanced version seems
like the best course.

Finally, FreeBSD and Mac OS have the functions fflagstostr() and
strtofflags() in libc.  NetBSD has flags_to_string() and
string_to_flags() in libutil.  The latter could be a very thin wrapper
around fflagstostr() and the former is exactly strtofflags().  I think
the best course is probably to provide compatible wrappers for mtree's
internal use, but I could be convinced to make them more globally
available.

Does anything about this plan seem seriously objectionable?

I've written some of this up along with a list of missing features in
the wiki.  I'll keep progress up to date there:

http://wiki.freebsd.org/NetBSDMtree

-- Brooks

[0] We also lack a tool to build disk images including partition tables,
but Marcel is looking into this.

--SLDf9lqlvOQaIe6s
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iD8DBQFQV4XGXY6L6fI4GtQRAvMoAJ9niVzHRkF+5Hul8mOhM4gnzIwXwgCfUVg/
X8/O6M8IMsX+8KtbmdqgZrs=
=AMp+
-----END PGP SIGNATURE-----

--SLDf9lqlvOQaIe6s--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120917201919.GA43626>