diff options
author | Manuel Messner | 2018-02-20 16:21:56 +0100 |
---|---|---|
committer | Manuel Messner | 2018-02-20 16:21:56 +0100 |
commit | 07049ea9f692053e9eeeb978ae632f62c73cd61c (patch) | |
tree | ac9007d7c4899e728ce4924b0c2503777ab453b9 /Makefile | |
parent | Makefile: boot: fix spacing (diff) | |
download | packer-templates-07049ea9f692053e9eeeb978ae632f62c73cd61c.tar.gz packer-templates-07049ea9f692053e9eeeb978ae632f62c73cd61c.tar.xz packer-templates-07049ea9f692053e9eeeb978ae632f62c73cd61c.zip |
Makefile: clean_except_last: fix bug if no prov builds available
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -154,12 +154,20 @@ $(BOOTTARGETS): clean_except_last: @-$(foreach template,$(TEMPLATES),\ - $(foreach flavor,$(FLAVORS),\ - test -d $(template) && \ - find $(template)/* -maxdepth 0 -type d \ - -not -name base \ - -not -wholename $(template)/$$(readlink $(template)/$(flavor).latest) \ - -print0 | xargs -0 rm -rf);) + $(eval exclusions := $(shell test -d $(template) && \ + find $(template) \ + -maxdepth 1 \ + -type l \ + -print0 \ + | xargs -r -0 -n1 readlink))\ + test -d $(template) && \ + find $(template)/* \ + -maxdepth 0 \ + -type d \ + $(foreach file,$(exclusions),-not -name $(file) ) \ + -not -name base \ + -print0 \ + | xargs -r -0 -n1 rm -rf; ) clean_bases: |