From c4736f1fadd48b09870918f3d1077e65d81890cc Mon Sep 17 00:00:00 2001 From: Thomas Kienlen <kommander@laposte.net> Date: Fri, 14 Jan 2022 20:27:40 +0100 Subject: [PATCH] testing/udpt: new aport --- testing/udpt/APKBUILD | 41 +++++++++++++++++++++++++++++++++++ testing/udpt/cargo.toml.patch | 16 ++++++++++++++ testing/udpt/udpt.conf | 13 +++++++++++ testing/udpt/udpt.initd | 20 +++++++++++++++++ testing/udpt/udpt.pre-install | 5 +++++ 5 files changed, 95 insertions(+) create mode 100644 testing/udpt/APKBUILD create mode 100644 testing/udpt/cargo.toml.patch create mode 100644 testing/udpt/udpt.conf create mode 100644 testing/udpt/udpt.initd create mode 100755 testing/udpt/udpt.pre-install diff --git a/testing/udpt/APKBUILD b/testing/udpt/APKBUILD new file mode 100644 index 000000000000..217c60a296a9 --- /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 000000000000..ae2f8d33f215 --- /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 000000000000..515a45feeb23 --- /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 000000000000..f45c3617c2cd --- /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 000000000000..5d608bf8b1ac --- /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 -- GitLab