git: 627511cb1e84 - stable/15 - vmimage.subr: Support NO_ROOT pkgbase

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Fri, 03 Oct 2025 16:53:49 UTC
The branch stable/15 has been updated by cperciva:

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

commit 627511cb1e842844a0897f19b81e13fed208d2fb
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2025-10-03 07:23:43 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-10-03 16:50:37 +0000

    vmimage.subr: Support NO_ROOT pkgbase
    
    We need to tell pkg to record files in METALOG; otherwise when we
    create the VM image it's almost empty.
    
    MFC after:      6 hours
    Sponsored by:   https://www.patreon.com/cperciva
    
    (cherry picked from commit 08b497dc6c4da23be83f7cd51edff07f09d63fd6)
---
 release/tools/vmimage.subr | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr
index fba09d532b4a..27cca78be6e3 100644
--- a/release/tools/vmimage.subr
+++ b/release/tools/vmimage.subr
@@ -95,6 +95,9 @@ vm_install_base() {
 		pkg_cmd="pkg --rootdir ${DESTDIR} --repo-conf-dir ${PKGBASE_REPO_DIR}
 			-o ASSUME_ALWAYS_YES=yes -o IGNORE_OSVERSION=yes
 			-o ABI=${PKG_ABI} -o INSTALL_AS_USER=yes "
+		if -n "${NO_ROOT}" ]; then
+			pkg_cmd="$pkg_cmd -o METALOG=METALOG"
+		fi
 		$pkg_cmd update
 		selected=$($pkg_cmd rquery -U -r FreeBSD-base %n | \
 			vm_filter_base_packages | vm_extra_filter_base_packages)