Add support for building smaller Azure VHD for development

Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
This commit is contained in:
Nathan LeClaire 2016-11-04 17:13:38 -07:00
parent f7d275918e
commit b737435985
2 changed files with 5 additions and 2 deletions

View File

@ -96,6 +96,7 @@ ami-clean-mount:
uploadvhd: azure
docker run \
-i \
-e VHD_SIZE \
-e AZURE_STG_ACCOUNT_KEY \
-e AZURE_STG_ACCOUNT_NAME \
-e CONTAINER_NAME \

View File

@ -35,8 +35,10 @@ case "$1" in
rm "${RAW_IMAGE}"
fi
VHD_SIZE=${VHD_SIZE:-"30G"}
arrowecho "Writing empty image file"
dd if=/dev/zero of="${RAW_IMAGE}" count=0 bs=1 seek=30G
dd if=/dev/zero of="${RAW_IMAGE}" count=0 bs=1 seek="${VHD_SIZE}"
arrowecho "Formatting image file for boot"
format_on_device "${RAW_IMAGE}"
@ -70,7 +72,7 @@ case "$1" in
AZURE_STG_ACCOUNT_NAME=${AZURE_STG_ACCOUNT_NAME:-"mobyvhd"}
CONTAINER_NAME=${CONTAINER_NAME:-"vhd"}
BLOBNAME=${BLOBNAME:-$(md5sum "/tmp/mobylinux.vhd" | awk '{ print $1; }')-mobylinux.vhd}
BLOBNAME=${BLOBNAME:-$(head -c 200m "/tmp/mobylinux.vhd" | md5sum | awk '{ print $1; }')-mobylinux.vhd}
BLOB_URL="https://${AZURE_STG_ACCOUNT_NAME}.blob.core.windows.net/${CONTAINER_NAME}/${BLOBNAME}"
arrowecho "Uploading VHD to ${BLOBURL}..."