Make it possible to not recompress the qcow2 image at the end.
Change-Id: Icca922853ee583dcccb6d3970d080fbec11edac7
This commit is contained in:
parent
115cd0edbb
commit
e8a8e99a08
@ -26,10 +26,12 @@ function show_options () {
|
|||||||
echo " -a i386|amd64 -- set the architecture of the image"
|
echo " -a i386|amd64 -- set the architecture of the image"
|
||||||
echo " -o filename -- set the name of the output file"
|
echo " -o filename -- set the name of the output file"
|
||||||
echo " -x -- turn on tracing"
|
echo " -x -- turn on tracing"
|
||||||
|
echo " -u -- uncompressed; do not compress the image - larger but faster"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMP=`getopt -o a:ho:x -n $SCRIPTNAME -- "$@"`
|
COMPRESS_IMAGE="true"
|
||||||
|
TEMP=`getopt -o a:ho:xu -n $SCRIPTNAME -- "$@"`
|
||||||
echo "XXX $TEMP"
|
echo "XXX $TEMP"
|
||||||
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
|
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
|
||||||
|
|
||||||
@ -42,6 +44,7 @@ while true ; do
|
|||||||
-o) export IMAGE_NAME=$2; shift 2 ;;
|
-o) export IMAGE_NAME=$2; shift 2 ;;
|
||||||
-h) show_options;;
|
-h) show_options;;
|
||||||
-x) shift; set -x;;
|
-x) shift; set -x;;
|
||||||
|
-u) shift; export COMPRESS_IMAGE="";;
|
||||||
--) shift ; break ;;
|
--) shift ; break ;;
|
||||||
*) echo "Internal error!" ; exit 1 ;;
|
*) echo "Internal error!" ; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
@ -63,7 +66,7 @@ mk_build_dir
|
|||||||
ensure_base_available
|
ensure_base_available
|
||||||
eval_run_d block-device-size "IMAGE_SIZE="
|
eval_run_d block-device-size "IMAGE_SIZE="
|
||||||
|
|
||||||
qemu-img create -f qcow2 $TMP_IMAGE_PATH ${IMAGE_SIZE}G
|
qemu-img create -f qcow2 -o preallocation=metadata $TMP_IMAGE_PATH ${IMAGE_SIZE}G
|
||||||
|
|
||||||
# Should have a grab-next-dev helper ?
|
# Should have a grab-next-dev helper ?
|
||||||
NBD_DEV=/dev/nbd0
|
NBD_DEV=/dev/nbd0
|
||||||
|
@ -165,7 +165,7 @@ function finalise_base () {
|
|||||||
|
|
||||||
function compress_image () {
|
function compress_image () {
|
||||||
# Recreate our image to throw away unnecessary data
|
# Recreate our image to throw away unnecessary data
|
||||||
qemu-img convert -c $TMP_IMAGE_PATH -O qcow2 $TMP_IMAGE_PATH-new
|
qemu-img convert ${COMPRESS_IMAGE:+-c} $TMP_IMAGE_PATH -O qcow2 $TMP_IMAGE_PATH-new
|
||||||
rm $TMP_IMAGE_PATH
|
rm $TMP_IMAGE_PATH
|
||||||
mv $TMP_IMAGE_PATH-new $TMP_IMAGE_PATH
|
mv $TMP_IMAGE_PATH-new $TMP_IMAGE_PATH
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user