1#!/bin/sh 2# 3# $FreeBSD$ 4# 5 6# Set to a list of packages to install. 7# Example: 8#export VM_EXTRA_PACKAGES="www/apache24" 9export VM_EXTRA_PACKAGES="sysutils/azure-agent" 10 11# Set to a list of third-party software to enable in rc.conf(5). 12# Example: 13#export VM_RC_LIST="apache24" 14export VM_RC_LIST= 15 16vm_extra_pre_umount() { 17 chroot ${DESTDIR} /usr/sbin/waagent -verbose -install 18 yes | chroot ${DESTDIR} /usr/sbin/waagent -deprovision 19 echo 'sshd_enable="YES"' >> ${DESTDIR}/etc/rc.conf 20 echo 'ifconfig_hn0="SYNCDHCP"' >> ${DESTDIR}/etc/rc.conf 21 echo 'waagent_enable="YES"' >> ${DESTDIR}/etc/rc.conf 22 echo 'console="comconsole vidconsole"' >> ${DESTDIR}/boot/loader.conf 23 echo 'comconsole_speed="115200"' >> ${DESTDIR}/boot/loader.conf 24 25 rm -f ${DESTDIR}/etc/resolv.conf 26 27 return 0 28} 29 30vm_extra_create_disk() { 31 if [ ! -x "/usr/local/bin/qemu-img" ]; then 32 env ASSUME_ALWAYS_YES=yes pkg install -y emulators/qemu-devel 33 fi 34 35 mv ${VMIMAGE} ${VMIMAGE}.raw 36 size=$(qemu-img info -f raw --output json ${VMIMAGE}.raw | awk '/virtual-size/ {print $2}' | tr -d ',') 37 size=$(( ( ${size} / ( 1024 * 1024 ) + 1 ) * ( 1024 * 1024 ) )) 38 qemu-img resize ${VMIMAGE}.raw ${size} 39 qemu-img convert -f raw -o subformat=fixed -O vpc ${VMIMAGE}.raw ${VMIMAGE} 40 41 return 0 42} 43