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