git: 7fde3e62231a - main - beinstall: Avoid chrooting into new world

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Fri, 10 Jul 2026 15:05:41 UTC
The branch main has been updated by emaste:

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

commit 7fde3e62231ac397a779e4fef729908c5ef6f53a
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2025-06-04 13:33:30 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2026-07-10 15:04:45 +0000

    beinstall: Avoid chrooting into new world
    
    The new world may use system calls that are not in the currently-running
    kernel, so we cannot chroot into the new environment to run `make
    installworld`, `etcupdate`, etc.  Partially revert commit 16702050ac95
    ("beinstall: perform pre-installworld steps") and switch back to using
    DESTDIR for installworld and so on.
    
    Reported by:    olivier
    Reviewed by:    olivier
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D50682
---
 tools/build/beinstall.sh | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/build/beinstall.sh b/tools/build/beinstall.sh
index dcafd1030c91..e4ae4a81617b 100755
--- a/tools/build/beinstall.sh
+++ b/tools/build/beinstall.sh
@@ -125,9 +125,8 @@ update_etcupdate_pre() {
 }
 
 update_etcupdate() {
-	chroot ${BE_MNTPT} \
-		${ETCUPDATE_CMD} -s ${srcdir} ${ETCUPDATE_FLAGS} || return $?
-	chroot ${BE_MNTPT} ${ETCUPDATE_CMD} resolve
+	${ETCUPDATE_CMD} -s ${srcdir} ${ETCUPDATE_FLAGS} || return $?
+	${ETCUPDATE_CMD} resolve -D ${BE_MNTPT}
 }
 
 
@@ -216,7 +215,7 @@ mount -t nullfs "${srcdir}" "${BE_MNTPT}${srcdir}" || errx "Unable to mount src"
 mount -t nullfs "${objdir}" "${BE_MNTPT}${objdir}" || errx "Unable to mount obj"
 mount -t devfs devfs "${BE_MNTPT}/dev" || errx "Unable to mount devfs"
 
-chroot ${BE_MNTPT} make "$@" -C ${srcdir} installworld || \
+make "$@" DESTDIR=${BE_MNTPT} -DDB_FROM_SRC installworld || \
 	errx "Installworld failed!"
 
 if [ -n "${CONFIG_UPDATER}" ]; then