| 1 | nodes := $(patsubst nodes/%.yml,%,$(wildcard nodes/*.yml)) |
| 2 | profiles-di = $(patsubst %,content/%/preseed.cfg,$(subst -,/,$(nodes))) |
| 3 | profiles-script = $(patsubst %/preseed.cfg,%/script.sh,$(profiles-di)) |
| 4 | profiles = $(profiles-di) $(profiles-script) |
| 5 | mdfiles = content/MD5SUMS |
| 6 | shafiles = $(patsubst %,content/SHA%SUMS,1 256 512) |
| 7 | checksumfiles = $(mdfiles) $(shafiles) |
| 8 | signfiles = $(patsubst %,%.sig,$(checksumfiles)) |
| 9 | info = content/NEWS content/TODO |
| 10 | |
| 11 | suite ?= jessie |
| 12 | |
| 13 | all: $(checksumfiles) $(info) |
| 14 | sign: $(signfiles) |
| 15 | |
| 16 | $(profiles-di): content/%/preseed.cfg: |
| 17 | mkdir -p $(dir $@) |
| 18 | cd $(dir $@) \ |
| 19 | && boxer compose \ |
| 20 | --nodedir $(CURDIR)/nodes \ |
| 21 | --skeldir $(CURDIR)/skel \ |
| 22 | --suite $(suite) \ |
| 23 | $(subst /,-,$*) |
| 24 | |
| 25 | $(profiles-script): content/%/script.sh: content/%/preseed.cfg |
| 26 | |
| 27 | $(mdfiles): content/MD%SUMS: $(profiles) |
| 28 | cd content && md$*sum $(profiles:content/%=%) > MD$*SUMS~ |
| 29 | rm -f [email protected] |
| 30 | mv -f $@~ $@ |
| 31 | |
| 32 | $(shafiles): content/SHA%SUMS: $(profiles) |
| 33 | cd content && sha$*sum $(profiles:content/%=%) > SHA$*SUMS~ |
| 34 | rm -f [email protected] |
| 35 | mv -f $@~ $@ |
| 36 | |
| 37 | $(signfiles): %.sig: % $(checksumfiles) |
| 38 | rm -f $@ |
| 39 | gpg --detach-sign -a -o $@ $< |
| 40 | |
| 41 | $(info): content/% : % |
| 42 | mkdir -p content |
| 43 | cp -f $< $@ |
| 44 | |
| 45 | clean: |
| 46 | rm -rf content |