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 21vm_extra_pre_umount() { 22 mount -t devfs devfs ${DESTDIR}/dev 23 24 # The firstboot_pkgs rc.d script will download the repository 25 # catalogue and install or update pkg when the instance first 26 # launches, so these files would just be replaced anyway; removing 27 # them from the image allows it to boot faster. 28 chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes \ 29 /usr/sbin/pkg delete -f -y pkg 30 rm ${DESTDIR}/var/db/pkg/repo-*.sqlite 31 32 chroot ${DESTDIR} ${EMULATOR} pw usermod root -h - 33 34 umount ${DESTDIR}/dev 35 36 cat << EOF >> ${DESTDIR}/etc/rc.conf 37ifconfig_hn0="SYNCDHCP" 38ntpd_sync_on_start="YES" 39EOF 40 41 cat << EOF >> ${DESTDIR}/boot/loader.conf 42autoboot_delay="-1" 43beastie_disable="YES" 44loader_logo="none" 45hw.memtest.tests="0" 46console="comconsole efi vidconsole" 47comconsole_speed="115200" 48boot_multicons="YES" 49boot_serial="YES" 50mlx4en_load="YES" 51mlx5en_load="YES" 52EOF 53 54 touch ${DESTDIR}/firstboot 55 56 rm -f ${DESTDIR}/etc/resolv.conf 57 58 return 0 59} 60