|
1 | 1 | PACKER_CMD ?= packer |
2 | | -CONTAINER_LINUX_RELEASE ?= stable |
3 | | -CONTAINER_LINUX_IMAGE_DIGEST_URL ?= https://$(CONTAINER_LINUX_RELEASE).release.core-os.net/amd64-usr/current/coreos_production_iso_image.iso.DIGESTS |
4 | | -CONTAINER_LINUX_CONFIG ?= container-linux-config.yml |
| 2 | +RELEASE ?= alpha |
| 3 | +DIGEST_URL ?= https://$(RELEASE).release.core-os.net/amd64-usr/current/coreos_production_iso_image.iso.DIGESTS |
| 4 | +CONFIG ?= container-linux-config.yml |
5 | 5 | DISK_SIZE ?= 40000 |
6 | 6 | MEMORY ?= 1024M |
7 | 7 | BOOT_WAIT ?= 45s |
8 | 8 |
|
9 | | -container-linux: builds/container-linux-$(CONTAINER_LINUX_RELEASE).qcow2 |
| 9 | +container-linux: builds/container-linux-$(RELEASE).qcow2 |
10 | 10 |
|
11 | | -builds/container-linux-$(CONTAINER_LINUX_RELEASE).qcow2: |
12 | | - $(eval CONTAINER_LINUX_IMAGE_ISO_CHECKSUM := $(shell curl -s "$(CONTAINER_LINUX_IMAGE_DIGEST_URL)" | grep "coreos_production_iso_image.iso" | awk '{ print length, $1ドル | "sort -rg"}' | awk 'NR == 1 { print $2ドル }')) |
| 11 | +builds/container-linux-$(RELEASE).qcow2: |
| 12 | + $(eval ISO_CHECKSUM := $(shell curl -s "$(DIGEST_URL)" | grep "coreos_production_iso_image.iso" | awk '{ print length, $1ドル | "sort -rg"}' | awk 'NR == 1 { print $2ドル }')) |
| 13 | + |
| 14 | + ct -pretty -in-file $(CONFIG) -out-file ignition.json |
13 | 15 |
|
14 | 16 | $(PACKER_CMD) build -force \ |
15 | | - -var 'release=$(CONTAINER_LINUX_RELEASE)' \ |
16 | | - -var 'iso_checksum=$(CONTAINER_LINUX_IMAGE_ISO_CHECKSUM)' \ |
| 17 | + -var 'release=$(RELEASE)' \ |
| 18 | + -var 'iso_checksum=$(ISO_CHECKSUM)' \ |
17 | 19 | -var 'iso_checksum_type=sha512' \ |
18 | 20 | -var 'disk_size=$(DISK_SIZE)' \ |
19 | 21 | -var 'memory=$(MEMORY)' \ |
20 | 22 | -var 'boot_wait=$(BOOT_WAIT)' \ |
21 | | - -var 'config=$(CONTAINER_LINUX_CONFIG)' \ |
22 | 23 | container-linux.json |
23 | 24 |
|
24 | 25 | clean: |
25 | | - rm -rf builds packer_cache |
| 26 | + rm -rf builds |
26 | 27 |
|
27 | | -.PHONY: clean |
| 28 | +cache-clean: |
| 29 | + rm -rf packer_cache |
| 30 | + |
| 31 | +ct: /usr/local/bin/ct |
| 32 | + |
| 33 | +/usr/local/bin/ct: |
| 34 | + wget -O /usr/local/bin/ct https://github.com/coreos/container-linux-config-transpiler/releases/download/v0.4.2/ct-v0.4.2-x86_64-unknown-linux-gnu |
| 35 | + chmod +x /usr/local/bin/ct |
| 36 | + |
| 37 | +ct-update: ct-clean ct |
| 38 | + |
| 39 | +ct-clean: |
| 40 | + rm /usr/local/bin/ct |
| 41 | + |
| 42 | +.PHONY: clean cache-clean ct-update ct-clean |
0 commit comments