aboutsummaryrefslogtreecommitdiff
path: root/release/tools
diff options
context:
space:
mode:
Diffstat (limited to 'release/tools')
-rw-r--r--release/tools/azure.conf10
-rw-r--r--release/tools/basic-cloudinit.conf1
-rw-r--r--release/tools/ec2-base.conf4
-rw-r--r--release/tools/ec2-builder.conf10
-rw-r--r--release/tools/ec2-cloud-init.conf12
-rw-r--r--release/tools/ec2-small.conf10
-rw-r--r--release/tools/gce.conf28
-rw-r--r--release/tools/oci-image-notoolchain.conf55
-rw-r--r--release/tools/oci-image-runtime.conf4
-rw-r--r--release/tools/oracle.conf13
-rw-r--r--release/tools/vagrant.conf25
-rw-r--r--release/tools/vmimage.subr128
12 files changed, 208 insertions, 92 deletions
diff --git a/release/tools/azure.conf b/release/tools/azure.conf
index 7975e1db0822..981e40566a1c 100644
--- a/release/tools/azure.conf
+++ b/release/tools/azure.conf
@@ -18,6 +18,16 @@ export NOSWAP=YES
# https://learn.microsoft.com/en-us/partner-center/marketplace/azure-vm-certification-faq#vm-images-must-have-1-mb-of-free-space
export VM_BOOTPARTSOFFSET=1M
+# Hack for FreeBSD 15.0; should go away before 15.1.
+MISSING_METALOGS="
+./usr/local/etc/pam.d/sudo
+./usr/local/etc/ssl/cert.pem
+./usr/local/etc/sudo.conf
+./usr/local/etc/sudo_logsrvd.conf
+./usr/local/etc/sudoers
+./usr/local/etc/waagent.conf
+"
+
vm_extra_pre_umount() {
# Remove the pkg package and repo databases as they will likely
# be out of date by the time the image is used. In unprivileged
diff --git a/release/tools/basic-cloudinit.conf b/release/tools/basic-cloudinit.conf
index f8554c42f49c..98e11f0bb08b 100644
--- a/release/tools/basic-cloudinit.conf
+++ b/release/tools/basic-cloudinit.conf
@@ -28,6 +28,7 @@ beastie_disable="YES"
loader_logo="none"
console="comconsole,vidconsole"
EOF
+ metalog_add_data ./boot/loader.conf
cat << EOF >> ${DESTDIR}/etc/ssh/sshd_config
PasswordAuthentication yes
diff --git a/release/tools/ec2-base.conf b/release/tools/ec2-base.conf
index b6354db3d9d1..ffe2646240a5 100644
--- a/release/tools/ec2-base.conf
+++ b/release/tools/ec2-base.conf
@@ -36,5 +36,9 @@ vm_extra_pre_umount() {
# Standard FreeBSD network configuration
ec2_base_networking
+ # Add files from packages which weren't recorded in metalog
+ metalog_add_data ./usr/local/etc/dhclient.conf
+ metalog_add_data ./usr/local/etc/ssl/cert.pem
+
return 0
}
diff --git a/release/tools/ec2-builder.conf b/release/tools/ec2-builder.conf
index cf4276fc80ec..3b0344f9eb9a 100644
--- a/release/tools/ec2-builder.conf
+++ b/release/tools/ec2-builder.conf
@@ -7,17 +7,16 @@
export VMSIZE=8000m
# Flags to installworld/kernel: We don't want debug symbols (kernel or
-# userland), 32-bit libraries, tests, or the debugger.
+# userland), 32-bit libraries, or tests.
export INSTALLOPTS="WITHOUT_DEBUG_FILES=YES WITHOUT_KERNEL_SYMBOLS=YES \
- WITHOUT_LIB32=YES WITHOUT_TESTS=YES WITHOUT_LLDB=YES"
+ WITHOUT_LIB32=YES WITHOUT_TESTS=YES"
# Equivalent to INSTALLOPTS for pkgbase
vm_extra_filter_base_packages() {
grep -v \
-e '.*-dbg$' \
-e '.*-lib32$' \
- -e '^FreeBSD-tests.*' \
- -e '^FreeBSD-lldb.*'
+ -e '^FreeBSD-set-tests'
}
# Packages to install into the image we're creating. In addition to packages
@@ -67,5 +66,8 @@ vm_extra_pre_umount() {
EOF
metalog_add_data ./boot/loader.conf
+ # Add files from packages which weren't recorded in metalog
+ metalog_add_data ./usr/local/etc/dhclient.conf
+
return 0
}
diff --git a/release/tools/ec2-cloud-init.conf b/release/tools/ec2-cloud-init.conf
index 2a15ae5c57d8..8ad86a082260 100644
--- a/release/tools/ec2-cloud-init.conf
+++ b/release/tools/ec2-cloud-init.conf
@@ -9,6 +9,18 @@ export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} amazon-ssm-agent net/cloud-init"
# Services to enable in rc.conf(5).
export VM_RC_LIST="${VM_RC_LIST} cloudinit sshd"
+# Hack for FreeBSD 15.0; should go away before 15.1.
+MISSING_METALOGS="
+./usr/local/etc/cloud/cloud.cfg
+./usr/local/etc/cloud/cloud.cfg.d/05_logging.cfg
+./usr/local/etc/cloud/cloud.cfg.d/99_freebsd.cfg
+./usr/local/etc/pam.d/sudo
+./usr/local/etc/ssl/cert.pem
+./usr/local/etc/sudo.conf
+./usr/local/etc/sudo_logsrvd.conf
+./usr/local/etc/sudoers
+"
+
vm_extra_pre_umount() {
# Configuration common to all EC2 AMIs
ec2_common
diff --git a/release/tools/ec2-small.conf b/release/tools/ec2-small.conf
index 32d02cbb79e4..6564a59c2cf6 100644
--- a/release/tools/ec2-small.conf
+++ b/release/tools/ec2-small.conf
@@ -10,17 +10,16 @@
export VMSIZE=5000m
# Flags to installworld/kernel: We don't want debug symbols (kernel or
-# userland), 32-bit libraries, tests, or the debugger.
+# userland), 32-bit libraries, or tests.
export INSTALLOPTS="WITHOUT_DEBUG_FILES=YES WITHOUT_KERNEL_SYMBOLS=YES \
- WITHOUT_LIB32=YES WITHOUT_TESTS=YES WITHOUT_LLDB=YES"
+ WITHOUT_LIB32=YES WITHOUT_TESTS=YES"
# Equivalent to INSTALLOPTS for pkgbase
vm_extra_filter_base_packages() {
grep -v \
-e '.*-dbg$' \
-e '.*-lib32$' \
- -e '^FreeBSD-tests.*' \
- -e '^FreeBSD-lldb.*'
+ -e '^FreeBSD-set-tests'
}
# Packages to install into the image we're creating. In addition to packages
@@ -50,5 +49,8 @@ vm_extra_pre_umount() {
# Standard FreeBSD network configuration
ec2_base_networking
+ # Add files from packages which weren't recorded in metalog
+ metalog_add_data ./usr/local/etc/dhclient.conf
+
return 0
}
diff --git a/release/tools/gce.conf b/release/tools/gce.conf
index a7ccfc27a75c..558641821b16 100644
--- a/release/tools/gce.conf
+++ b/release/tools/gce.conf
@@ -17,11 +17,21 @@ export VM_RC_LIST="ntpd sshd growfs \
google_accounts_daemon google_clock_skew_daemon \
google_instance_setup google_network_daemon"
+# Hack for FreeBSD 15.0; should go away before 15.1.
+MISSING_METALOGS="
+./usr/local/etc/instance_configs.cfg.distro
+./usr/local/etc/pam.d/sudo
+./usr/local/etc/sudo.conf
+./usr/local/etc/sudo_logsrvd.conf
+./usr/local/etc/sudoers
+./usr/local/etc/syslog.d/90-google.conf
+"
+
vm_extra_install_base() {
echo 'search google.internal' > ${DESTDIR}/etc/resolv.conf
echo 'nameserver 169.254.169.254' >> ${DESTDIR}/etc/resolv.conf
echo 'nameserver 8.8.8.8' >> ${DESTDIR}/etc/resolv.conf
- metalog_add ./etc/resolv.conf
+ metalog_add_data ./etc/resolv.conf
}
vm_extra_pre_umount() {
@@ -51,6 +61,7 @@ kern.timecounter.hardware=ACPI-safe
aesni_load="YES"
nvme_load="YES"
EOF
+ metalog_add_data ./boot/loader.conf
echo '169.254.169.254 metadata.google.internal metadata' >> \
${DESTDIR}/etc/hosts
@@ -97,15 +108,24 @@ EOF
# the image.
if [ -e "${DESTDIR}/../ftp/src.txz" ]; then
tar fxJ ${DESTDIR}/../ftp/src.txz -C ${DESTDIR}
+ ( cd ${DESTDIR} && find ./usr/src ) |
+ while read P; do
+ metalog_add_data ${P}
+ done
fi
if [ -e "${DESTDIR}/../ftp/ports.txz" ]; then
tar fxJ ${DESTDIR}/../ftp/ports.txz -C ${DESTDIR}
- _INSTALLED_PACKAGES=$(pkg -r ${DESTDIR} info -o -q -a)
+ _INSTALLED_PACKAGES=$(pkg -r ${DESTDIR} info -o -q -a | grep -v ^base/)
for PACKAGE in ${_INSTALLED_PACKAGES}; do
make -C ${DESTDIR}/usr/ports/${PACKAGE} fetch \
- DISTDIR=${DESTDIR}/usr/ports/distfiles
-
+ DISTDIR=${DESTDIR}/usr/ports/distfiles \
+ DISABLE_VULNERABILITIES=YES \
+ I_DONT_CARE_IF_MY_BUILDS_TARGET_THE_WRONG_RELEASE=YES
done
+ ( cd ${DESTDIR} && find ./usr/ports ) |
+ while read P; do
+ metalog_add_data ${P}
+ done
fi
## XXX: Verify this is needed. I do not see this requirement
diff --git a/release/tools/oci-image-notoolchain.conf b/release/tools/oci-image-notoolchain.conf
index e251281a7357..72a62657fa76 100644
--- a/release/tools/oci-image-notoolchain.conf
+++ b/release/tools/oci-image-notoolchain.conf
@@ -1,68 +1,25 @@
#! /bin/sh
-# Build OCI container image with almost all packages suitable for jails, excluding compiler
+# Build OCI container image with almost all packages suitable for jails,
+# excluding toolchain.
OCI_BASE_IMAGE=runtime
oci_image_build() {
set_cmd ${workdir} /bin/sh
install_packages ${abi} ${workdir} \
- FreeBSD-acct \
- FreeBSD-at \
- FreeBSD-audit \
- FreeBSD-autofs \
- FreeBSD-blocklist \
- FreeBSD-bsnmp \
- FreeBSD-caroot \
- FreeBSD-certctl \
- FreeBSD-clibs \
- FreeBSD-console-tools \
- FreeBSD-cron \
- FreeBSD-csh \
+ FreeBSD-bmake \
FreeBSD-dma \
- FreeBSD-ee \
- FreeBSD-fd \
- FreeBSD-fetch \
- FreeBSD-ftp \
- FreeBSD-ftpd \
FreeBSD-inetd \
FreeBSD-ipf \
FreeBSD-ipfw \
- FreeBSD-iscsi \
- FreeBSD-jail \
- FreeBSD-kerberos \
- FreeBSD-kerberos-lib \
- FreeBSD-libarchive \
- FreeBSD-libcompiler_rt-dev \
- FreeBSD-libexecinfo \
- FreeBSD-libucl \
- FreeBSD-locales \
- FreeBSD-lp \
- FreeBSD-mtree \
FreeBSD-natd \
FreeBSD-netmap \
- FreeBSD-newsyslog \
- FreeBSD-nfs \
- FreeBSD-nuageinit \
- FreeBSD-openssl \
- FreeBSD-periodic \
FreeBSD-pf \
- FreeBSD-pkg-bootstrap \
- FreeBSD-quotacheck \
- FreeBSD-rc \
- FreeBSD-rcmds \
- FreeBSD-rescue \
- FreeBSD-resolvconf \
- FreeBSD-runtime \
FreeBSD-ssh \
- FreeBSD-syslogd \
- FreeBSD-tcpd \
FreeBSD-telnet \
- FreeBSD-ufs \
- FreeBSD-unbound \
- FreeBSD-utilities \
- FreeBSD-vi \
- FreeBSD-yp \
+ FreeBSD-xz \
FreeBSD-zfs \
- FreeBSD-zoneinfo
+ FreeBSD-set-minimal-jail
}
+
diff --git a/release/tools/oci-image-runtime.conf b/release/tools/oci-image-runtime.conf
index 93aad1e39250..db99e5640040 100644
--- a/release/tools/oci-image-runtime.conf
+++ b/release/tools/oci-image-runtime.conf
@@ -9,6 +9,10 @@ OCI_BASE_IMAGE=dynamic
oci_image_build() {
set_cmd ${workdir} /bin/sh
+ # The static image installed termcap.small into /usr/share/misc/termcap
+ # and we are replacing it with the full termcap file. We remove the
+ # small one first to avoid creating a .pkgsave file.
+ rm ${workdir}/rootfs/usr/share/misc/termcap
install_packages ${abi} ${workdir} \
FreeBSD-runtime \
FreeBSD-certctl \
diff --git a/release/tools/oracle.conf b/release/tools/oracle.conf
index ebda3b3d6e61..152c48af1829 100644
--- a/release/tools/oracle.conf
+++ b/release/tools/oracle.conf
@@ -39,6 +39,19 @@ export VM_RC_LIST="
sshd
zfs"
+# Hack for FreeBSD 15.0; should go away before 15.1.
+MISSING_METALOGS="
+./usr/local/etc/cloud/cloud.cfg
+./usr/local/etc/cloud/cloud.cfg.d/05_logging.cfg
+./usr/local/etc/cloud/cloud.cfg.d/99_freebsd.cfg
+./usr/local/etc/pam.d/sudo
+./usr/local/etc/rsync/rsyncd.conf
+./usr/local/etc/ssl/cert.pem
+./usr/local/etc/sudo.conf
+./usr/local/etc/sudo_logsrvd.conf
+./usr/local/etc/sudoers
+"
+
vm_extra_pre_umount() {
cat <<-'EOF' >> ${DESTDIR}/etc/rc.conf
dumpdev=AUTO
diff --git a/release/tools/vagrant.conf b/release/tools/vagrant.conf
index 7ab0e1238693..5b0f38b740a6 100644
--- a/release/tools/vagrant.conf
+++ b/release/tools/vagrant.conf
@@ -14,14 +14,16 @@ export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} shells/bash \
export VM_RC_LIST="firstboot_freebsd_update firstboot_pkgs growfs"
vagrant_common () {
- # The firstboot_pkgs rc.d script will download the repository
- # catalogue and install or update pkg when the instance first
- # launches, so these files would just be replaced anyway; removing
- # them from the image allows it to boot faster.
- env ASSUME_ALWAYS_YES=yes pkg -c ${DESTDIR} clean -y -a
- env ASSUME_ALWAYS_YES=yes pkg -c ${DESTDIR} delete -f -y pkg
- rm -r ${DESTDIR}/var/db/pkg/repos/FreeBSD-ports
- rm -r ${DESTDIR}/var/db/pkg/repos/FreeBSD-ports-kmods
+ if [ -z "${NO_ROOT}" ]; then
+ # The firstboot_pkgs rc.d script will download the repository
+ # catalogue and install or update pkg when the instance first
+ # launches, so these files would just be replaced anyway;
+ # removing them from the image allows it to boot faster.
+ pkg -c ${DESTDIR} clean -y -a
+ pkg -c ${DESTDIR} delete -f -y pkg
+ rm -r ${DESTDIR}/var/db/pkg/repos/FreeBSD-ports
+ rm -r ${DESTDIR}/var/db/pkg/repos/FreeBSD-ports-kmods
+ fi
# Vagrant instances use DHCP to get their network configuration.
echo 'ifconfig_DEFAULT="SYNCDHCP"' >> ${DESTDIR}/etc/rc.conf
@@ -40,8 +42,7 @@ vagrant_common () {
# Create the vagrant user with a password of vagrant
/usr/sbin/pw -R ${DESTDIR} \
groupadd vagrant -g 1001
- chroot ${DESTDIR} mkdir -p /home/vagrant
- /usr/sbin/pw -R ${DESTDIR} \
+ /usr/sbin/pw -R ${DESTDIR} -M ${DESTDIR}/METALOG \
useradd vagrant \
-m -M 0755 -w yes -n vagrant -u 1001 -g 1001 -G 0 \
-c 'Vagrant User' -d '/home/vagrant' -s '/bin/csh'
@@ -58,11 +59,11 @@ vagrant_common () {
echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" > ${DESTDIR}/home/vagrant/.ssh/authorized_keys
echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN1YdxBpNlzxDqfJyw/QKow1F+wvG9hXGoqiysfJOn5Y vagrant insecure public key" >> ${DESTDIR}/home/vagrant/.ssh/authorized_keys
chmod 600 ${DESTDIR}/home/vagrant/.ssh/authorized_keys
- metalog_add_data ./home/vagrant/.ssh/authorized_keys 0600
chmod 700 ${DESTDIR}/home/vagrant/.ssh
chown -R 1001 ${DESTDIR}/home/vagrant/.ssh
- echo "./home/vagrant/.ssh type=dir uid=1001 gid=1001 mode=0700" >> METALOG
+ echo "./home/vagrant/.ssh type=dir uid=1001 gid=1001 mode=0700" >> ${DESTDIR}/METALOG
+ echo "./home/vagrant/.ssh/authorized_keys type=file uid=1001 gid=1001 mode=0600" >> ${DESTDIR}/METALOG
# Reboot quickly, Don't wait at the panic screen
echo 'debug.trace_on_panic=1' >> ${DESTDIR}/etc/sysctl.conf
diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr
index 577abaac73cf..0ca9ba267ce0 100644
--- a/release/tools/vmimage.subr
+++ b/release/tools/vmimage.subr
@@ -70,15 +70,20 @@ vm_copy_base() {
return 0
}
-vm_filter_base_packages() {
- # Reads a list of all base system packages from stdin.
- # Writes a list of base system packages to install to stdout.
- grep -v -e '^FreeBSD-src.*' -e '^FreeBSD-kernel.*'
- # There are several kernel variants available in separate packages.
- # For VMs it is sufficient to install only the generic kernel.
- echo "FreeBSD-kernel-man"
- echo "FreeBSD-kernel-generic"
- echo "FreeBSD-kernel-generic-dbg"
+vm_base_packages_list() {
+ # Output a list of package sets equivalent to what we get from
+ # "installworld installkernel distribution", aka. the full base
+ # system.
+ for S in base kernels; do
+ echo FreeBSD-set-$S
+ echo FreeBSD-set-$S-dbg
+ done
+ case ${TARGET_ARCH} in
+ amd64 | aarch64 | powerpc64)
+ echo FreeBSD-set-lib32
+ echo FreeBSD-set-lib32-dbg
+ esac
+ echo FreeBSD-set-tests
}
vm_extra_filter_base_packages() {
@@ -92,13 +97,20 @@ vm_install_base() {
if [ -z "${NOPKGBASE}" ]; then
local pkg_cmd
- pkg_cmd="pkg --rootdir ${DESTDIR} --repo-conf-dir ${PKGBASE_REPO_DIR}
+ pkg_cmd="${PKG_CMD} --rootdir ${DESTDIR} --repo-conf-dir ${PKGBASE_REPO_DIR}
-o ASSUME_ALWAYS_YES=yes -o IGNORE_OSVERSION=yes
- -o INSTALL_AS_USER=yes "
+ -o ABI=${PKG_ABI} -o INSTALL_AS_USER=yes "
+ if [ -n "${NO_ROOT}" ]; then
+ pkg_cmd="$pkg_cmd -o METALOG=METALOG"
+ fi
$pkg_cmd update
- selected=$($pkg_cmd rquery -U -r FreeBSD-base %n | \
- vm_filter_base_packages | vm_extra_filter_base_packages)
+ 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
+ mkdir -p ${DESTDIR}/usr/local/etc/pkg/repos
+ echo 'FreeBSD-base: { enabled: yes }' > ${DESTDIR}/usr/local/etc/pkg/repos/FreeBSD.conf
+ metalog_add_data ./usr/local/etc/pkg/repos
+ metalog_add_data ./usr/local/etc/pkg/repos/FreeBSD.conf
else
cd ${WORLDDIR} && \
make DESTDIR=${DESTDIR} ${INSTALLOPTS} \
@@ -198,13 +210,23 @@ vm_extra_install_packages() {
for pkg in ${VM_EXTRA_PACKAGES}; do
INSTALL_AS_USER=yes \
${PKG_CMD} \
+ -o ABI=${PKG_ABI} \
-o METALOG=${DESTDIR}/METALOG.pkg \
-o REPOS_DIR=${PKG_REPOS_DIR} \
-o PKG_DBDIR=${DESTDIR}/var/db/pkg \
-r ${DESTDIR} \
install -y -r ${PKG_REPO_NAME} $pkg
done
- metalog_add_data ./var/db/pkg/local.sqlite
+ INSTALL_AS_USER=yes \
+ ${PKG_CMD} \
+ -o ABI=${PKG_ABI} \
+ -o REPOS_DIR=${PKG_REPOS_DIR} \
+ -o PKG_DBDIR=${DESTDIR}/var/db/pkg \
+ -r ${DESTDIR} \
+ autoremove -y
+ if [ -n "${NOPKGBASE}" ]; then
+ metalog_add_data ./var/db/pkg/local.sqlite
+ fi
else
if [ -n "${WITHOUT_QEMU}" ]; then
return 0
@@ -216,6 +238,8 @@ vm_extra_install_packages() {
chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes \
/usr/sbin/pkg install -y ${p}
done
+ chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes \
+ /usr/sbin/pkg autoremove -y
fi
return 0
@@ -249,9 +273,17 @@ 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 \
+ -o INSTALL_AS_USER=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
@@ -260,8 +292,62 @@ vm_extra_pkg_rmcache() {
buildfs() {
local md tmppool
+ # Copy entries from METALOG.pkg into METALOG, but first check to
+ # make sure that filesystem objects still exist; some things may
+ # have been logged which no longer exist if a package was removed.
if [ -f ${DESTDIR}/METALOG.pkg ]; then
- cat ${DESTDIR}/METALOG.pkg >> ${DESTDIR}/METALOG
+ while read F REST; do
+ if [ -e ${DESTDIR}/${F} ]; then
+ echo "${F} ${REST}" >> ${DESTDIR}/METALOG
+ fi
+ done < ${DESTDIR}/METALOG.pkg
+ fi
+
+ if [ -n "${NO_ROOT}" ]; then
+ # Check for any directories in the staging tree which weren't
+ # recorded in METALOG, and record them now. This is a quick hack
+ # to avoid creating unusable VM images and should go away once
+ # the bugs which produce such unlogged directories are gone.
+ grep type=dir ${DESTDIR}/METALOG |
+ cut -f 1 -d ' ' |
+ sort -u > ${DESTDIR}/METALOG.dirs
+ ( cd ${DESTDIR} && find . -type d ) |
+ sort |
+ comm -23 - ${DESTDIR}/METALOG.dirs > ${DESTDIR}/METALOG.missingdirs
+ if [ -s ${DESTDIR}/METALOG.missingdirs ]; then
+ echo "WARNING: Directories exist but were not in METALOG"
+ cat ${DESTDIR}/METALOG.missingdirs
+ fi
+ while read DIR; do
+ metalog_add_data ${DIR}
+ done < ${DESTDIR}/METALOG.missingdirs
+
+ if [ -z "${NOPKGBASE}" ]; then
+ # Add some database files which are created by pkg triggers;
+ # at some point in the future the tools which create these
+ # files should probably learn how to record them in METALOG
+ # (which would simplify no-root installworld as well).
+ metalog_add_data ./etc/login.conf.db
+ metalog_add_data ./etc/passwd
+ metalog_add_data ./etc/pwd.db
+ metalog_add_data ./etc/spwd.db 600
+ metalog_add_data ./var/db/services.db
+ fi
+
+ if [ -n "${MISSING_METALOGS}" ]; then
+ # Hack to allow VM configurations to add files which
+ # weren't being added to METALOG appropriately. This
+ # is mainly a workaround for the @sample bug and it
+ # should go away before FreeBSD 15.1 ships.
+ for P in ${MISSING_METALOGS}; do
+ metalog_add_data ${P}
+ done
+ fi
+
+ # Sort METALOG file; makefs produces directories with 000 permissions
+ # if their contents are seen before the directories themselves.
+ env -i LC_COLLATE=C sort -u ${DESTDIR}/METALOG > ${DESTDIR}/METALOG.sorted
+ mv ${DESTDIR}/METALOG.sorted ${DESTDIR}/METALOG
fi
case "${VMFS}" in
@@ -387,7 +473,11 @@ vm_create_disk() {
# Create an ESP
espfilename=$(mktemp /tmp/efiboot.XXXXXX)
make_esp_file ${espfilename} ${fat32min} ${BOOTFILES}/efi/loader_lua/loader_lua.efi
- BOOTPARTS="${BOOTPARTS} -p efi/efiboot0:=${espfilename}"
+ espsuffix=""
+ if [ -z "${BOOTPARTS}" ]; then
+ espsuffix="${BOOTPARTSOFFSET}"
+ fi
+ BOOTPARTS="${BOOTPARTS} -p efi/efiboot0:=${espfilename}${espsuffix}"
# Add this to fstab
mkdir -p ${DESTDIR}/boot/efi