The branch main has been updated by cperciva:

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

commit 86221f965c06efa1cd5b2da640ae23edded7c8b9
Author:     Colin Percival <[email protected]>
AuthorDate: 2025-10-03 01:06:44 +0000
Commit:     Colin Percival <[email protected]>
CommitDate: 2025-10-03 01:06:44 +0000

    vmimage.subr: Fix NO_ROOT build in ..._rmcache
    
    When doing a NO_ROOT build we can't run pkg inside a chroot, for
    multiple reasons including not having /dev mounted.
    
    MFC after:      6 hours
    Sponsored by:   https://www.patreon.com/cperciva
---
 release/tools/vmimage.subr | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr
index f307e7888e93..fba09d532b4a 100644
--- a/release/tools/vmimage.subr
+++ b/release/tools/vmimage.subr
@@ -250,9 +250,16 @@ vm_emulation_cleanup() {
 }
 
 vm_extra_pkg_rmcache() {
-       if [ -e ${DESTDIR}/usr/local/sbin/pkg ]; then
-               chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes \
-                       /usr/local/sbin/pkg clean -y -a
+       if [ -n "${NO_ROOT}" ]; then
+               ${PKG_CMD} \
+                   -o ASSUME_ALWAYS_YES=yes \
+                   -r ${DESTDIR} \
+                   clean -y -a
+       else
+               if [ -e ${DESTDIR}/usr/local/sbin/pkg ]; then
+                       chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes 
\
+                           /usr/local/sbin/pkg clean -y -a
+               fi
        fi
 
        return 0

Reply via email to