Skip to content

Commit 86221f9

Browse files
committed
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
1 parent 5c5c057 commit 86221f9

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

release/tools/vmimage.subr

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,16 @@ vm_emulation_cleanup() {
250250
}
251251

252252
vm_extra_pkg_rmcache() {
253-
if [ -e ${DESTDIR}/usr/local/sbin/pkg ]; then
254-
chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes \
255-
/usr/local/sbin/pkg clean -y -a
253+
if [ -n "${NO_ROOT}" ]; then
254+
${PKG_CMD} \
255+
-o ASSUME_ALWAYS_YES=yes \
256+
-r ${DESTDIR} \
257+
clean -y -a
258+
else
259+
if [ -e ${DESTDIR}/usr/local/sbin/pkg ]; then
260+
chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes \
261+
/usr/local/sbin/pkg clean -y -a
262+
fi
256263
fi
257264

258265
return 0

0 commit comments

Comments
 (0)