alpine-zdt-images/Makefile

42 lines
1.6 KiB
Makefile
Raw Normal View History

OVERLAY := $(shell pwd)/overlay
ONLY :=
SKIP :=
2024-04-08 13:01:20 +00:00
FILTER := --only $(ONLY) --skip aarch64 $(SKIP)
STEP := publish
all: build
build:
2023-04-27 07:34:14 +00:00
cd alpine-cloud-images && ./build $(STEP) --clean --pad-uefi-bin-arch '' --revise $(FILTER) --custom $(OVERLAY)/zdt --vars $(OVERLAY)/zdt/zdt.hcl
clean:
rm -rf alpine-cloud-images/work
2022-04-14 15:25:41 +00:00
# Adds all tracked encrypted files to .gitignore as safety net
age-add-gitignore:
2022-04-17 16:30:48 +00:00
@touch .gitignore; for f in $$(yq eval .paths[] .age.yml); do grep -qxF $$f .gitignore || echo $$f >> .gitignore; done
2022-04-14 15:25:41 +00:00
2022-04-19 08:49:26 +00:00
# Decrypts all secrets and deletes encrypted .age
2022-04-14 15:25:41 +00:00
age-unseal:
2022-04-17 16:30:48 +00:00
@for f in $$(yq eval .paths[] .age.yml); do \
age --decrypt -i ~/.ssh/git.age -o $$f $$f.age && rm $$f.age; \
done
2022-04-14 15:25:41 +00:00
2022-04-19 08:49:26 +00:00
# Compares all unencrypted files against last encrypted versions
2022-04-17 16:30:48 +00:00
# If there are no diffs, just restore the .age file from the index and delete the unaltered local unencrypted file
2022-04-19 08:49:26 +00:00
# otherwise re-encrypt and remove clear text
2022-04-14 15:25:41 +00:00
age-seal:
2022-04-17 16:30:48 +00:00
@keys=$$(yq eval .keys[] .age.yml | sed -e 's/^/-r /' ); \
for f in $$(yq eval .paths[] .age.yml); do \
[ -f $$f ] || continue; \
2022-04-19 08:49:26 +00:00
git restore $${f}.age 2>/dev/null && \
age --decrypt -i ~/.ssh/git.age $$f.age | diff -q - $$f 2>/dev/null 1>&2 && \
2022-04-17 16:30:48 +00:00
rm -f $$f || ( rm -f $$f.age; age --encrypt $$keys -o $$f.age $$f && rm -f $$f; ); done
# Just a reference how it could work, requires root though
scan-image:
2024-04-08 13:01:20 +00:00
doas ./scan_image.sh alpine-cloud-images/work/images/aws/*/image.qcow2
pull-upstream: ## pull latest shared alpine-cloud-images
git stash && git subtree pull --prefix alpine-cloud-images git@gitlab.alpinelinux.org:alpine/cloud/alpine-cloud-images.git main --squash && git stash pop