mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-23 22:51:03 +02:00
Merge branch 'master' of ssh://github.com/coreos/scripts
This commit is contained in:
commit
f871c34186
@ -24,11 +24,6 @@ if [[ ! -e "${FLAGS_disk_vmdk}" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${FLAGS_output_ovf}" ]]; then
|
|
||||||
echo "No ovf file path provided." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
DISK_NAME=$(basename "${FLAGS_disk_vmdk}")
|
DISK_NAME=$(basename "${FLAGS_disk_vmdk}")
|
||||||
DISK_UUID=$(uuidgen)
|
DISK_UUID=$(uuidgen)
|
||||||
DISK_SIZE_BYTES=$(qemu-img info -f vmdk "${FLAGS_disk_vmdk}" \
|
DISK_SIZE_BYTES=$(qemu-img info -f vmdk "${FLAGS_disk_vmdk}" \
|
||||||
@ -72,7 +67,8 @@ end
|
|||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat >"${FLAGS_output_ovf}" <<EOF
|
if [[ -n "${FLAGS_output_ovf}" ]]; then
|
||||||
|
cat >"${FLAGS_output_ovf}" <<EOF
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<Envelope ovf:version="1.0" xml:lang="en-US" xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:vbox="http://www.virtualbox.org/ovf/machine">
|
<Envelope ovf:version="1.0" xml:lang="en-US" xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:vbox="http://www.virtualbox.org/ovf/machine">
|
||||||
<References>
|
<References>
|
||||||
@ -293,3 +289,4 @@ cat >"${FLAGS_output_ovf}" <<EOF
|
|||||||
</VirtualSystem>
|
</VirtualSystem>
|
||||||
</Envelope>
|
</Envelope>
|
||||||
EOF
|
EOF
|
||||||
|
fi
|
||||||
|
@ -11,6 +11,7 @@ VALID_IMG_TYPES=(
|
|||||||
qemu
|
qemu
|
||||||
rackspace
|
rackspace
|
||||||
vagrant
|
vagrant
|
||||||
|
vagrant_vmware_fusion
|
||||||
virtualbox
|
virtualbox
|
||||||
vmware
|
vmware
|
||||||
xen
|
xen
|
||||||
@ -66,6 +67,11 @@ IMG_vagrant_DISK_FORMAT=vmdk
|
|||||||
IMG_vagrant_CONF_FORMAT=vagrant
|
IMG_vagrant_CONF_FORMAT=vagrant
|
||||||
IMG_vagrant_OEM_PACKAGE=oem-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
|
## vmware
|
||||||
IMG_vmware_DISK_FORMAT=vmdk
|
IMG_vmware_DISK_FORMAT=vmdk
|
||||||
IMG_vmware_CONF_FORMAT=vmx
|
IMG_vmware_CONF_FORMAT=vmx
|
||||||
@ -340,7 +346,7 @@ sound.virtualDev = "es1371"
|
|||||||
displayName = "CoreOS"
|
displayName = "CoreOS"
|
||||||
guestOS = "otherlinux"
|
guestOS = "otherlinux"
|
||||||
ethernet0.addressType = "generated"
|
ethernet0.addressType = "generated"
|
||||||
floppy0.present = "FALSE""
|
floppy0.present = "FALSE"
|
||||||
EOF
|
EOF
|
||||||
VM_GENERATED_FILES+=( "${vmx_path}" )
|
VM_GENERATED_FILES+=( "${vmx_path}" )
|
||||||
}
|
}
|
||||||
@ -434,7 +440,11 @@ _write_vagrant_conf() {
|
|||||||
--output_ovf "$ovf" \
|
--output_ovf "$ovf" \
|
||||||
--output_vagrant "$vfile"
|
--output_vagrant "$vfile"
|
||||||
|
|
||||||
tar -czf "${box}" -C "${VM_TMP_DIR}" "box.ovf" "Vagrantfile" "${dst_name}"
|
cat > "${VM_TMP_DIR}"/metadata.json <<EOF
|
||||||
|
{"provider": "virtualbox"}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
tar -czf "${box}" -C "${VM_TMP_DIR}" "box.ovf" "Vagrantfile" "${dst_name}" "metadata.json"
|
||||||
|
|
||||||
cat > "${VM_README}" <<EOF
|
cat > "${VM_README}" <<EOF
|
||||||
Vagrant >= 1.2.3 is required. Use something like the following to get started:
|
Vagrant >= 1.2.3 is required. Use something like the following to get started:
|
||||||
@ -451,6 +461,50 @@ EOF
|
|||||||
VM_GENERATED_FILES=( "${box}" "${VM_README}" )
|
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 <<EOF
|
||||||
|
{"provider": "vmware_fusion"}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
mv "${vmx_path}" "${VM_TMP_DIR}/"
|
||||||
|
|
||||||
|
tar -czf "${box}" -C "${VM_TMP_DIR}" "Vagrantfile" "${dst_name}" \
|
||||||
|
"${vmx_file}" "metadata.json"
|
||||||
|
|
||||||
|
cat > "${VM_README}" <<EOF
|
||||||
|
Vagrant master (unreleased) currently has full CoreOS support. In the meantime, you may encounter an error about networking that can be ignored
|
||||||
|
vagrant box add coreos path/to/$(basename "${box}")
|
||||||
|
vagrant init coreos
|
||||||
|
vagrant up
|
||||||
|
vagrant ssh
|
||||||
|
|
||||||
|
You will get a warning about "No guest additions were detected...",
|
||||||
|
this is expected and should be ignored. SSH should work just dandy.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Replace list, not append, since we packaged up the disk image.
|
||||||
|
VM_GENERATED_FILES=( "${box}" "${VM_README}" )
|
||||||
|
}
|
||||||
|
|
||||||
vm_cleanup() {
|
vm_cleanup() {
|
||||||
info "Cleaning up temporary files"
|
info "Cleaning up temporary files"
|
||||||
rm -rf "${VM_TMP_DIR}"
|
rm -rf "${VM_TMP_DIR}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user