Files
sower/Makefile
T
wweir f37e5fa758 feat(install): add a one-shot installer for systemd, procd and launchd
Installing sower meant grabbing a tarball and wiring the service up by hand,
and the packaged unit was too fragile for something a resolver depends on
(on-failure restart after 1min, no memory limit).

Add install.sh: detects the platform and init system, installs or upgrades
the binary atomically, keeps an existing config, verifies the release
SHA256SUMS unless explicitly opted out, and registers the service on systemd,
OpenWrt procd or macOS launchd. Every network call carries an explicit
timeout, the OpenWrt init script ships in Linux tarballs, the release
workflow generates SHA256SUMS, the README documents the installer, and
make test syntax-checks the scripts.
2026-09-18 22:53:55 +08:00

35 lines
700 B
Makefile

MAKEFLAGS += --jobs all
GO:=CGO_ENABLED=0 go
default: test build
test: web check-scripts
${GO} vet ./...
${GO} test ./...
.PHONY: check-scripts
check-scripts:
sh -n install.sh
sh -n .github/sower.init
build: sower sowerd
.PHONY: web
web:
cd web && bun install --frozen-lockfile && bun run build
.PHONY: sower
sower: web
${GO} build -ldflags "\
-X main.version=$(shell git describe --tags --always) \
-X main.date=$(shell date +%Y-%m-%d)" \
-o sower ./cmd/sower
.PHONY: sowerd
sowerd:
${GO} build -ldflags "\
-X main.version=$(shell git describe --tags --always) \
-X main.date=$(shell date +%Y-%m-%d)" \
-o sowerd ./cmd/sowerd
clean:
rm -f sower sowerd sower.exe sowerd.exe