opnsense-src/release/tools
Colin Percival c5342be39c 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

(cherry picked from commit 0b1c5628c74a37e2aa2aa3769c606d3e826302f8)
2024-05-13 15:24:28 -07:00
..
arm.subr release: de-duplicate arm.subr fstab logic 2024-02-26 11:35:47 -04:00
azure.conf release: Rework vm_extra_pre_umount 2024-05-13 15:24:28 -07:00
basic-ci.conf Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
basic-cloudinit.conf release: add basic cloudinit images 2024-04-11 14:05:10 +02:00
ec2-base.conf EC2: Split off reusable configuration bits 2023-10-03 10:28:18 -07:00
ec2-cloud-init.conf ec2: homedir bug fixed in 24.1.4 2024-04-16 22:43:27 -07:00
ec2.conf release: Rework vm_extra_pre_umount 2024-05-13 15:24:28 -07:00
gce.conf release: Rework vm_extra_pre_umount 2024-05-13 15:24:28 -07:00
oci.conf release: Rework vm_extra_pre_umount 2024-05-13 15:24:28 -07:00
openstack.conf release: Rework vm_extra_pre_umount 2024-05-13 15:24:28 -07:00
vagrant-virtualbox.conf release: Rework vm_extra_pre_umount 2024-05-13 15:24:28 -07:00
vagrant-vmware.conf release: Rework vm_extra_pre_umount 2024-05-13 15:24:28 -07:00
vagrant.conf Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
vmimage.subr release: Rework vm_extra_pre_umount 2024-05-13 15:24:28 -07:00