Files
freebsd/release/tools/ec2-cloud-init.conf
Colin Percival f6e9474ebd release: Add a MISSING_METALOGS hack to VMs
The packages for 15.0-RELEASE built without the bug fix needed to make
files created via @sample get properly listed in METALOG.  Fix the
cloudware which contain @sample-using packages by adding the necessary
files to METALOG manually.

This should be reverted after the next full package build, and live on
only in releng/15.0.

Reviewed by:	markj
MFC after:	immediately (15.0-RC2)
Differential Revision:	https://reviews.freebsd.org/D53797
2025-11-17 18:18:27 -08:00

46 lines
1.2 KiB
Bash

#!/bin/sh
. ${WORLDDIR}/release/tools/ec2.conf
# Packages to install into the image we're creating. In addition to packages
# present on all EC2 AMIs, we install amazon-ssm-agent and cloud-init.
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
# Configure cloud-init
cat <<-'EOF' > ${DESTDIR}/usr/local/etc/cloud/cloud.cfg.d/98_ec2.cfg
disable_root: true
system_info:
distro: freebsd
default_user:
name: ec2-user
lock_passwd: True
groups: [wheel]
shell: /bin/sh
homedir: /home/ec2-user
doas:
- permit nopass ec2-user
EOF
metalog_add_data ./usr/local/etc/cloud/cloud.cfg.d/98_ec2.cfg
return 0
}