aboutsummaryrefslogtreecommitdiff
path: root/release/tools/vmimage.subr
diff options
context:
space:
mode:
Diffstat (limited to 'release/tools/vmimage.subr')
-rw-r--r--release/tools/vmimage.subr13
1 files 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