diff options
-rw-r--r-- | Makefile | 15 | ||||
-rw-r--r-- | ansible-provisioner.json | 2 |
2 files changed, 17 insertions, 0 deletions
@@ -53,6 +53,8 @@ FLAVORS := $(patsubst $(ANSIBLE_DIR_PROV)/setup-%.yml,%, $(wildcard $(ANSIBLE_DI BASETARGETS := $(foreach template, $(TEMPLATES), $(template)/base) PROVTARGETS := $(foreach template, $(TEMPLATES), $(foreach flavor, $(FLAVORS), $(template)/$(flavor))) REPROVTARGETS := $(foreach template, $(TEMPLATES), $(foreach flavor, $(FLAVORS), $(filter-out $(template)/$(flavor).latest,$(wildcard $(template)/$(flavor).*)))) +COMPRESSPOSSIBLE := $(foreach template, $(TEMPLATES), $(foreach flavor, $(FLAVORS), $(wildcard $(template)/$(flavor).*))) +COMPRESSTARGETS := $(foreach possible, $(COMPRESSPOSSIBLE), $(possible)/compress) BOOTTARGETS := $(foreach template, $(TEMPLATES), $(template)/base/boot) BOOTTARGETS += $(foreach prov, $(PROVTARGETS), $(prov)/boot) CURBOOTTARGETS := $(foreach prov, $(REPROVTARGETS), $(prov)/boot) @@ -203,6 +205,16 @@ $(BOOTTARGETS) $(CURBOOTTARGETS): $(if $(DEBUG),,@rm -rf $(BUILD_DIR)/tmp) +$(COMPRESSTARGETS): + $(info ** Commiting and Compressing all changes to the image **) + $(eval IMAGE_NAME := $(@D)/build/rootfs-image) + @qemu-img convert -p -f qcow2 -c $(IMAGE_NAME) -O qcow2 $(IMAGE_NAME).tmp + @rm -f $(IMAGE_NAME) + @mv $(IMAGE_NAME).tmp $(IMAGE_NAME) + + + + clean_except_last: @-$(foreach template,$(TEMPLATES),\ $(eval exclusions := $(shell test -d $(template) && \ @@ -256,6 +268,9 @@ help: @echo "Generate boot files targets:" @printf "\t<{base,provisioning}_target>/boot\n" @echo + @echo "Commiting backing files and Compressing targets:" + @for C in $(COMPRESSTARGETS); do printf "\t%s\n" "$$C"; done + @echo @echo "Available options are:" @printf "\tANSIBLE_DIR_CORE: Set directory with ansible roles for building initramfs (def: ansible-roles)\n" @printf "\tANSIBLE_DIR_PROV: Set directory with ansible roles for provisioning (def: ansible-roles-prov)\n" diff --git a/ansible-provisioner.json b/ansible-provisioner.json index 6dec7a8..03c5810 100644 --- a/ansible-provisioner.json +++ b/ansible-provisioner.json @@ -11,6 +11,8 @@ "vm_name": "{{ user `vm_name` }}", "accelerator": "kvm", "disk_image": "true", + "skip_compaction": "true", + "use_backing_file": "true", "disk_size": "{{ user `disk_size` }}", "format": "qcow2", "headless": "{{ user `headless` }}", |