Received: from mx1.volatile.bz (mx1.volatile.bz [185.163.46.101]) by nld3-dev1.alpinelinux.org (Postfix) with ESMTPS id 9FD607818A8 for <~alpine/aports@lists.alpinelinux.org>; Sun, 14 Jun 2020 15:53:13 +0000 (UTC) Received: from mahin.wowana.me (unknown [IPv6:2001:67c:2db8:301:1845::2]) by mx1.volatile.bz (Postfix) with ESMTPSA id 40F3D23A; Sun, 14 Jun 2020 15:44:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wowana.me; s=default; t=1592149455; bh=kQD3D2IEzudIncGdmBrReqXXPdNwyuoOLA8flpk6egY=; h=From:To:Cc:Subject:Date; b=fyZKtTqAkxsovRDtOk5IlgIzbMC4Kz2Fib5VmKw2IIOAdEh1V0rP2Oh84O29+jbiU UGNLP472ehk/l2PtylLiMLrzYHrNodM1c8CNlqq0qCDRNVMbdxY7+lU9m0p8NofuQW tIakw/yps+zzx8CGJ6c0/i+xhhvE2NzMSAGcO45E= From: opal hart To: ~alpine/aports@lists.alpinelinux.org Cc: hello@neilalexander.dev, opal hart Subject: [PATCH] testing/yggdrasil-go: new aport Date: Sun, 14 Jun 2020 15:43:40 +0000 Message-Id: <20200614154340.31270-1-opal@wowana.me> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit cc neilalexander to see if we can do `go test` already or if we should keep options=!check in APKBUILD otherwise, the package works, currently using on two systems --- testing/yggdrasil/APKBUILD | 51 +++++++++++++++++++++++++++++++ testing/yggdrasil/yggdrasil.initd | 23 ++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 testing/yggdrasil/APKBUILD create mode 100644 testing/yggdrasil/yggdrasil.initd diff --git a/testing/yggdrasil/APKBUILD b/testing/yggdrasil/APKBUILD new file mode 100644 index 0000000000..9413364823 --- /dev/null +++ b/testing/yggdrasil/APKBUILD @@ -0,0 +1,51 @@ +# Contributor: opal hart +# Maintainer: opal hart +pkgname=yggdrasil-go +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="x86_64" +license="LGPL-3 MIT Apache-2.0 BSD ZLIB" +makedepends="go" +source=" + https://github.com/yggdrasil-network/yggdrasil-go/archive/v$pkgver/yggdrasil-go-$pkgver.tar.gz + yggdrasil.initd +" +builddir="$srcdir/src/github.com/yggdrasil-network/yggdrasil-go" +options="!check" + +export GOPATH="$srcdir" + +prepare() { + default_prepare + cd "$srcdir" + mkdir -p "$(dirname "$builddir")" + ln -s "$srcdir/$pkgname-$pkgver" "$builddir" +} + +build() { + pkgsrc="github.com/yggdrasil-network/yggdrasil-go/src/version" + LDFLAGS="-X ${pkgsrc}.buildName=${pkgname} -X ${pkgsrc}.buildVersion=${pkgver}" + for cmd in yggdrasil yggdrasilctl; do + go build -ldflags="$LDFLAGS" "./cmd/$cmd" + done +} + +package() { + install -Dm755 yggdrasil \ + "$pkgdir"/usr/sbin/yggdrasil + install -Dm755 yggdrasilctl \ + "$pkgdir"/usr/sbin/yggdrasilctl + install -Dm644 README.md \ + "$pkgdir"/usr/share/doc/$pkgname/README.md + install -m755 -D "$srcdir"/yggdrasil.initd "$pkgdir"/etc/init.d/yggdrasil +} + +cleanup_srcdir() { + go clean -modcache + default_cleanup_srcdir +} + +sha512sums="3c3e92c7d49a08d2390a5d7226387c83b5575d55ae90b1209a103b50659ae60d978e39ee9247f548efe90228c3ce544b17bb205f9dcbc7f67262beaf9b7c38bf yggdrasil-go-0.3.14.tar.gz +f80848803109c67d27f2e381fd6dac2218bf6df338addcc648e9e2178adb5075700356a5f253c0b80db6354b6ab54f3d884ca13837b6238d00adea674ca92748 yggdrasil.initd" diff --git a/testing/yggdrasil/yggdrasil.initd b/testing/yggdrasil/yggdrasil.initd new file mode 100644 index 0000000000..b0ab6aad91 --- /dev/null +++ b/testing/yggdrasil/yggdrasil.initd @@ -0,0 +1,23 @@ +#!/sbin/openrc-run + +: "${YGGDRASIL_CONF=/etc/yggdrasil.conf}" + +description="End-to-end encrypted IPv6 networking" + +command="/usr/sbin/yggdrasil" +command_args="--useconffile ${YGGDRASIL_CONF}" +start_stop_daemon_args="--make-pidfile --pidfile /run/yggdrasil.pid --background -1 /var/log/yggdrasil.log" + +depend() { + need net + after firewall + use dns +} + +start_pre() { + if [ ! -f "${YGGDRASIL_CONF}" ]; then + eerror "Cannot find '${YGGDRASIL_CONF}'." + eerror "Generate a sample config with `yggdrasil -genconf > /etc/yggdrasil.conf` and edit." + return 2 + fi +} -- 2.26.2