git: cd730bef74f9 - main - nanobsd: Use mtree -C to produce the metalog

From: Jose Luis Duran <jlduran_at_FreeBSD.org>
Date: Sat, 24 Jan 2026 02:08:00 UTC
The branch main has been updated by jlduran:

URL: https://cgit.FreeBSD.org/src/commit/?id=cd730bef74f9ecc2500fd5c01094dd5bfd34c246

commit cd730bef74f9ecc2500fd5c01094dd5bfd34c246
Author:     Jose Luis Duran <jlduran@FreeBSD.org>
AuthorDate: 2026-01-24 02:06:57 +0000
Commit:     Jose Luis Duran <jlduran@FreeBSD.org>
CommitDate: 2026-01-24 02:06:57 +0000

    nanobsd: Use mtree -C to produce the metalog
    
    Prefer an mtree -C output, which is guaranteed to be mtree-compatible.
    Add "gname", "uname", and "tags" to the default keyword set, while
    removing "size" and "time", the latter being set on kernel file entries
    and taking precedence over makefs -T (when paired with -F).
    
    As a side effect, this produces a cleaner file with sorted keywords.
    
    Note that passing "-u" to sort in order to pipe to mtree is no longer
    necessary, but we'll do it out of habit.
    
    Reviewed by:    imp
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D54854
---
 tools/tools/nanobsd/defaults.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh
index a0a186cee42f..31f3df9a3086 100755
--- a/tools/tools/nanobsd/defaults.sh
+++ b/tools/tools/nanobsd/defaults.sh
@@ -554,8 +554,8 @@ run_late_customize() {
 #
 fixup_before_diskimage() {
 	# Run the deduplication script that takes the metalog journal and
-	# combines multiple entries for the same file (see source for
-	# details). We take the extra step of removing the size keywords. This
+	# combines multiple entries for the same file (see source for details).
+	# We take the extra step of removing the size and time keywords. This
 	# script, and many of the user scripts, copies, appends and otherwise
 	# modifies files in the build, changing their sizes.  These actions are
 	# impossible to trap, so go ahead remove the size= keyword. For this
@@ -566,7 +566,7 @@ fixup_before_diskimage() {
 		cp ${NANO_METALOG} ${NANO_METALOG}.pre
 		echo "/set uname=${NANO_DEF_UNAME} gname=${NANO_DEF_GNAME}" > ${NANO_METALOG}
 		cat ${NANO_METALOG}.pre | ${NANO_TOOLS}/mtree-dedup.awk | \
-		    sed -e 's/ size=[0-9][0-9]*//' | sort >> ${NANO_METALOG}
+		    sort -u | mtree -C -K uname,gname,tags -R size,time >> ${NANO_METALOG}
 	fi
 }