openwrt/Makefile
2026-11-18 13:01:01 +03:00

40 lines
1.9 KiB
Makefile

IMAGE := luci-app-ocserv-build
IMAGE_AWG := luci-app-amneziawg-build
KORNORD_THEME ?= $(CURDIR)/packages/luci-theme-kornord
KDBX ?= /home/lans/Home/Webdav/KeePass/keepasshome.kdbx
ENTRY ?= 09. CRYPT/r4ven-apk.pem
ATTACH ?= r4ven-apk.pem
# Private key lives only in KeePassXC: export it to tmpfs for the duration of the build.
define with_signing_key
set -e; \
tmp=$$(mktemp -d /dev/shm/r4ven-sign.XXXXXX); \
trap 'rm -rf "$$tmp"' EXIT; \
cp keys/r4ven-apk.pub "$$tmp/"; \
secret-tool lookup Kee Pass | keepassxc-cli attachment-export -q "$(KDBX)" "$(ENTRY)" "$(ATTACH)" "$$tmp/r4ven-apk.pem"; \
chmod 600 "$$tmp/r4ven-apk.pem"; \
$(1)
endef
.PHONY: build build-awg draft clean
build:
docker build -f build/Dockerfile -t $(IMAGE) .
@$(call with_signing_key,docker run --rm -v $(CURDIR)/packages/luci-app-ocserv:/src:ro -v $(CURDIR)/build/build.sh:/build.sh:ro -v "$$tmp":/keys:ro -v $(CURDIR)/dist:/out $(IMAGE) /build.sh)
build-awg:
test -f "$(KORNORD_THEME)/Makefile" || { echo "Kornord theme not found: $(KORNORD_THEME)" >&2; exit 1; }
mkdir -p dist-awg
docker build -f build/Dockerfile.awg -t $(IMAGE_AWG) .
@$(call with_signing_key,docker run --rm -v $(CURDIR)/packages/luci-app-amneziawg:/src:ro -v $(CURDIR)/packages/luci-proto-amneziawg:/src-proto:ro -v $(CURDIR)/packages/luci-i18n-amneziawg-ru-r4ven-me:/src-i18n:ro -v $(KORNORD_THEME):/src-theme:ro -v $(CURDIR)/build/build-awg.sh:/build.sh:ro -v "$$tmp":/keys:ro -v $(CURDIR)/dist-awg:/out $(IMAGE_AWG) /build.sh)
# Creates a draft release on Forgejo with the apks of dist/ and dist-awg/. Then, in the pkgs project:
# make release REPO=lans/openwrt TAG=vX (signs the apks and the indexes and publishes them on pkgs.r4ven.me).
# Usage: make draft TAG=v1.2.3 (needs FORGEJO_TOKEN in the environment)
draft:
test -n "$(TAG)" || { echo "usage: make draft TAG=vX" >&2; exit 1; }
build/draft-release.sh "$(TAG)"
clean:
rm -rf dist/* dist-awg/*