Merge "Add output image format tgz support"

This commit is contained in:
Jenkins 2016-12-20 03:48:24 +00:00 committed by Gerrit Code Review
commit 9351618e70
4 changed files with 10 additions and 2 deletions

View File

@ -102,7 +102,7 @@ function show_options () {
echo "Options:"
echo " -a i386|amd64|armhf -- set the architecture of the image(default amd64)"
echo " -o imagename -- set the imagename of the output image file(default image)"
echo " -t qcow2,tar,vhd,docker,aci,raw -- set the image types of the output image files (default qcow2)"
echo " -t qcow2,tar,tgz,vhd,docker,aci,raw -- set the image types of the output image files (default qcow2)"
echo " File types should be comma separated. VHD outputting requires the vhd-util"
echo " executable be in your PATH. ACI outputting requires the ACI_MANIFEST "
echo " environment variable be a path to a manifest file."
@ -258,6 +258,10 @@ for X in ${!IMAGE_TYPES[@]}; do
exit 1
fi
;;
tgz)
# Force tar to be created.
IMAGE_TYPES+=('tar')
;;
vhd)
if [ -z "$(which vhd-util)" ]; then
echo "vhd output format specified but no vhd-util executable found."

View File

@ -51,6 +51,7 @@ formats are:
* qcow2
* tar
* tgz
* vhd
* docker
* raw

View File

@ -122,6 +122,9 @@ function compress_and_save_image () {
fi
if [ "$IMAGE_TYPE" = "raw" ]; then
mv $TMP_IMAGE_PATH $1-new
elif [ "$IMAGE_TYPE" == "tgz" ]; then
gzip -9 < $IMAGE_NAME.tar > $1-new
rm $IMAGE_NAME.tar
elif [ "$IMAGE_TYPE" == "vhd" ]; then
cp $TMP_IMAGE_PATH $1-intermediate
vhd-util convert -s 0 -t 1 -i $1-intermediate -o $1-intermediate

View File

@ -59,7 +59,7 @@ function build_test_image() {
fi
}
test_formats="tar raw qcow2 docker aci"
test_formats="tar tgz raw qcow2 docker aci"
for binary in qemu-img docker ; do
if [ -z "$(which $binary)" ]; then
echo "Warning: No $binary binary found, cowardly refusing to run tests."