Files
Vetting/live-image/Makefile
T
josh a893b0d817
CI / Lint + build + test (push) Successful in 1m33s
Release / release (push) Failing after 1m43s
live-image: stage agent binary via mkosi.extra
mkosi only mounts live-image/ as /work/src, so the postinst couldn't
reach the repo-root bin/vetting-agent.linux-amd64 — the build failed
in CI with `install: cannot stat '/work/src/bin/vetting-agent.linux-amd64'`.

The Makefile now copies the prebuilt agent into mkosi.extra/, which
mkosi merges into the image root automatically. The postinst is
reduced to creating the multi-user.target.wants symlink.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 03:13:38 -04:00

39 lines
1.2 KiB
Makefile

# live-image/Makefile — builds the Debian live image that PXE-booted
# hosts land in. Requires a Linux host (or WSL) with mkosi installed.
# On native Windows this Makefile short-circuits with a clear message.
ifeq ($(OS),Windows_NT)
UNAME_S := Windows
else
UNAME_S := $(shell uname -s)
endif
REPO_ROOT := $(abspath ..)
AGENT_BIN := $(REPO_ROOT)/bin/vetting-agent.linux-amd64
MKOSI_EXTRA_AGENT := mkosi.extra/usr/local/sbin/vetting-agent
.PHONY: all check-linux agent clean
all: check-linux $(MKOSI_EXTRA_AGENT)
mkosi --force build
agent: $(AGENT_BIN)
$(AGENT_BIN):
cd $(REPO_ROOT) && GOOS=linux GOARCH=amd64 go build -o $(AGENT_BIN) ./cmd/vetting-agent
# Stage the prebuilt agent into mkosi.extra/ so mkosi copies it into the
# image root without the postinst needing to reach outside the source tree.
$(MKOSI_EXTRA_AGENT): $(AGENT_BIN)
install -D -m 0755 $< $@
check-linux:
ifneq ($(UNAME_S),Linux)
@echo "ERROR: live-image must be built on Linux (you're on $(UNAME_S))."
@echo "Run 'wsl make -C live-image all' from Windows instead."
@exit 1
endif
@command -v mkosi >/dev/null 2>&1 || { echo "ERROR: mkosi not installed. Try: apt install mkosi"; exit 1; }
clean:
rm -rf build mkosi.output mkosi.cache mkosi.extra