feat(vm_image_util): Adding support for openstack and brightbox

Added USE flags for specifying the provider (ec2, openstack, or brightbox).
This commit is contained in:
Alex Crawford 2014-04-11 10:13:01 -07:00
parent 4a0e4de834
commit 9095908ca1

View File

@ -21,6 +21,7 @@ VALID_IMG_TYPES=(
vmware_insecure vmware_insecure
xen xen
gce gce
brightbox
) )
# Set at runtime to one of the above types # Set at runtime to one of the above types
@ -48,6 +49,9 @@ IMG_DEFAULT_BOOT_KERNEL=1
# If set install the given package name to the OEM partition # If set install the given package name to the OEM partition
IMG_DEFAULT_OEM_PACKAGE= IMG_DEFAULT_OEM_PACKAGE=
# USE flags for the OEM package
IMG_DEFAULT_OEM_USE=
# Name of the target image format. # Name of the target image format.
# May be raw, qcow2 (qemu), or vmdk (vmware, virtualbox) # May be raw, qcow2 (qemu), or vmdk (vmware, virtualbox)
IMG_DEFAULT_DISK_FORMAT=raw IMG_DEFAULT_DISK_FORMAT=raw
@ -106,12 +110,20 @@ IMG_vmware_insecure_OEM_PACKAGE=oem-vagrant
## ami ## ami
IMG_ami_BOOT_KERNEL=0 IMG_ami_BOOT_KERNEL=0
IMG_ami_OEM_PACKAGE=oem-ami IMG_ami_OEM_PACKAGE=oem-ec2-compat
IMG_ami_OEM_USE=ec2
## openstack, supports ec2's metadata format so use oem-ami ## openstack, supports ec2's metadata format so use oem-ec2-compat
IMG_openstack_DISK_FORMAT=qcow2 IMG_openstack_DISK_FORMAT=qcow2
IMG_openstack_DISK_LAYOUT=vm IMG_openstack_DISK_LAYOUT=vm
IMG_openstack_OEM_PACKAGE=oem-ami IMG_openstack_OEM_PACKAGE=oem-ec2-compat
IMG_openstack_OEM_USE=openstack
## brightbox, supports ec2's metadata format so use oem-ec2-compat
IMG_brightbox_DISK_FORMAT=qcow2
IMG_brightbox_DISK_LAYOUT=vm
IMG_brightbox_OEM_PACKAGE=oem-ec2-compat
IMG_brightbox_OEM_USE=brightbox
## pxe, which is an cpio image ## pxe, which is an cpio image
IMG_pxe_DISK_FORMAT=cpio IMG_pxe_DISK_FORMAT=cpio
@ -252,6 +264,7 @@ setup_disk_image() {
# If the current type defines a oem package install it to the given fs image. # If the current type defines a oem package install it to the given fs image.
install_oem_package() { install_oem_package() {
local oem_pkg=$(_get_vm_opt OEM_PACKAGE) local oem_pkg=$(_get_vm_opt OEM_PACKAGE)
local oem_use=$(_get_vm_opt OEM_USE)
local oem_tmp="${VM_TMP_DIR}/oem" local oem_tmp="${VM_TMP_DIR}/oem"
if [[ -z "${oem_pkg}" ]]; then if [[ -z "${oem_pkg}" ]]; then
@ -259,7 +272,7 @@ install_oem_package() {
fi fi
info "Installing ${oem_pkg} to OEM partition" info "Installing ${oem_pkg} to OEM partition"
emerge-${BOARD} --root="${oem_tmp}" \ USE="${oem_use}" emerge-${BOARD} --root="${oem_tmp}" \
--root-deps=rdeps --usepkg --quiet "${oem_pkg}" --root-deps=rdeps --usepkg --quiet "${oem_pkg}"
sudo rsync -a "${oem_tmp}/usr/share/oem/" "${VM_TMP_ROOT}/usr/share/oem/" sudo rsync -a "${oem_tmp}/usr/share/oem/" "${VM_TMP_ROOT}/usr/share/oem/"
sudo rm -rf "${oem_tmp}" sudo rm -rf "${oem_tmp}"