summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile9
1 files changed, 7 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 7486bc9..f662007 100644
--- a/Makefile
+++ b/Makefile
@@ -220,11 +220,16 @@ $(COMPRESSTARGETS):
# Safe removal of images
$(BASERMTARGETS):
rm/%: %/*.backinglock
- @rm -rf $(@)
+ $(eval BUILD_DIR := $(subst rm/,,$(@)))
+ @rm -rf $(BUILD_DIR)
$(PROVRMTARGETS):
rm/%: %/build/*.backinglock
- @rm -rf $(@)
+ $(eval BUILD_DIR := $(subst rm/,,$(@))/build)
+ $(eval FATHER_BUILD := $(dir $(shell qemu-img info $(BUILD_DIR)/rootfs-image | grep "backing file" | cut -d\ -f3-)))
+ $(eval BUILD_TIME := $(subst .,,$(suffix $(@))))
+ @rm -rf $(FATHER_BUILD)/$(BUILD_TIME).backinglock
+ @rm -rf $(BUILD_DIR)
%.backinglock: backinglock
@qemu-img convert -f qcow2 $(@)/build/rootfs-image -O qcow2 $(@)/build/rootfs-image.tmp