vmimage.subr: Log pkg/local.sqlite if pkgbase

We were doing this in vm_extra_install_packages but VM images without
any extra packages installed would not get this installed.  This
results in a pkgbase system which thinks it doesn't have any packages
installed (even though all the files are right there).

Add a "metalog_add_data ./var/db/pkg/local.sqlite" call to the pkgbase
install code path, and make the call from vm_extra_install_packages
conditional on !PKGBASE.

Reported by:	Michael Dexter
MFC after:	immediately (needed for 15.0-RC1)
This commit is contained in:
Colin Percival committed 2025-11-15 13:40:57 -08:00
1 parent 66f2f1c832
commit 10a4f2d016
1 file changed
+4 -1
+4 -1
View File
@@ -106,6 +106,7 @@ vm_install_base() {
$pkg_cmd update
selected=$(vm_base_packages_list | vm_extra_filter_base_packages)
$pkg_cmd install -U -r FreeBSD-base $selected
metalog_add_data ./var/db/pkg/local.sqlite
else
cd ${WORLDDIR} && \
make DESTDIR=${DESTDIR} ${INSTALLOPTS} \
@@ -219,7 +220,9 @@ vm_extra_install_packages() {
-o PKG_DBDIR=${DESTDIR}/var/db/pkg \
-r ${DESTDIR} \
autoremove
metalog_add_data ./var/db/pkg/local.sqlite
if [ -n "${NOPKGBASE}" ]; then
metalog_add_data ./var/db/pkg/local.sqlite
fi
else
if [ -n "${WITHOUT_QEMU}" ]; then
return 0