diff --git a/build_library/virtualbox_ovf.sh b/build_library/virtualbox_ovf.sh index dd6ec06b98..62fa688253 100755 --- a/build_library/virtualbox_ovf.sh +++ b/build_library/virtualbox_ovf.sh @@ -24,11 +24,6 @@ if [[ ! -e "${FLAGS_disk_vmdk}" ]]; then exit 1 fi -if [[ -z "${FLAGS_output_ovf}" ]]; then - echo "No ovf file path provided." >&2 - exit 1 -fi - DISK_NAME=$(basename "${FLAGS_disk_vmdk}") DISK_UUID=$(uuidgen) DISK_SIZE_BYTES=$(qemu-img info -f vmdk "${FLAGS_disk_vmdk}" \ @@ -72,7 +67,8 @@ end EOF fi -cat >"${FLAGS_output_ovf}" <"${FLAGS_output_ovf}" < @@ -293,3 +289,4 @@ cat >"${FLAGS_output_ovf}" < EOF +fi diff --git a/build_library/vm_image_util.sh b/build_library/vm_image_util.sh index d5512d2063..1c5c09401d 100644 --- a/build_library/vm_image_util.sh +++ b/build_library/vm_image_util.sh @@ -11,6 +11,7 @@ VALID_IMG_TYPES=( qemu rackspace vagrant + vagrant_vmware_fusion virtualbox vmware xen @@ -66,6 +67,11 @@ IMG_vagrant_DISK_FORMAT=vmdk IMG_vagrant_CONF_FORMAT=vagrant IMG_vagrant_OEM_PACKAGE=oem-vagrant +## vagrant_vmware +IMG_vagrant_vmware_fusion_DISK_FORMAT=vmdk +IMG_vagrant_vmware_fusion_CONF_FORMAT=vagrant_vmware_fusion +IMG_vagrant_vmware_fusion_OEM_PACKAGE=oem-vagrant + ## vmware IMG_vmware_DISK_FORMAT=vmdk IMG_vmware_CONF_FORMAT=vmx @@ -340,7 +346,7 @@ sound.virtualDev = "es1371" displayName = "CoreOS" guestOS = "otherlinux" ethernet0.addressType = "generated" -floppy0.present = "FALSE"" +floppy0.present = "FALSE" EOF VM_GENERATED_FILES+=( "${vmx_path}" ) } @@ -434,7 +440,11 @@ _write_vagrant_conf() { --output_ovf "$ovf" \ --output_vagrant "$vfile" - tar -czf "${box}" -C "${VM_TMP_DIR}" "box.ovf" "Vagrantfile" "${dst_name}" + cat > "${VM_TMP_DIR}"/metadata.json < "${VM_README}" <= 1.2.3 is required. Use something like the following to get started: @@ -451,6 +461,50 @@ EOF VM_GENERATED_FILES=( "${box}" "${VM_README}" ) } +_write_vagrant_vmware_fusion_conf() { + local vm_mem="${1:-$(_get_vm_opt MEM)}" + local src_name=$(basename "$VM_SRC_IMG") + local dst_name=$(basename "$VM_DST_IMG") + local dst_dir=$(dirname "$VM_DST_IMG") + local vmx_path="${dst_dir}/$(_src_to_dst_name "${src_name}" ".vmx")" + local vmx_file=$(basename "${vmx_path}") + local vfile="${VM_TMP_DIR}/Vagrantfile" + local box="${dst_dir}/$(_src_to_dst_name "${src_name}" ".box")" + + # Move the disk image to tmp, it won't be a final output file + mv "${VM_DST_IMG}" "${VM_TMP_DIR}/${dst_name}" + + _write_vmx_conf ${vm_mem} + "${BUILD_LIBRARY_DIR}/virtualbox_ovf.sh" \ + --vm_name "$VM_NAME" \ + --disk_vmdk "${VM_TMP_DIR}/${dst_name}" \ + --memory_size "$vm_mem" \ + --output_vagrant "$vfile" + + cat > "${VM_TMP_DIR}"/metadata.json < "${VM_README}" <