build-vm, pack: implement qcow2c support

This is a compressed version of good ol' qcow2.

Suggested-by: Alexey Shabalin <shaba@altlinux.org>
This commit is contained in:
Michael Shigorin 2017-12-04 20:02:19 +03:00
parent 0f2411ec34
commit e043f87775
2 changed files with 5 additions and 3 deletions

View File

@ -33,16 +33,18 @@ prepare-image: check-sudo
fi
convert-image: prepare-image
@case "$(IMAGE_TYPE)" in \
@VM_COMPRESS=; \
case "$(IMAGE_TYPE)" in \
"img") mv "$(VM_RAWDISK)" "$(IMAGE_OUTPATH)"; exit 0;; \
"vhd") VM_FORMAT="vpc";; \
"qcow2c") VM_FORMAT="qcow2"; VM_COMPRESS="-c";; \
*) VM_FORMAT="$(IMAGE_TYPE)"; \
esac; \
if ! type -t qemu-img >&/dev/null; then \
echo "** error: qemu-img not available" >&2; \
exit 1; \
else \
qemu-img convert -O "$$VM_FORMAT" \
qemu-img convert $$VM_COMPRESS -O "$$VM_FORMAT" \
"$(VM_RAWDISK)" "$(IMAGE_OUTPATH)"; \
rm "$(VM_RAWDISK)"; \
if [ "0$(DEBUG)" -le 1 ]; then rm "$(VM_TARBALL)"; fi; \

View File

@ -40,6 +40,6 @@ $(foreach c,$(VE_ARCHIVES), \
$(eval $(call PACK_compressors,$(c),$(z)))))
# virtual machines
VM_EXTS := .img .qcow2 .vdi .vmdk .vhd
VM_EXTS := .img .qcow2 .qcow2c .vdi .vmdk .vhd
$(VM_EXTS:.%=use/pack/%): use/pack; @: