Enable other Ubuntu architectures to utilize diskimage-builder

This is accomplished by parameterizing the -a arch argument
which is currently hardcoded to amd64.

For Ubuntu distributions, the package architecture as reported by
Ubuntu will be passed into disk-image-create via the -a argument.
This field controls which packages are installed by DIB.

Note diskimage-builder invokes commands in a chroot'd
environment, so cross architecture builds are not supported
by definition. The platform architecture of the target
image is always the same as the caller's.

Change-Id: Ie91209681b2291cc7a21895ad21dd1af5e82f32a
This commit is contained in:
Luke Browning 2017-11-10 18:14:26 -06:00
parent f4dde9280b
commit 3c402ff3bd
1 changed files with 4 additions and 3 deletions

View File

@ -18,11 +18,12 @@ function build_vm() {
readonly SSH_DIR=${KEY_DIR:-${HOMEDIR}/.ssh}
manage_ssh_keys
ARCH=amd64
if [ $DISTRO == 'ubuntu' ]; then
export DIB_RELEASE=$RELEASE
export DIB_CLOUD_IMAGES=cloud-images.ubuntu.com
fi
if [ $DISTRO == 'fedora' ]; then
ARCH=$(dpkg --print-architecture)
elif [ $DISTRO == 'fedora' ]; then
EXTRA_ELEMENTS=selinux-permissive
fi
@ -46,7 +47,7 @@ function build_vm() {
export DIB_APT_CONF_DIR=/etc/apt/apt.conf.d
export DIB_CLOUD_INIT_ETC_HOSTS=true
local QEMU_IMG_OPTIONS="--qemu-img-options compat=1.1"
disk-image-create -a amd64 -o "${VM}" \
disk-image-create -a ${ARCH} -o "${VM}" \
-x ${QEMU_IMG_OPTIONS} ${DISTRO} ${EXTRA_ELEMENTS} vm \
cloud-init-datasources ${DISTRO}-${RELEASE}-guest ${DISTRO}-${RELEASE}-${SERVICE_TYPE}
}