Makefile: add iso_checksum target
This commit is contained in:
parent
1432187a8f
commit
80badf8182
2 changed files with 7 additions and 4 deletions
7
Makefile
7
Makefile
|
@ -1,4 +1,4 @@
|
|||
all: alpine-qemu.pkr.hcl
|
||||
all: iso_checksum alpine-qemu.pkr.hcl
|
||||
|
||||
alpine-qemu.pkr.hcl:
|
||||
@echo "==> Validating $@ ..."
|
||||
|
@ -12,4 +12,7 @@ format:
|
|||
clean:
|
||||
@find ./artifacts/* -prune -exec rm -rfv {} \;
|
||||
|
||||
.PHONY: all alpine-qemu.pkr.hcl format clean
|
||||
iso_checksum:
|
||||
@find . -name *.pkr.hcl -type f -exec sh update_iso_checksum.sh {} \;
|
||||
|
||||
.PHONY: all alpine-qemu.pkr.hcl format clean iso_checksum
|
||||
|
|
|
@ -15,6 +15,6 @@ fi
|
|||
|
||||
iso_url=$(hcl2json "$filename" | jq -r '.variable.iso_url[].default')
|
||||
|
||||
printf "Checking sha512sum of \033[1;34m%s\033[0m ...\n" "$iso_url"
|
||||
printf "Checking sha512sum of \033[1;33m%s\033[0m ...\n" "$iso_url"
|
||||
sha512_sum=$(wget -qO- "${iso_url}".sha512 | awk '{print $1}')
|
||||
sed -i -E "s|(default = \"sha512:).*\"|\\1$sha512_sum\"|g" "$filename" && echo "ISO checksum updated."
|
||||
sed -i -E "s|(default = \"sha512:).*\"|\\1$sha512_sum\"|g" "$filename" && printf "ISO checksum updated in \033[1;32m%s\033[0m.\n" "$filename"
|
||||
|
|
Loading…
Reference in a new issue