pw: Add a metalog output mode
When creating OS images as a non-root user, it may be useful to
pre-create users in the staged tree. The useradd operation adds files
to the new user's home directory, copied from the skeleton directory
(/usr/share/skel), which makes it inconvient for use in this scenario
since the added files are not recorded in the mtree metalog.
To cover this gap, this change adds a new -M <metalog> option to pw's
useradd operation, causing pw to add mtree entries for newly added
files.
Extend an existing regression test to validate this mode.
Reviewed by: bapt, emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D52590
(cherry picked from commit 182ed3c0755f1bf161d8be02016b5f6cf9b57556)