2024-08-04 20:11:28 +00:00
|
|
|
VERSION := development
|
2024-06-18 08:45:21 +00:00
|
|
|
GIT_REF := $(shell git log -1 --format=%H)
|
|
|
|
GIT_AUTHOR := $(shell git log -1 --format=%an)
|
2024-08-04 20:29:39 +00:00
|
|
|
GIT_PUBKEY := $(shell git log -1 --format=%GP)
|
2024-06-18 08:45:21 +00:00
|
|
|
GIT_TIMESTAMP := $(shell git log -1 --format=%cd --date=iso)
|
2024-08-03 04:39:15 +00:00
|
|
|
export
|
|
|
|
|
|
|
|
## Use env vars from latest release when reproducing
|
2024-08-03 04:58:30 +00:00
|
|
|
ifdef REPRODUCE
|
2024-08-03 22:52:30 +00:00
|
|
|
include dist/release.env
|
|
|
|
export
|
2024-08-03 04:39:15 +00:00
|
|
|
endif
|
2024-08-04 20:11:28 +00:00
|
|
|
ifdef NOCACHE
|
|
|
|
NO_CACHE := --no-cache
|
|
|
|
endif
|
2024-06-18 08:45:21 +00:00
|
|
|
|
2023-02-12 12:40:54 +00:00
|
|
|
.DEFAULT_GOAL :=
|
|
|
|
.PHONY: default
|
|
|
|
default: \
|
2024-08-03 04:39:15 +00:00
|
|
|
out/release.env \
|
|
|
|
out/manifest.txt \
|
2024-06-11 21:07:13 +00:00
|
|
|
out/airgap.iso
|
2023-01-30 23:17:54 +00:00
|
|
|
|
2024-08-03 04:39:15 +00:00
|
|
|
## Primary targets
|
|
|
|
|
|
|
|
out/airgap.iso: Containerfile $(shell git ls-files rootfs)
|
2024-08-04 20:11:28 +00:00
|
|
|
SOURCE_DATE_EPOCH=1 \
|
2024-08-03 04:39:15 +00:00
|
|
|
docker build \
|
|
|
|
--progress=plain \
|
2024-08-03 22:52:30 +00:00
|
|
|
--output type=local,rewrite-timestamp=true,dest=out \
|
2024-08-04 20:11:28 +00:00
|
|
|
--build-arg SOURCE_DATE_EPOCH=1 \
|
2024-08-03 05:05:27 +00:00
|
|
|
--build-arg VERSION="$(VERSION)" \
|
2024-08-03 04:39:15 +00:00
|
|
|
--build-arg GIT_REF="$(GIT_REF)" \
|
|
|
|
--build-arg GIT_AUTHOR="$(GIT_AUTHOR)" \
|
2024-08-04 20:29:39 +00:00
|
|
|
--build-arg GIT_PUBKEY="$(GIT_PUBKEY)" \
|
2024-08-03 04:39:15 +00:00
|
|
|
--build-arg GIT_TIMESTAMP="$(GIT_TIMESTAMP)" \
|
2024-08-03 22:52:30 +00:00
|
|
|
$(NO_CACHE) \
|
2024-08-03 04:39:15 +00:00
|
|
|
-f Containerfile \
|
|
|
|
.
|
|
|
|
|
|
|
|
## Development Targets
|
|
|
|
|
2023-01-30 23:17:54 +00:00
|
|
|
.PHONY: vm
|
2024-06-17 18:56:18 +00:00
|
|
|
vm: vm-bios
|
|
|
|
|
|
|
|
.PHONY: vm-bios
|
|
|
|
vm-bios: out/airgap.iso
|
2024-06-11 21:07:13 +00:00
|
|
|
qemu-system-x86_64 \
|
2024-06-17 18:56:18 +00:00
|
|
|
-m 4G \
|
2024-06-11 21:07:13 +00:00
|
|
|
-machine pc \
|
2024-06-17 18:56:18 +00:00
|
|
|
-serial stdio \
|
2024-06-26 07:46:56 +00:00
|
|
|
-usb \
|
|
|
|
-device sdhci-pci \
|
|
|
|
-device sd-card,drive=external \
|
2024-06-27 07:14:34 +00:00
|
|
|
-usbdevice tablet \
|
2024-06-26 07:46:56 +00:00
|
|
|
-drive id=external,if=none,format=raw,file=out/sdcard.img \
|
2024-06-27 07:14:34 +00:00
|
|
|
-display gtk,show-menubar=off,zoom-to-fit=on \
|
2024-06-11 21:07:13 +00:00
|
|
|
-cdrom "out/airgap.iso"
|
2020-07-24 10:07:39 +00:00
|
|
|
|
2024-06-17 18:56:18 +00:00
|
|
|
.PHONY: vm-efi
|
2024-06-18 08:45:21 +00:00
|
|
|
vm-efi: out/airgap.iso
|
2024-06-11 21:07:13 +00:00
|
|
|
qemu-system-x86_64 \
|
|
|
|
-m 4G \
|
2024-06-17 18:56:18 +00:00
|
|
|
-machine pc \
|
|
|
|
-serial stdio \
|
2024-06-11 21:07:13 +00:00
|
|
|
-bios /usr/share/ovmf/OVMF.fd \
|
2024-06-26 07:46:56 +00:00
|
|
|
-usb \
|
|
|
|
-device sdhci-pci \
|
|
|
|
-device sd-card,drive=external \
|
2024-06-27 07:14:34 +00:00
|
|
|
-usbdevice tablet \
|
2024-06-26 07:46:56 +00:00
|
|
|
-drive id=external,if=none,format=raw,file=out/sdcard.img \
|
2024-06-27 07:14:34 +00:00
|
|
|
-display gtk,show-menubar=off,zoom-to-fit=on \
|
2024-06-11 21:07:13 +00:00
|
|
|
-cdrom "out/airgap.iso"
|
|
|
|
|
2024-08-03 04:39:15 +00:00
|
|
|
## Signing, Verification, and Release Targets
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -rf out
|
|
|
|
|
|
|
|
.PHONY: release
|
2024-08-04 20:11:28 +00:00
|
|
|
release: clean
|
2024-08-03 04:39:15 +00:00
|
|
|
rm -rf dist/*
|
2024-08-04 20:11:28 +00:00
|
|
|
$(MAKE) NOCACHE=1 VERSION=$(VERSION)
|
2024-08-03 04:39:15 +00:00
|
|
|
cp -R out/release.env out/airgap.iso out/manifest.txt dist/
|
|
|
|
|
|
|
|
.PHONY: sign
|
|
|
|
sign:
|
|
|
|
set -e; \
|
|
|
|
git config --get user.signingkey 2>&1 >/dev/null || { \
|
|
|
|
echo "Error: git user.signingkey is not defined"; \
|
|
|
|
exit 1; \
|
|
|
|
}; \
|
|
|
|
fingerprint=$$(\
|
|
|
|
git config --get user.signingkey \
|
|
|
|
| sed 's/.*\([A-Z0-9]\{16\}\).*/\1/g' \
|
|
|
|
); \
|
|
|
|
gpg --armor \
|
|
|
|
--detach-sig \
|
|
|
|
--output dist/manifest.$${fingerprint}.asc \
|
|
|
|
dist/manifest.txt
|
|
|
|
|
|
|
|
.PHONY: verify
|
|
|
|
verify: | dist/manifest.txt
|
|
|
|
set -e; \
|
|
|
|
for file in dist/manifest.*.asc; do \
|
|
|
|
echo "\nVerifying: $${file}\n"; \
|
|
|
|
gpg --verify $${file} dist/manifest.txt; \
|
|
|
|
done;
|
|
|
|
|
|
|
|
.PHONY: reproduce
|
|
|
|
reproduce: clean | out
|
2024-08-04 20:11:28 +00:00
|
|
|
$(MAKE) REPRODUCE=true NOCACHE=1
|
2024-08-03 04:39:15 +00:00
|
|
|
diff -q out/manifest.txt dist/manifest.txt;
|
|
|
|
|
|
|
|
out:
|
|
|
|
mkdir -p $@
|
|
|
|
|
2024-08-03 04:44:19 +00:00
|
|
|
out/release.env: $(shell git ls-files) | out
|
2024-08-03 04:39:15 +00:00
|
|
|
echo 'VERSION=$(VERSION)' > out/release.env
|
|
|
|
echo 'GIT_REF=$(GIT_REF)' >> out/release.env
|
|
|
|
echo 'GIT_AUTHOR=$(GIT_AUTHOR)' >> out/release.env
|
2024-08-04 20:29:39 +00:00
|
|
|
echo 'GIT_PUBKEY=$(GIT_PUBKEY)' >> out/release.env
|
2024-08-03 04:39:15 +00:00
|
|
|
echo 'GIT_TIMESTAMP=$(GIT_TIMESTAMP)' >> out/release.env
|
|
|
|
|
|
|
|
out/manifest.txt: out/airgap.iso out/release.env | out
|
|
|
|
openssl sha256 -r \
|
|
|
|
out/airgap.iso \
|
|
|
|
out/release.env \
|
|
|
|
| sed -e 's/ \*out\// /g' -e 's/ \.\// /g' \
|
|
|
|
> $@
|