git: eec0cbd26887 - stable/15 - vmimage.subr: Fix NO_ROOT build in ..._rmcache
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 03 Oct 2025 16:53:47 UTC
The branch stable/15 has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=eec0cbd268877912c6f2a4633ad1c34c357d6370
commit eec0cbd268877912c6f2a4633ad1c34c357d6370
Author: Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2025-10-03 01:06:44 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-10-03 16:50:29 +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
(cherry picked from commit 86221f965c06efa1cd5b2da640ae23edded7c8b9)
---
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