Merge "Combine compress and save image into one function"

This commit is contained in:
Jenkins 2013-08-28 15:39:56 +00:00 committed by Gerrit Code Review
commit 316d6beeaf
2 changed files with 5 additions and 5 deletions

View File

@ -148,8 +148,7 @@ finalise_base
unmount_image
if [ "$IS_RAMDISK" == "0" ]; then
compress_image
save_image $IMAGE_NAME.$IMAGE_TYPE
compress_and_save_image $IMAGE_NAME.$IMAGE_TYPE
else
remove_image
fi

View File

@ -106,12 +106,13 @@ function finalise_base () {
fi
}
function compress_image () {
function compress_and_save_image () {
# Recreate our image to throw away unnecessary data
test $IMAGE_TYPE != qcow2 && COMPRESS_IMAGE=""
qemu-img convert ${COMPRESS_IMAGE:+-c} -f raw $TMP_IMAGE_PATH -O $IMAGE_TYPE $TMP_IMAGE_PATH-new
qemu-img convert ${COMPRESS_IMAGE:+-c} -f raw $TMP_IMAGE_PATH -O $IMAGE_TYPE $1-new
rm $TMP_IMAGE_PATH
mv $TMP_IMAGE_PATH-new $TMP_IMAGE_PATH
TMP_IMAGE_PATH=$1-new save_image $1
}
function remove_image () {