Page MenuHomeFreeBSD

pw: Add a metalog output mode
ClosedPublic

Authored by markj on Sep 16 2025, 11:29 PM.
Tags
None
Referenced Files
F168909724: D52590.diff
Sun, Aug 30, 5:21 PM
Unknown Object (File)
Fri, Aug 28, 5:16 PM
Unknown Object (File)
Wed, Aug 26, 5:10 PM
Unknown Object (File)
Mon, Aug 24, 5:15 PM
Unknown Object (File)
Sat, Aug 22, 10:34 PM
Unknown Object (File)
Sat, Aug 22, 4:04 PM
Unknown Object (File)
Tue, Aug 18, 2:55 AM
Unknown Object (File)
Sun, Aug 16, 6:01 AM
Subscribers

Details

Summary

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.

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

emaste added inline comments.
usr.sbin/pw/pw.c
259–260

maybe worth doing this bugfix separately so we can MFC it in advance of other changes here?

usr.sbin/pw/pw_utils.c
97

This _ convention seems a bit unusual

This revision is now accepted and ready to land.Sep 18 2025, 2:10 AM
bapt added inline comments.
usr.sbin/pw/pw_utils.c
124

I wonder if it won't be smart to move the metalog_emit to libutil later so it can be used by other tools

markj added inline comments.
usr.sbin/pw/pw_utils.c
97

Ok, I will rename it to metalog_emit_record().

116

I'm not handling file flags here. I don't think pw sets any, but we should handle that anyway.

124

Maybe, yeah. It's a fairly simple routine though, and different consumers have different requirements (e.g., uname/gname vs. uid/gid, some consumers want to flock the metalog, ...).

This revision was automatically updated to reflect the committed changes.
markj marked an inline comment as done.