In vm_extra_install_packages(), only bootstrap pkg(8)

if VM_EXTRA_PACKAGES is empty.

In vm_extra_pre_umount(), cleanup downloaded packages
if pkg(8) was bootstrapped earlier.

Inspired by:	cperciva
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Glen Barber 2014-11-24 02:34:01 +00:00
parent 30a20c89bf
commit a4900ff5a5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/release-vmimage/; revision=274945

View File

@ -114,14 +114,15 @@ vm_extra_enable_services() {
}
vm_extra_install_packages() {
if [ -z "${VM_EXTRA_PACKAGES}" ]; then
return 0
fi
mkdir -p ${DESTDIR}/dev
mount -t devfs devfs ${DESTDIR}/dev
chroot ${DESTDIR} env ASSUME_ALWAYS_YES=yes \
/usr/sbin/pkg bootstrap -y
if [ ! -z "${VM_EXTRA_PACKAGES}" ]; then
chroot ${DESTDIR} env ASSUME_ALWAYS_YES=yes \
/usr/sbin/pkg install -y ${VM_EXTRA_PACKAGES}
fi
umount ${DESTDIR}/dev
return 0
@ -138,6 +139,10 @@ vm_extra_pre_umount() {
# Prototype. When overridden, installs additional ports within the
# virtual machine environment.
if [ -e ${DESTDIR}/usr/local/sbin/pkg ]; then
chroot ${DESTDIR} env ASSUME_ALWAYS_YES=yes \
/usr/local/sbin/pkg clean -y -a
fi
rm -f ${DESTDIR}/etc/resolv.conf
return 0