The branch main has been updated by cperciva:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=10a4f2d016dccb5cfa03800bebc09a9b421c4df7

commit 10a4f2d016dccb5cfa03800bebc09a9b421c4df7
Author:     Colin Percival <[email protected]>
AuthorDate: 2025-11-15 21:29:25 +0000
Commit:     Colin Percival <[email protected]>
CommitDate: 2025-11-15 21:40:57 +0000

    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)
---
 release/tools/vmimage.subr | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr
index 92f00f9cf7c3..482d279e5987 100644
--- a/release/tools/vmimage.subr
+++ b/release/tools/vmimage.subr
@@ -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

Reply via email to