summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorJonathan Bauer2018-02-20 12:46:51 +0100
committerJonathan Bauer2018-02-20 12:56:08 +0100
commit03a63a3ad184d6f4428c7fbae9648b9ca0cdb9a5 (patch)
tree677a47fe23089dbb6ff0fcb55c63c0327f0a8bb8 /Makefile
parentMakefile: PACKER_OPTS: fix variable usage (diff)
downloadpacker-templates-03a63a3ad184d6f4428c7fbae9648b9ca0cdb9a5.tar.gz
packer-templates-03a63a3ad184d6f4428c7fbae9648b9ca0cdb9a5.tar.xz
packer-templates-03a63a3ad184d6f4428c7fbae9648b9ca0cdb9a5.zip
Makefile: fix <template>/base/boot targets
The different build directories for base and provisioning targets lead to broken base/boot targets. We now set the BUILD_DIR and ANSIBLE_DIR_CUR depending on the type of flavor we build the boot files for.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 11 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 8deb0a0..89f5117 100644
--- a/Makefile
+++ b/Makefile
@@ -131,17 +131,22 @@ $(foreach flav, $(FLAVORS), %/$(flav)): %/base
# Generating boot files
$(BOOTTARGETS):
%/boot: %
- $(eval BUILD_DIR := $(@D).$(TIMESTAMP))
+ $(eval BUILD_DIR := $(if $(filter base,$(notdir $(@D))),\
+ $(@D),\
+ $(@D).$(TIMESTAMP)/build))
+ $(eval ANSIBLE_DIR_CUR := $(if $(filter base,$(notdir $(@D))),\
+ $(ANSIBLE_DIR),\
+ $(@D).$(TIMESTAMP)/$(ANSIBLE_DIR)))
$(info ** Generating boot files for '$(BUILD_DIR)')
$(PACKER) build -only=$(BUILDER) \
$(PACKER_OPTS) \
-var='vm_name=rootfs-image.tmp' \
- -var='output_directory=$(BUILD_DIR)/build/tmp' \
- -var='base_image=$(BUILD_DIR)/build/rootfs-image' \
+ -var='output_directory=$(BUILD_DIR)/tmp' \
+ -var='base_image=$(BUILD_DIR)/rootfs-image' \
-var='playbook=build-dracut-initramfs.yml' \
- $(BUILD_DIR)/$(ANSIBLE_DIR)/run-playbook-only.json
- @mv $(BUILD_DIR)/$(ANSIBLE_DIR)/boot_files $(BUILD_DIR)/build/boot
- $(if $(DEBUG),,@rm -rf $(BUILD_DIR)/build/tmp)
+ $(ANSIBLE_DIR_CUR)/run-playbook-only.json
+ @mv $(ANSIBLE_DIR_CUR)/boot_files $(BUILD_DIR)/boot
+ $(if $(DEBUG),,@rm -rf $(BUILD_DIR)/tmp)
clean_except_last: