~alpine/aports

testing/yggdrasil: new aport v1 SUPERSEDED

Drew DeVault: 1
 testing/yggdrasil: new aport

 5 files changed, 78 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.alpinelinux.org/~alpine/aports/patches/3340/mbox | git am -3
Learn more about email & git

[PATCH] testing/yggdrasil: new aport Export this patch

---
 testing/yggdrasil/APKBUILD              | 49 +++++++++++++++++++++++++
 testing/yggdrasil/modules.conf          |  1 +
 testing/yggdrasil/yggdrasil.confd       |  4 ++
 testing/yggdrasil/yggdrasil.initd       | 20 ++++++++++
 testing/yggdrasil/yggdrasil.pre-install |  4 ++
 5 files changed, 78 insertions(+)
 create mode 100644 testing/yggdrasil/APKBUILD
 create mode 100644 testing/yggdrasil/modules.conf
 create mode 100644 testing/yggdrasil/yggdrasil.confd
 create mode 100644 testing/yggdrasil/yggdrasil.initd
 create mode 100644 testing/yggdrasil/yggdrasil.pre-install

diff --git a/testing/yggdrasil/APKBUILD b/testing/yggdrasil/APKBUILD
new file mode 100644
index 0000000000..9c5018838b
--- /dev/null
+++ b/testing/yggdrasil/APKBUILD
@@ -0,0 +1,49 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=yggdrasil
pkgver=0.3.14
pkgrel=0
pkgdesc="An experiment in scalable routing as an encrypted IPv6 overlay network"
url="https://yggdrasil-network.github.io/"
arch="all"
license="LGPL-3.0-only"
makedepends="go"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/yggdrasil-network/yggdrasil-go/archive/v$pkgver.tar.gz
	$pkgname.confd
	$pkgname.initd
	modules.conf
"
install="$pkgname.pre-install"
builddir="$srcdir/$pkgname-go-$pkgver"
options="!check" # upstream test suite is broken/unusual
subpackages="$pkgname-openrc"

build() {
	go mod vendor
	pkgsrc=github.com/yggdrasil-network/yggdrasil-go/src/version
	LDFLAGS="$LDFLAGS -X $pkgsrc.buildName=$pkgname -X $PKGSRC.buildVersion=$pkgver"
	for cmd in yggdrasil yggdrasilctl
	do
		go build \
			-trimpath \
			-mod=vendor \
			-ldflags "-extldflags $LDFLAGS" \
			./cmd/$cmd
	done
}

package() {
	install -Dm755 yggdrasil "$pkgdir"/usr/bin/yggdrasil
	install -Dm755 yggdrasilctl "$pkgdir"/usr/bin/yggdrasilctl
	install -Dm644 "$srcdir"/yggdrasil.confd \
		"$pkgdir"/etc/conf.d/yggdrasil
	install -Dm755 "$srcdir"/yggdrasil.initd \
		"$pkgdir"/etc/init.d/yggdrasil
	install -Dm644 "$srcdir"/modules.conf \
		"$pkgdir"/etc/modules-load.d/yggdrasil.conf
}

sha512sums="3c3e92c7d49a08d2390a5d7226387c83b5575d55ae90b1209a103b50659ae60d978e39ee9247f548efe90228c3ce544b17bb205f9dcbc7f67262beaf9b7c38bf  yggdrasil-0.3.14.tar.gz
089221d9dd703b21714ac5ec04f23218083d216ff259fdd76942c9b2089ee4ca908b360dca0c1f4fa2e0bb1de7d57f0c638d8db9bc782cbe0ed1733f6888171a  yggdrasil.confd
ea7aa9f3986a95a215953f6e4ffe14ea469c80e2749dc604eb1edde4a890afe6e6e15f7e3b59d7641ed184bcb40de0a309b5c5d2cc1944831a7794fe0e8efe97  yggdrasil.initd
871b650ff982be061532b4c5fe4812f41e6e2c58fc69b24f8a745f9a43389da44e742a69b0467b3c3d9e2b031af0728e20f10fa4584695c4f5ac87768a1fd34e  modules.conf"
diff --git a/testing/yggdrasil/modules.conf b/testing/yggdrasil/modules.conf
new file mode 100644
index 0000000000..0cb2f0a64b
--- /dev/null
+++ b/testing/yggdrasil/modules.conf
@@ -0,0 +1 @@
tun
diff --git a/testing/yggdrasil/yggdrasil.confd b/testing/yggdrasil/yggdrasil.confd
new file mode 100644
index 0000000000..a162ffba4e
--- /dev/null
+++ b/testing/yggdrasil/yggdrasil.confd
@@ -0,0 +1,4 @@
yggdrasil_config_file=/etc/yggdrasil.conf

output_log=/var/log/yggdrasil.log
error_log=/var/log/yggdrasil.log
diff --git a/testing/yggdrasil/yggdrasil.initd b/testing/yggdrasil/yggdrasil.initd
new file mode 100644
index 0000000000..e2530b5a72
--- /dev/null
+++ b/testing/yggdrasil/yggdrasil.initd
@@ -0,0 +1,20 @@
#!/sbin/openrc-run
name="yggdrasil"
description="An experiment in scalable routing as an encrypted IPv6 overlay network"
supervisor=supervise-daemon
command=/usr/bin/yggdrasil
command_args="-useconffile $yggdrasil_config_file"
command_user="yggdrasil:yggdrasil"

depend() {
	need net
	after firewall
	before radvd
}

start_pre() {
	[ -n "$output_log" ] && checkpath -f "$output_log" \
		-m 644 -o yggdrasil:yggdrasil || true
	[ -n "$error_log" ] && checkpath -f "$error_log" \
		-m 644 -o yggdrasil:yggdrasil || true
}
diff --git a/testing/yggdrasil/yggdrasil.pre-install b/testing/yggdrasil/yggdrasil.pre-install
new file mode 100644
index 0000000000..ac941af662
--- /dev/null
+++ b/testing/yggdrasil/yggdrasil.pre-install
@@ -0,0 +1,4 @@
#!/bin/sh
grep '^yggdrasil:' /etc/group >/dev/null || addgroup -S yggdrasil 2>/dev/null
grep '^yggdrasil:' /etc/passwd >/dev/null || adduser -SDH \
	-s/sbin/nologin -Gyggdrasil -gyggdrasil yggdrasil yggdrasil 2>/dev/null
-- 
2.27.0