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 # Remove the pkg package and repo databases as they will likely 23 # be out of date by the time the image is used. In unprivileged 24 # builds this is unnecessary as pkg will not be installed to 25 # begin with. 26 if [ -z "${NO_ROOT}" ]; then 27 mount -t devfs devfs ${DESTDIR}/dev 28 29 # The firstboot_pkgs rc.d script will download the repository 30 # catalogue and install or update pkg when the instance first 31 # launches, so these files would just be replaced anyway; removing 32 # them from the image allows it to boot faster. 33 chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes \ 34 /usr/sbin/pkg delete -f -y pkg 35 umount ${DESTDIR}/dev 36 rm -r ${DESTDIR}/var/db/pkg/repos/FreeBSD-ports 37 rm -r ${DESTDIR}/var/db/pkg/repos/FreeBSD-ports-kmods 38 fi 39 40 pw -R ${DESTDIR} usermod root -h - 41 42 cat << EOF >> ${DESTDIR}/etc/rc.conf 43ifconfig_hn0="SYNCDHCP" 44ntpd_sync_on_start="YES" 45EOF 46 47 cat << EOF >> ${DESTDIR}/boot/loader.conf 48autoboot_delay="-1" 49beastie_disable="YES" 50loader_logo="none" 51hw.memtest.tests="0" 52console="comconsole efi vidconsole" 53comconsole_speed="115200" 54boot_multicons="YES" 55boot_serial="YES" 56mlx4en_load="YES" 57mlx5en_load="YES" 58EOF 59 metalog_add_data ./boot/loader.conf 60 61 return 0 62} 63