testing/headscale: new aport

An open source, self-hosted implementation of the Tailscale control server
https://github.com/juanfont/headscale
This commit is contained in:
ptrcnull 2022-03-08 21:02:43 +01:00 committed by alice
parent d58dcfb059
commit c625cfabcf
3 changed files with 75 additions and 0 deletions

View File

@ -0,0 +1,44 @@
# Contributor: Patrycja Rosa <alpine@ptrcnull.me>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=headscale
pkgver=0.14.0
pkgrel=0
pkgdesc="An open source, self-hosted implementation of the Tailscale control server"
url="https://github.com/juanfont/headscale"
arch="all !ppc64le" # go build fails
license="BSD-3-Clause"
pkgusers="headscale"
pkggroups="headscale"
makedepends="go"
subpackages="$pkgname-openrc"
install="$pkgname.pre-install"
source="https://github.com/juanfont/headscale/archive/v$pkgver/headscale-$pkgver.tar.gz
headscale.initd
"
prepare() {
default_prepare
# move socket to a subdirectory to allow running as non-root
sed -i 's|/var/run/headscale.sock|/var/run/headscale/headscale.sock|' config-example.yaml
}
build() {
make build
}
check() {
make test
}
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
}
sha512sums="
d2f047adc9ce561fef7dabcb1992a910f7ebdfab16a03ffd4c785c579b00b948b0c5d0557ff2c8cd6e0aa2052d8642daeaa2ccb4b1a775572e67c015c7a0cd8f headscale-0.14.0.tar.gz
0800829bfc087af283afc117406324a0129b30b587c8cc5df85e147ac09fc879d726fc2d0b62ed545fb0190ed887641f07256745da9dea56932dd2d90aa41625 headscale.initd
"

View File

@ -0,0 +1,25 @@
#!/sbin/openrc-run
supervisor=supervise-daemon
command="/usr/bin/headscale"
command_args="serve"
command_user="headscale:headscale"
directory="/var/lib/headscale"
output_log="/var/log/headscale.log"
error_log="/var/log/headscale.log"
depend() {
need net
after firewall
}
start_pre() {
checkpath -d -m 755 -o "headscale:headscale" /var/run/headscale
checkpath -d -m 755 -o "headscale:headscale" /var/lib/headscale
checkpath -f -m 644 -o "headscale:headscale" /var/lib/headscale/db.sqlite
checkpath -f -m 644 -o "headscale:headscale" /etc/headscale/config.yaml
checkpath -f -m 644 -o "headscale:headscale" /var/log/headscale.log
}

View File

@ -0,0 +1,6 @@
#!/bin/sh
addgroup -S headscale 2>/dev/null
adduser -S -D -H -h /var/lib/headscale -s /sbin/nologin -G headscale -g headscale headscale 2>/dev/null
exit 0