xref: /freebsd/release/tools/azure.conf (revision 9978553d0199e7ec0bdd1c44fc7f6c7b0c11e43b)
1#!/bin/sh
2#
3#
4
5# Convention of Linux type VM on Azure is 30G
6export VMSIZE=30g
7
8# Set to a list of packages to install.
9export VM_EXTRA_PACKAGES="azure-agent python python3 firstboot-freebsd-update firstboot-pkgs"
10
11# Set to a list of third-party software to enable in rc.conf(5).
12export VM_RC_LIST="ntpd sshd waagent firstboot_freebsd_update firstboot_pkgs"
13
14# No swap space; waagent will allocate swap space on the resource disk.
15# See ResourceDisk.EnableSwap and ResourceDisk.SwapSizeMB in waagent.conf
16export NOSWAP=YES
17
18# https://learn.microsoft.com/en-us/partner-center/marketplace/azure-vm-certification-faq#vm-images-must-have-1-mb-of-free-space
19export VM_BOOTPARTSOFFSET=1M
20
21# Hack for FreeBSD 15.0; should go away before 15.1.
22MISSING_METALOGS="
23./usr/local/etc/pam.d/sudo
24./usr/local/etc/ssl/cert.pem
25./usr/local/etc/sudo.conf
26./usr/local/etc/sudo_logsrvd.conf
27./usr/local/etc/sudoers
28./usr/local/etc/waagent.conf
29"
30
31vm_extra_pre_umount() {
32	# Remove the pkg package and repo databases as they will likely
33	# be out of date by the time the image is used.  In unprivileged
34	# builds this is unnecessary as pkg will not be installed to
35	# begin with.
36	if [ -z "${NO_ROOT}" ]; then
37		mount -t devfs devfs ${DESTDIR}/dev
38
39		# The firstboot_pkgs rc.d script will download the repository
40		# catalogue and install or update pkg when the instance first
41		# launches, so these files would just be replaced anyway; removing
42		# them from the image allows it to boot faster.
43		chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes \
44			/usr/sbin/pkg delete -f -y pkg
45		umount ${DESTDIR}/dev
46		rm -r ${DESTDIR}/var/db/pkg/repos/FreeBSD-ports
47		rm -r ${DESTDIR}/var/db/pkg/repos/FreeBSD-ports-kmods
48	fi
49
50	pw -R ${DESTDIR} usermod root -h -
51
52	cat << EOF >> ${DESTDIR}/etc/rc.conf
53ifconfig_hn0="SYNCDHCP"
54ntpd_sync_on_start="YES"
55EOF
56
57	cat << EOF >> ${DESTDIR}/boot/loader.conf
58autoboot_delay="-1"
59beastie_disable="YES"
60loader_logo="none"
61hw.memtest.tests="0"
62console="comconsole efi vidconsole"
63comconsole_speed="115200"
64boot_multicons="YES"
65boot_serial="YES"
66mlx4en_load="YES"
67mlx5en_load="YES"
68EOF
69	metalog_add_data ./boot/loader.conf
70
71	return 0
72}
73