git: e9f564a47e93 - stable/15 - release: Made it possible to specify more attributes in metalog entries
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 03 Oct 2025 16:53:37 UTC
The branch stable/15 has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=e9f564a47e93a1c6bf806c13d8d6612d5a252c21
commit e9f564a47e93a1c6bf806c13d8d6612d5a252c21
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-09-11 13:05:13 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-10-03 16:41:57 +0000
release: Made it possible to specify more attributes in metalog entries
Verify that the target file or directory exists, and add support for an
optional mode. This is required to enable NO_ROOT builds of some
cloudware image types. No functional change intended.
Reviewed by: cperciva, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D52449
(cherry picked from commit 6207325f3aac067fb16f0aa42012302014035ebf)
---
release/tools/vmimage.subr | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr
index 9ee2e1d47a59..dbec38485fec 100644
--- a/release/tools/vmimage.subr
+++ b/release/tools/vmimage.subr
@@ -39,8 +39,21 @@ cleanup() {
}
metalog_add_data() {
+ local file mode type
+
if [ -n "${NO_ROOT}" ]; then
- echo "$1 type=file uname=root gname=wheel mode=0644" >> \
+ file=$1
+ if [ -f ${DESTDIR}/${file} ]; then
+ type=file
+ mode=${2:-0644}
+ elif [ -d ${DESTDIR}/${file} ]; then
+ type=dir
+ mode=${2:-0755}
+ else
+ echo "metalog_add_data: ${file} not found" >&2
+ return 1
+ fi
+ echo "${file} type=${type} uname=root gname=wheel mode=${mode}" >> \
${DESTDIR}/METALOG
fi
}