Importing NetBSD mtree(8)

FreeBSD and NetBSD have developed mtree(8) separately for quite some time. NetBSD's mtree has a number of useful features that would be useful to our installation process. Specifically NetBSD's mtree supports full paths to file system objects rather than implying them from a prior series of directory names and ..'s. This syntax is understood by libarchive and thus bsdtar as well as makefs to allow file systems to be generated from collections of files that were installed with permissions settable by ordinary users. With the addition of NetBSD's install these can be generated during the installworld process and then applied to an image, all without root permissions.

Missing FreeBSD features in NetBSD mtree

The following features have been implemented in FreeBSD's mtree. They most likley need to be added to NetBSD's mtree before it can be imported:

Option or Field

Description

Notes

Status

-f spec1 -f spec2

Compare two spec files

http://svnweb.freebsd.org/base?view=revision&revision=122141

-i

Indent the output 4 spaces each time a directory level is descended when creating a specification with the -c option.

Mostly useless and conflicts with the NetBSD option to "set the schg and/or sappnd flags."

-n

Don't emit comments

In projects/mtree branch. r240748

-q

Quiet mode

In projects/mtree branch. r240749

-w

Make some errors non-fatal warnings

NetBSD's default behavior is like -w but without the warnings. Make -w a no-op.

In projects/mtree branch. r240751

ripemd160digest

The RIPEMD160 message digest of the file

seems to be spelled rmd160(digest)

In projects/mtree branch. r240746

nochange

Make sure this file or directory exists but otherwise ignore all attributes.

Missing FreeBSD library functions

Funcation

Description

Notes

Status

flags_to_string()

Trivial wrapper around fflagstostr()

In util.h in NetBSD vis libc in FreeBSD. Probably just add a wrapper for mtree's internal use, but could add to libc and unistd.h.

Implemented wrapper functions in mtree source directory.

string_to_flags()

Identical to strtofflags()

same issues as flags_to_string

Implemented wrapper function in mtree source directory.

strsvis()

Allow encoding other character sets

probably just pull the vis.3 set from NetBSD

In projects/mtree branch. Compat wrapper for unvis().

pwcache_userdb()

allow alternative lookups for m/uid_from_user

Grab the lot from NetBSD.

In projects/mtree branch.

uid_from_user()

reverse of user_from_uid

projects/mtree branch

pwcache_groupdb()

allow alternative lookups for group_from_gid/gid_from_user

projects/mtree branch

gid_from_group()

reverse of group_from_gid()

projects/mtree branch

Things to verify

NetBSDMtree (last edited 2012-09-20 15:20:03 by BrooksDavis)