git: bc77aa7df733 - main - release: install etc files from the source tree, not the host

From: Doug Rabson <dfr_at_FreeBSD.org>
Date: Fri, 10 Jan 2025 14:24:31 UTC
The branch main has been updated by dfr:

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

commit bc77aa7df7339b166c0d6394526fe59dea89f4b1
Author:     Doug Rabson <dfr@FreeBSD.org>
AuthorDate: 2024-12-23 10:19:27 +0000
Commit:     Doug Rabson <dfr@FreeBSD.org>
CommitDate: 2025-01-10 14:21:10 +0000

    release: install etc files from the source tree, not the host
    
    Reviewed by: cperciva
    MFC after:   3 days
    Differential Revision:  https://reviews.freebsd.org/D48180
---
 release/Makefile.oci                |  2 ++
 release/tools/oci-image-static.conf | 21 ++++++++++++---------
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/release/Makefile.oci b/release/Makefile.oci
index 461c95f49636..da35156c5a95 100644
--- a/release/Makefile.oci
+++ b/release/Makefile.oci
@@ -24,6 +24,8 @@ OCI_DEPS_minimal= container-image-dynamic.txz
 .for _IMG in ${OCI_IMAGES}
 OCI_TARGETS+= container-image-${_IMG}.txz
 container-image-${_IMG}.txz: ${OCI_DEPS_${_IMG}}
+	# Adjust PATH so that we run pwd_mkdb from the bootstrap tools
+	env PATH=${OBJTOP}/tmp/legacy/bin:${PATH:Q} \
 	sh ${.CURDIR}/scripts/make-oci-image.sh ${.CURDIR} ${REVISION} ${BRANCH} ${TARGET_ARCH} ${_IMG}
 	skopeo copy \
 		containers-storage:localhost/freebsd${REVISION:R}-${_IMG}:latest \
diff --git a/release/tools/oci-image-static.conf b/release/tools/oci-image-static.conf
index 27cfb3c6778c..552328e66f3c 100644
--- a/release/tools/oci-image-static.conf
+++ b/release/tools/oci-image-static.conf
@@ -7,17 +7,20 @@
 OCI_BASE_IMAGE=
 
 oci_image_build() {
-	mtree -deU -p $m/ -f /etc/mtree/BSD.root.dist > /dev/null
-	mtree -deU -p $m/var -f /etc/mtree/BSD.var.dist > /dev/null
-	mtree -deU -p $m/usr -f /etc/mtree/BSD.usr.dist > /dev/null
-	mtree -deU -p $m/usr/include -f /etc/mtree/BSD.include.dist > /dev/null
-	mtree -deU -p $m/usr/lib -f /etc/mtree/BSD.debug.dist > /dev/null
+	local srcdir=${curdir}/..
+	mtree -deU -p $m/ -f ${srcdir}/etc/mtree/BSD.root.dist > /dev/null
+	mtree -deU -p $m/var -f ${srcdir}/etc/mtree/BSD.var.dist > /dev/null
+	mtree -deU -p $m/usr -f ${srcdir}/etc/mtree/BSD.usr.dist > /dev/null
+	mtree -deU -p $m/usr/include -f ${srcdir}/etc/mtree/BSD.include.dist > /dev/null
+	mtree -deU -p $m/usr/lib -f ${srcdir}/etc/mtree/BSD.debug.dist > /dev/null
 	install_packages ${abi} ${workdir} $m FreeBSD-caroot FreeBSD-zoneinfo
-	cp /etc/master.passwd $m/etc
+	cp ${srcdir}/etc/master.passwd $m/etc
 	pwd_mkdb -p -d $m/etc $m/etc/master.passwd || return $?
-	cp /etc/group $m/etc || return $?
-	cp /etc/termcap.small $m/etc/termcap.small || return $?
-	cp /etc/termcap.small $m/usr/share/misc/termcap || return $?
+	cp ${srcdir}/etc/group $m/etc || return $?
+	# termcap.small is generated so we get it from OBJDIR - make sets our
+	# working directory to OBJDIR/release
+	cp ../etc/termcap/termcap.small $m/etc/termcap.small || return $?
+	cp ../etc/termcap/termcap.small $m/usr/share/misc/termcap || return $?
 	env DESTDIR=$m /usr/sbin/certctl rehash
 	# Generate a suitable repo config for pkgbase
 	case ${branch} in