aboutsummaryrefslogtreecommitdiff
path: root/release/tools/azure.conf
diff options
context:
space:
mode:
authorGlen Barber <gjb@FreeBSD.org>2014-11-05 13:22:19 +0000
committerGlen Barber <gjb@FreeBSD.org>2014-11-05 13:22:19 +0000
commit1e7c1f17428a0b342afd622fad341a389bed7a3f (patch)
tree6f87eab2bc67b1c4241bb8f9b509e3531dbbfb4f /release/tools/azure.conf
parent21f93ded5aca3c7c2f41018ce2d700557f113779 (diff)
downloadsrc-1e7c1f17428a0b342afd622fad341a389bed7a3f.tar.gz
src-1e7c1f17428a0b342afd622fad341a389bed7a3f.zip
Initial rewrite to consolidate VM image build scripts into one.
There may be some very sharp edges here while refactoring. - Move amd64/mk-vmimage.sh -> scripts/mk-vmimage.sh. - Remove vm-base target from Makefile.vm. - In vm-image target, use getopts flags for argument passing. - Create tools/vmimage.subr, containing default and prototype for the following functions that are used to drive the build, run in this order: vm_install_base() vm_extra_install_base() vm_extra_install_packages() vm_extra_install_ports() vm_extra_enable_services() vm_extra_pre_umount() vm_create_disk() vm_extra_create_disk() - In tools/azure.conf, override: vm_extra_install_base() vm_extra_pre_umount() vm_extra_create_disk() - In tools/openstack.conf, override: vm_extra_install_base() vm_extra_pre_umount() Sponsored by: The FreeBSD Foundation
Notes
Notes: svn path=/projects/release-vmimage/; revision=274134
Diffstat (limited to 'release/tools/azure.conf')
-rw-r--r--release/tools/azure.conf37
1 files changed, 37 insertions, 0 deletions
diff --git a/release/tools/azure.conf b/release/tools/azure.conf
index 8f16acc0d279..16c207da3240 100644
--- a/release/tools/azure.conf
+++ b/release/tools/azure.conf
@@ -12,3 +12,40 @@ export VM_EXTRA_PACKAGES=
# Example:
#export VM_RC_LIST="apache24"
export VM_RC_LIST=
+
+vm_extra_install_base() {
+ fetch -o ${DESTDIR}/usr/sbin/waagent \
+ http://people.freebsd.org/~gjb/waagent
+ chmod +x ${DESTDIR}/usr/sbin/waagent
+ rm -f ${DESTDIR}/etc/resolv.conf
+
+ return 0
+}
+
+vm_extra_pre_umount() {
+ chroot ${DESTDIR} env ASSUME_ALWAYS_YES=yes /usr/sbin/pkg install -y \
+ python python2 python27 py27-asn1 sudo bash
+ chroot ${DESTDIR} /usr/sbin/waagent -verbose -install
+ yes | chroot ${DESTDIR} /usr/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
+
+ 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
+}