aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Kienlen <kommander@laposte.net>2022-01-14 20:27:40 +0100
committerLeo <thinkabit.ukim@gmail.com>2022-01-15 00:06:41 +0000
commitc4736f1fadd48b09870918f3d1077e65d81890cc (patch)
treec08e37312d58a394734061cedebf63cc562accdf
parent9669b7004990c4a44d09100a257070012ac2051a (diff)
downloadaports-c4736f1fadd48b09870918f3d1077e65d81890cc.tar.gz
aports-c4736f1fadd48b09870918f3d1077e65d81890cc.tar.bz2
aports-c4736f1fadd48b09870918f3d1077e65d81890cc.tar.xz
testing/udpt: new aport
-rw-r--r--testing/udpt/APKBUILD41
-rw-r--r--testing/udpt/cargo.toml.patch16
-rw-r--r--testing/udpt/udpt.conf13
-rw-r--r--testing/udpt/udpt.initd20
-rwxr-xr-xtesting/udpt/udpt.pre-install5
5 files changed, 95 insertions, 0 deletions
diff --git a/testing/udpt/APKBUILD b/testing/udpt/APKBUILD
new file mode 100644
index 0000000000..217c60a296
--- /dev/null
+++ b/testing/udpt/APKBUILD
@@ -0,0 +1,41 @@
+# Contributor: Thomas Kienlen <kommander@laposte.net>
+# Maintainer: Thomas Kienlen <kommander@laposte.net>
+pkgname=udpt
+pkgver=3.1.1
+pkgrel=0
+pkgdesc="Lightweight UDP torrent tracker"
+url="https://github.com/naim94a/udpt"
+arch="x86_64 armv7 armhf aarch64 x86 ppc64le" # limited by rust/cargo
+license="MIT"
+makedepends="cargo"
+pkgusers="udpt"
+pkggroups="udpt"
+install="udpt.pre-install"
+subpackages="$pkgname-openrc"
+source="https://github.com/naim94a/udpt/archive/udpt-$pkgver/udpt-$pkgver.tar.gz
+ udpt.initd
+ udpt.conf
+ cargo.toml.patch
+ "
+builddir="$srcdir/udpt-udpt-$pkgver"
+
+build() {
+ cargo build --release --locked
+}
+
+check() {
+ cargo test --locked --target-dir=target
+}
+
+package() {
+ install -D -m 755 target/release/udpt-rs "$pkgdir/usr/bin/udpt"
+ install -D -m 755 "$srcdir/udpt.initd" "$pkgdir/etc/init.d/udpt"
+ install -D -m 660 -o udpt -g udpt "$srcdir/udpt.conf" "$pkgdir/etc/udpt.conf"
+}
+
+sha512sums="
+05a707ec22d0d27ef7ed47eb2144b27c448ae48cc78d7fa9492a81911a7a8759768b079ab71df2a1ae63897241b70712dc0728fe6877481680d53e87536b1ff5 udpt-3.1.1.tar.gz
+e233e4d76a0ad458579810ebb9d5697604bfebb0f51f218bcd27ceff55d2a86c50bc28b278da6793f6e688492eb962043f1e876852b3d8dcec046bff56abe78b udpt.initd
+9646e424a2fe4355745241ce84f989453bf75b26bad772d2ba7e72eade6b51d5f8d4b6e3eb671edff3c892a47dda029a3aed93276a3a4f992db13cce57e1521d udpt.conf
+a154f539a10419fb7f3ff3c47938d15960ef74f41c537c8dbc8435a460b506506c431b1331d4e6b62dd6aaf0b7cf6d7f98fd17b9d49779043a308b6b4152497c cargo.toml.patch
+"
diff --git a/testing/udpt/cargo.toml.patch b/testing/udpt/cargo.toml.patch
new file mode 100644
index 0000000000..ae2f8d33f2
--- /dev/null
+++ b/testing/udpt/cargo.toml.patch
@@ -0,0 +1,16 @@
+Optimize binary size (2.3 MB -> 1.5 MB)
+
+--- a/Cargo.toml
++++ b/Cargo.toml
+@@ -6,7 +6,10 @@ description = "High performance torrent
+ edition = "2018"
+
+ [profile.release]
+-lto = "fat"
++codegen-units = 1
++lto = true
++opt-level = "z"
++panic = "abort"
+
+ [dependencies]
+ serde = {version = "1.0", features = ["derive"]}
diff --git a/testing/udpt/udpt.conf b/testing/udpt/udpt.conf
new file mode 100644
index 0000000000..515a45feeb
--- /dev/null
+++ b/testing/udpt/udpt.conf
@@ -0,0 +1,13 @@
+mode = "dynamic"
+db_path = "/var/lib/udpt/database.json.bz2"
+log_level = "info"
+
+[udp]
+announce_interval = 120 # Two minutes
+bind_address = "0.0.0.0:1212"
+
+# [http]
+# bind_address = "127.0.0.1:1212"
+#
+# [http.access_tokens]
+# someone = "MyAccessToken"
diff --git a/testing/udpt/udpt.initd b/testing/udpt/udpt.initd
new file mode 100644
index 0000000000..f45c3617c2
--- /dev/null
+++ b/testing/udpt/udpt.initd
@@ -0,0 +1,20 @@
+#!/sbin/openrc-run
+
+description="UDP bittorrent Tracker"
+supervisor=supervise-daemon
+command=/usr/bin/udpt
+command_args="-c /etc/udpt.conf"
+command_user="udpt:udpt"
+output_log=/var/log/$RC_SVCNAME.log
+stopsig="SIGINT"
+
+depend() {
+ need net
+}
+
+start_pre() {
+ checkpath --directory --owner $command_user --mode 0775 \
+ /var/lib/$RC_SVCNAME
+ checkpath --file --owner $command_user --mode 0644 \
+ /var/log/$RC_SVCNAME.log
+}
diff --git a/testing/udpt/udpt.pre-install b/testing/udpt/udpt.pre-install
new file mode 100755
index 0000000000..5d608bf8b1
--- /dev/null
+++ b/testing/udpt/udpt.pre-install
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+addgroup -S udpt 2>/dev/null
+adduser -S -D -H -h /dev/null -s /sbin/nologin -g udpt udpt 2>/dev/null
+exit 0