99b858f537
MFC after: 3 days Sponsored by: The FreeBSD Foundation
43 lines
1.2 KiB
Bash
43 lines
1.2 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# Set to a list of packages to install.
|
|
# Example:
|
|
#export VM_EXTRA_PACKAGES="www/apache24"
|
|
export VM_EXTRA_PACKAGES="sysutils/azure-agent"
|
|
|
|
# Set to a list of third-party software to enable in rc.conf(5).
|
|
# Example:
|
|
#export VM_RC_LIST="apache24"
|
|
export VM_RC_LIST=
|
|
|
|
vm_extra_pre_umount() {
|
|
chroot ${DESTDIR} /usr/local/sbin/waagent -verbose -install
|
|
yes | chroot ${DESTDIR} /usr/local/sbin/waagent -deprovision
|
|
echo 'sshd_enable="YES"' >> ${DESTDIR}/etc/rc.conf
|
|
echo 'ifconfig_hn0="SYNCDHCP"' >> ${DESTDIR}/etc/rc.conf
|
|
echo 'waagent_enable="YES"' >> ${DESTDIR}/etc/rc.conf
|
|
echo 'console="comconsole vidconsole"' >> ${DESTDIR}/boot/loader.conf
|
|
echo 'comconsole_speed="115200"' >> ${DESTDIR}/boot/loader.conf
|
|
|
|
rm -f ${DESTDIR}/etc/resolv.conf
|
|
|
|
return 0
|
|
}
|
|
|
|
vm_extra_create_disk() {
|
|
if [ ! -x "/usr/local/bin/qemu-img" ]; then
|
|
env ASSUME_ALWAYS_YES=yes pkg install -y emulators/qemu-devel
|
|
fi
|
|
|
|
mv ${VMIMAGE} ${VMIMAGE}.raw
|
|
size=$(qemu-img info -f raw --output json ${VMIMAGE}.raw | awk '/virtual-size/ {print $2}' | tr -d ',')
|
|
size=$(( ( ${size} / ( 1024 * 1024 ) + 1 ) * ( 1024 * 1024 ) ))
|
|
qemu-img resize ${VMIMAGE}.raw ${size}
|
|
qemu-img convert -f raw -o subformat=fixed -O vpc ${VMIMAGE}.raw ${VMIMAGE}
|
|
|
|
return 0
|
|
}
|