aports/community/headscale/APKBUILD
2025-05-11 17:42:12 +02:00

70 lines
2.5 KiB
Text

# Contributor: Patrycja Rosa <alpine@ptrcnull.me>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=headscale
pkgver=0.25.1
pkgrel=3
pkgdesc="Open source, self-hosted implementation of the Tailscale control server"
url="https://github.com/juanfont/headscale"
# ppc64le, riscv64: go build fails
# armhf, armv7: tests fail on sqlite read ("database disk image is malformed")
arch="all !ppc64le !riscv64 !armhf !armv7"
license="BSD-3-Clause"
pkgusers="headscale"
pkggroups="headscale"
makedepends="go"
checkdepends="postgresql"
subpackages="
$pkgname-bash-completion
$pkgname-fish-completion
$pkgname-openrc
$pkgname-zsh-completion
"
install="$pkgname.pre-install"
source="https://github.com/juanfont/headscale/archive/v$pkgver/headscale-$pkgver.tar.gz
headscale.initd
"
options="net" # fetch dependencies
export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"
prepare() {
default_prepare
# move socket to a subdirectory to allow running as non-root
sed -i 's|/var/run/headscale.sock|/run/headscale/headscale.sock|' config-example.yaml
}
build() {
go build -ldflags "-X github.com/juanfont/headscale/cmd/headscale/cli.Version=v$pkgver" ./cmd/headscale
mkdir completions
./headscale completion bash > completions/bash
./headscale completion fish > completions/fish
./headscale completion zsh > completions/zsh
}
check() {
# headscale runs integration tests if /.dockerenv exists, but those
# tests fail in gitlab CI because they rely on a certain environment
# (see test_integration target in headscale's Makefile). so, use -short
# to disable integration tests when packaging.
go test -short ./...
}
package() {
install -Dm755 headscale "$pkgdir"/usr/bin/headscale
install -Dm755 "$srcdir"/headscale.initd "$pkgdir"/etc/init.d/headscale
install -Dm644 config-example.yaml "$pkgdir"/etc/headscale/config.yaml
# completions
install -Dm644 completions/bash "$pkgdir"/usr/share/bash-completion/completions/headscale
install -Dm644 completions/fish "$pkgdir"/usr/share/fish/vendor_completions.d/headscale.fish
install -Dm644 completions/zsh "$pkgdir"/usr/share/zsh/site-functions/_headscale
}
sha512sums="
79240533d9735ebeeb42f47668426956529784c77223c6fe4380280c9538cfc53b27cd205a989bf91a4b2bfc2f680b3fdb77f0c9f547de0900cc6cb5568c85bd headscale-0.25.1.tar.gz
0800829bfc087af283afc117406324a0129b30b587c8cc5df85e147ac09fc879d726fc2d0b62ed545fb0190ed887641f07256745da9dea56932dd2d90aa41625 headscale.initd
"