diff options
author | Thiago Abdo | 2019-10-29 13:20:34 +0100 |
---|---|---|
committer | Thiago Abdo | 2019-10-29 13:20:34 +0100 |
commit | 919a52e7878bd57a2b8dcc2ef946c66904b2375f (patch) | |
tree | f0c955f45cb395d26929816c13f8d4bfd4dae361 /Makefile | |
parent | Safely remove targets (diff) | |
download | packer-templates-919a52e7878bd57a2b8dcc2ef946c66904b2375f.tar.gz packer-templates-919a52e7878bd57a2b8dcc2ef946c66904b2375f.tar.xz packer-templates-919a52e7878bd57a2b8dcc2ef946c66904b2375f.zip |
When removing a target you should also remove the link to it
Signed-off-by: Thiago Abdo <tjabdo@inf.ufpr.br>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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 |