git: 7c4d6fbd1b79 - main - nanobsd: Add a function to create directories
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 17 Jan 2026 18:13:03 UTC
The branch main has been updated by jlduran:
URL: https://cgit.FreeBSD.org/src/commit/?id=7c4d6fbd1b7970703f7d14f3acfba5dbcd168644
commit 7c4d6fbd1b7970703f7d14f3acfba5dbcd168644
Author: Jose Luis Duran <jlduran@FreeBSD.org>
AuthorDate: 2026-01-17 18:06:58 +0000
Commit: Jose Luis Duran <jlduran@FreeBSD.org>
CommitDate: 2026-01-17 18:06:58 +0000
nanobsd: Add a function to create directories
Add tgt_dir(), that creates and adds directory entries to the metalog
specification file. Initially not wired.
Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D48786
---
tools/tools/nanobsd/defaults.sh | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh
index 50c6770dfcab..be4126516c3d 100755
--- a/tools/tools/nanobsd/defaults.sh
+++ b/tools/tools/nanobsd/defaults.sh
@@ -286,6 +286,25 @@ tgt_dir2symlink() (
fi
)
+#
+# Create directories in the target tree, and record the fact. All paths
+# are relative to NANO_WORLDDIR.
+#
+tgt_dir() {
+ for i; do
+ mkdir -p "${NANO_WORLDDIR}/${i}"
+
+ if [ -n "$NANO_METALOG" ]; then
+ path=""
+ for dir in $(echo "$i" | tr "/" " "); do
+ path="${path}/${dir}"
+ echo ".${path} type=dir uname=${NANO_DEF_UNAME}" \
+ "gname=${NANO_DEF_GNAME} mode=0755" >> "${NANO_METALOG}"
+ done
+ fi
+ done
+}
+
# run in the world chroot, errors fatal
CR() {
chroot "${NANO_WORLDDIR}" /bin/sh -exc "$*"