mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-23 22:51:03 +02:00
fix(image_to_vm): Use saved version info instead of parsing directory.
Trying to include version info by adding the directory name to VM image names didn't work and a better solution is for build_image to write out a version.txt file. This should also fix an issue where uploading from image_to_vm.sh didn't always go to the same location as the images uploaded from build_image did.
This commit is contained in:
parent
8e0c8bb8d0
commit
7c48115da6
15
build_image
15
build_image
@ -198,7 +198,16 @@ fi
|
||||
|
||||
# Generating AU generator zip file to run outside chroot
|
||||
generate_au_zip || echo "Failed generating AU zip file - ignoring Error..."
|
||||
upload_image "${BUILD_DIR}/au-generator.zip"
|
||||
|
||||
# Write out a version.txt file, this will be used by image_to_vm.sh
|
||||
tee "${BUILD_DIR}/version.txt" <<EOF
|
||||
COREOS_BUILD=${COREOS_BUILD}
|
||||
COREOS_BRANCH=${COREOS_BRANCH}
|
||||
COREOS_PATCH=${COREOS_PATCH}
|
||||
COREOS_SDK_VERSION=${COREOS_SDK_VERSION}
|
||||
EOF
|
||||
|
||||
upload_image "${BUILD_DIR}/au-generator.zip" "${BUILD_DIR}/version.txt"
|
||||
|
||||
# Create a named symlink.
|
||||
LINK_NAME="${FLAGS_output_root}/${BOARD}/${FLAGS_symlink}"
|
||||
@ -213,8 +222,10 @@ print_image_to_vm() {
|
||||
fi
|
||||
|
||||
cat << EOF
|
||||
To convert it to a VMWare image, use:
|
||||
To convert it to a virtual machine image, use:
|
||||
./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR} --board=${BOARD} ${flags}
|
||||
|
||||
The default type is qemu, see ./image_to_vm.sh --help for other options.
|
||||
EOF
|
||||
}
|
||||
|
||||
|
@ -99,14 +99,7 @@ set_vm_paths() {
|
||||
VM_DST_IMG="${dst_dir}/${dst_name}"
|
||||
VM_TMP_DIR="${dst_dir}/${dst_name}.vmtmpdir"
|
||||
VM_TMP_IMG="${VM_TMP_DIR}/disk_image.bin"
|
||||
|
||||
# If src_dir happens to be in the build directory figure out the version
|
||||
# from the directory name and use it in the vm name for config files.
|
||||
VM_NAME=$(_src_to_dst_name "${src_name}" "")
|
||||
if [[ "${src_dir}" =~ /build/images/${BOARD}/\d+\.\d+\.[^/]*$ ]]; then
|
||||
VM_NAME+="-$(basename ${src_dir})"
|
||||
fi
|
||||
|
||||
VM_NAME="$(_src_to_dst_name "${src_name}" "")-${COREOS_VERSION_STRING}"
|
||||
VM_UUID=$(uuidgen)
|
||||
VM_README="${dst_dir}/$(_src_to_dst_name "${src_name}" ".README")"
|
||||
}
|
||||
|
@ -88,6 +88,12 @@ fi
|
||||
FLAGS_from=`eval readlink -f $FLAGS_from`
|
||||
FLAGS_to=`eval readlink -f $FLAGS_to`
|
||||
|
||||
# If source includes version.txt switch to its version information
|
||||
if [ -f "${FLAGS_from}/version.txt" ]; then
|
||||
source "${FLAGS_from}/version.txt"
|
||||
COREOS_VERSION_STRING="${COREOS_BUILD}.${COREOS_BRANCH}.${COREOS_PATCH}"
|
||||
fi
|
||||
|
||||
if [ ${FLAGS_prod_image} -eq ${FLAGS_TRUE} ]; then
|
||||
set_vm_paths "${FLAGS_from}" "${FLAGS_to}" "${COREOS_PRODUCTION_IMAGE_NAME}"
|
||||
elif [ ${FLAGS_test_image} -eq ${FLAGS_TRUE} ]; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user