-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
46 lines (35 loc) · 1.41 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
.PHONY: help
.DEFAULT_GOAL := help
define PRINT_HELP_PYSCRIPT
import re, sys
for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
help:
@python3 -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
export SERVER_ADDR ?= http://$(shell ./scripts/default_ip)
DEFAULT_DISK = $(shell ./scripts/default_disk)
DOCKER_BUILD = DOCKER_BUILDKIT=1 docker build $(BUILD_ARGS) -t $@ --target $@ $(<D)
output:
@mkdir -p -m777 $@
iso: BUILD_ARGS = --build-arg SERVER_ADDR=$(SERVER_ADDR)
iso: output Dockerfile ## build osinstaller.iso to output dir
$(DOCKER_BUILD)
@docker run --rm -v $(PWD)/$<:/$@ $@
@echo "artifact is available on $$(sha256sum output/osinstaller.iso| awk '{print $$2,$$1}')"
chainload.ipxe: output ## build chainload.ipxe to output dir
@python3 scripts/gen_osinstaller_script.py $<
@more $</$@
answerfile: output ## build answerfiles
@cp answerfiles/* $< && sed -i 's/@DISK@/$(DEFAULT_DISK)/g' $</*
http_server: iso boot_ipxe answerfile ## start http server based on output dir
@cp scripts/mount_iso.sh output && bash output/mount_iso.sh
mount_iso: boot_ipxe answerfile ## mount local iso in www/ and start http server for it
@cp scripts/mount_iso.sh output && bash output/mount_iso.sh
clean:
@sudo rm -rf $(PWD)/output
@docker rmi build iso