HardenedBSD/release
Colin Percival 0b1c5628c7 release: Rework vm_extra_pre_umount
The vm_extra_pre_umount function in vmimage.subr served two purposes:
It removed /etc/resolv.conf and /qemu (if cross-building), and it
provided a function for cloudware to override in order to make cloud
specific changes to the filesystem before constructing a disk image.

This resulted in a number of bugs:
1. When cross-building, the emulator binary was left as /qemu in the
Azure, GCE, Openstack and Vagrant images.
2. The build host's resolv.conf was left as /etc/resolv.conf in the
basic-ci and basic-cloudinit images.
3. When building GCE images, a Google-specific resolv.conf file was
constructed, and then deleted before the disk image was created.

Move the bits needed for running code inside a VM staging directory
from vm_install_base into a new vm_emulation_setup routine, and move
the corresponding cleanup bits from vm_extra_pre_umount to a new
vm_emulation_cleanup routine.

Remove the /qemu and /etc/resolv.conf cleanups from the cloudware
configuration files (where they exist) since we will now be running
vm_emulation_cleanup to remove those even when vm_extra_pre_umount
has been overridden.

Override vm_emulation_cleanup in gce.conf since in that one case (and
*only* that one case) we don't want to clean up resolv.conf (since it
was constructed for the VM image rather than copied from the host).

releng/14.1 candidate.

MFC after:	1 week
Sponsored by:	https://www.patreon.com/cperciva
2024-05-06 13:40:47 -07:00
..
amd64 Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
arm release: remove arm/armv6 RPI-B configuration file 2023-08-31 19:24:38 -04:00
arm64 release: remove the RPI CM4s .dtb 2024-04-25 17:10:32 -05:00
i386 Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
packages packages: add package for NTP 2024-05-04 07:41:54 -06:00
pkg_repos Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
powerpc release: Fix powerpc boot block uudecoding 2024-04-12 17:52:28 -07:00
riscv riscv: add firmware partitions to GENERICSD.conf 2024-02-14 11:16:54 -04:00
scripts release: Rework vm_extra_pre_umount 2024-05-06 13:40:47 -07:00
tools release: Rework vm_extra_pre_umount 2024-05-06 13:40:47 -07:00
Makefile release: Build dvd image before staging pkgs 2024-04-14 16:45:40 -07:00
Makefile.azure release: Support r/o /usr/ports for cloudware 2024-04-12 10:58:09 -07:00
Makefile.ec2 release: Support r/o /usr/ports for cloudware 2024-04-12 10:58:09 -07:00
Makefile.firecracker
Makefile.gce release: Support r/o /usr/ports for cloudware 2024-04-12 10:58:09 -07:00
Makefile.inc1 Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.mirrors release: Stage non-UFS images in vm-images-stage 2024-05-01 11:02:49 -07:00
Makefile.vagrant release: Support r/o /usr/ports for cloudware 2024-04-12 10:58:09 -07:00
Makefile.vm release: Use qemu when cross-building vm images 2024-05-04 23:59:29 -07:00
rc.local
release.conf.sample
release.sh Reapply "release.sh: Add -jN to make release" 2024-04-09 20:29:16 -07:00