From 7b872fa91b417daf1dcbef0babb6b5cc875f2b84 Mon Sep 17 00:00:00 2001 From: Victor Collod Date: Wed, 5 Jul 2017 15:57:37 +0200 Subject: [PATCH] create-image-from-http.sh: do not force bootscript --- examples/create-image-from-http.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/create-image-from-http.sh b/examples/create-image-from-http.sh index c589db97c0..e428f6af56 100755 --- a/examples/create-image-from-http.sh +++ b/examples/create-image-from-http.sh @@ -16,7 +16,6 @@ fi NAME=$(basename "${URL}") SNAPSHOT_NAME=${NAME%.*}-$(date +%Y-%m-%d_%H:%M) IMAGE_NAME=${IMAGE_NAME:-$SNAPSHOT_NAME} -IMAGE_BOOTSCRIPT=${IMAGE_BOOTSCRIPT:stable} SCW_COMMERCIAL_TYPE=${SCW_COMMERCIAL_TYPE:-VC1S} VOLUME_SIZE=${VOLUME_SIZE:-50GB} SCW_TARGET_ARCH=x86_64 @@ -72,11 +71,13 @@ echo "[+] Snapshot ${SNAPSHOT} created" echo "[+] Creating an image based of the snapshot" -if [ -n "${IMAGE_ARCH}" ]; then - IMAGE=$(scw tag --arch="${IMAGE_ARCH}" --bootscript="${IMAGE_BOOTSCRIPT}" "${SNAPSHOT}" "${IMAGE_NAME}") -else - IMAGE=$(scw tag --bootscript="${IMAGE_BOOTSCRIPT}" "${SNAPSHOT}" "${IMAGE_NAME}") -fi +tag_args=() + +[ -n "${IMAGE_ARCH}" ] && tag_args+=(--arch="${IMAGE_ARCH}") +[ -n "${IMAGE_BOOTSCRIPT}" ] && tag_args+=(--bootscript="${IMAGE_BOOTSCRIPT}") + +IMAGE=$(scw tag "${tag_args[@]}" "${SNAPSHOT}" "${IMAGE_NAME}") + echo "[+] Image created: ${IMAGE}"