summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlice <alicela1n@protonmail.com>2024-12-28 23:04:06 +0000
committerZach van Rijn <me@zv.io>2024-12-28 23:04:06 +0000
commit5ca43caf0b82591d19f7acc433ec82d47a91141f (patch)
treea31ccb4a6e08fe2d679fe8dc09e7e114a9ae67cd
parent4b88e8d175c9dc6eb88b27facb802f1ae4063430 (diff)
downloadpackages-5ca43caf0b82591d19f7acc433ec82d47a91141f.tar.gz
packages-5ca43caf0b82591d19f7acc433ec82d47a91141f.tar.bz2
packages-5ca43caf0b82591d19f7acc433ec82d47a91141f.tar.xz
packages-5ca43caf0b82591d19f7acc433ec82d47a91141f.zip
user/aria2: new package
-rw-r--r--user/aria2/APKBUILD71
-rw-r--r--user/aria2/aria2.conf61
-rw-r--r--user/aria2/aria2.confd10
-rw-r--r--user/aria2/aria2.initd42
-rw-r--r--user/aria2/aria2.logrotate6
-rw-r--r--user/aria2/aria2.pre-install7
6 files changed, 197 insertions, 0 deletions
diff --git a/user/aria2/APKBUILD b/user/aria2/APKBUILD
new file mode 100644
index 000000000..287cdcf28
--- /dev/null
+++ b/user/aria2/APKBUILD
@@ -0,0 +1,71 @@
+# Contributor: Alice <alicela1n@protonmail.com>
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+# Maintainer: Alice <alicela1n@protonmail.com>
+pkgname=aria2
+pkgver=1.37.0
+pkgrel=0
+pkgdesc="The ultra fast download utility"
+url="https://aria2.github.io/"
+arch="all"
+license="GPL-2.0+"
+depends="ca-certificates"
+checkdepends="cppunit-dev"
+makedepends="openssl-dev sqlite-dev libuv-dev"
+install="aria2.pre-install"
+pkgusers="aria2"
+pkggroups="aria2"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-openrc::noarch"
+source="https://github.com/aria2/$pkgname/releases/download/release-$pkgver/$pkgname-$pkgver.tar.xz
+ $pkgname.conf
+ $pkgname.initd
+ $pkgname.confd
+ $pkgname.logrotate
+ "
+
+build() {
+ ./configure --build=$CBUILD \
+ --host=$CHOST \
+ --with-openssl \
+ --with-sqlite3 \
+ --with-libuv \
+ --enable-libaria2 \
+ --enable-shared \
+ --disable-static \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --localstatedir=/var \
+ --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt
+
+ make
+}
+
+check() {
+ make check
+}
+
+package() {
+ make DESTDIR="$pkgdir" install
+}
+
+openrc() {
+ default_openrc
+ pkgdesc="Support for running Aria2 as a daemon using OpenRC"
+ depends="$pkgname=$pkgver-r$pkgrel"
+
+ mkdir -p "$subpkgdir"
+
+ install -Dm755 "$srcdir"/$pkgname.initd "$subpkgdir"/etc/init.d/$pkgname
+ install -Dm644 "$srcdir"/$pkgname.confd "$subpkgdir"/etc/conf.d/$pkgname
+ install -Dm644 "$srcdir"/$pkgname.logrotate "$subpkgdir"/etc/logrotate.d/$pkgname
+ install -Dm644 "$srcdir"/$pkgname.conf "$subpkgdir"/etc/$pkgname/$pkgname.conf
+ install -m750 -o aria2 -g aria2 -d "$subpkgdir"var/lib/$pkgname
+ install -m700 -o aria2 -g aria2 -d "$subpkgdir"/var/cache/$pkgname
+}
+
+sha512sums="df3b8b4de8fa8d78f203ea00c059e43585e18a229009f202e42e6a9e59db67d09df0dbba8a016e99ed73c82f59e4f8b26f86c2288afdbb96a6807cbe2c56e6b3 aria2-1.37.0.tar.xz
+dd716f27eae2628bd528fd2842de7881e8f8f00d587b179e832f1639241db5bd8f4e74a5b791ca4de984923654b38a28813a89ad49a864f64534903a46878a60 aria2.conf
+c65bef73a519b567ab35558bd60310081f5d4fcb630538666a5b2435f23dc9d741c7bfa6080e4ff46e646e977f4d5e8ba937ce9cdfb55880a3dc0eb1c2ee617a aria2.initd
+42d6df2590f6f70fcf42bb4a54cf332737838ffc8f0992df1f3bdc54be8e53aafc2176b10896a1f980f3c09a80131c5f37cff5cc0d59f5c2646cb46250bae05d aria2.confd
+2ed9ff7a5fd1801643e4fb3cdd8cb21f0ead60420c87636bb581fe00828a98a5290a0888e49f6a6becb9f39c3c145b1399aa3a9ae452eb10ac2064c0e7bca1f8 aria2.logrotate"
diff --git a/user/aria2/aria2.conf b/user/aria2/aria2.conf
new file mode 100644
index 000000000..abca1ea73
--- /dev/null
+++ b/user/aria2/aria2.conf
@@ -0,0 +1,61 @@
+# Run aria2c --help=#all to see all the available options.
+
+# The directory to store the downloaded file.
+dir=/var/lib/aria2
+
+# Save error/unfinished downloads to this file on exit.
+save-session=/var/lib/aria2/aria2.session
+input-file=/var/lib/aria2/aria2.session
+
+# Save error/unfinished downloads to a file specified by save-session option
+# every SEC seconds. If 0 is given, file will be saved only when aria2 exits.
+save-session-interval=60
+
+# Save download even if the download is completed or removed.
+force-save=true
+
+# Continue downloading a partially downloaded files. Only for HTTP/FTP.
+continue=true
+
+# Always resume download.
+always-resume=true
+
+# Set log level to output to file.
+# Possible Values: debug, info, notice, warn, error.
+log-level=notice
+
+# Set interval to output download progress summary.
+# Setting 0 suppresses the output.
+summary-interval=0
+
+# File allocation method. "falloc" is the best choice for newer file systems
+# such as ext4, Btrfs or XFS.
+file-allocation=falloc
+
+
+## RPC
+
+# Specify a port number for JSON-RPC/XML-RPC server to listen to.
+#rpc-listen-port=6800
+
+# Listen incoming JSON-RPC/XML-RPC requests on all network interfaces.
+#rpc-listen-all=false
+
+# RPC secret authorization token. Change to some random string!
+rpc-secret=top-secret
+
+
+## BitTorrent
+
+# Specify the external IP address to use in BitTorrent download and DHT.
+#bt-external-ip=
+
+# TCP port number(s) for BitTorrent downloads.
+#listen-port=6881-6999
+
+# Requires BitTorrent message payload encryption with arc4.
+#bt-force-encryption=false
+
+# Maximum number of files to open in multi-file BitTorrent/Metalink
+# downloads globally.
+#bt-max-open-files=100
diff --git a/user/aria2/aria2.confd b/user/aria2/aria2.confd
new file mode 100644
index 000000000..8b20cb34d
--- /dev/null
+++ b/user/aria2/aria2.confd
@@ -0,0 +1,10 @@
+# Configuration for /etc/init.d/aria2
+
+# The user (and group) to run Aria2 daemon.
+#command_user="aria2"
+
+# Path of the configuration file.
+#cfgfile="/etc/aria2/aria2.conf"
+
+# Path of the log file.
+#logfile="/var/log/aria2.log"
diff --git a/user/aria2/aria2.initd b/user/aria2/aria2.initd
new file mode 100644
index 000000000..a23b6eb0d
--- /dev/null
+++ b/user/aria2/aria2.initd
@@ -0,0 +1,42 @@
+#!/sbin/openrc-run
+
+: ${cfgfile:="/etc/aria2/aria2.conf"}
+: ${logfile:="/var/log/aria2.log"}
+: ${command_user:="aria2"}
+
+command="/usr/bin/aria2c"
+command_args="
+ --enable-rpc=true
+ --quiet=true
+ --log=$logfile
+ --conf-path=$cfgfile
+ ${command_args:-}"
+command_background="yes"
+
+pidfile="/run/$RC_SVCNAME.pid"
+output_log="/dev/null"
+error_log="/dev/null"
+start_stop_daemon_args="--env XDG_CACHE_HOME=/var/cache"
+
+required_files="$cfgfile"
+
+depend() {
+ need net
+ use dns netmount
+}
+
+start_pre() {
+ local _logfile=$(sed -En 's|^log=([^#]+)|\1|p' "$cfgfile")
+
+ checkpath -f -m 640 -o "$command_user" "${_logfile:-$logfile}"
+
+ # Session
+ local _inputfile=$(sed -En 's|^input-file=([^#]+)|\1|p' "$cfgfile")
+
+ if [ "$_inputfile" != "" ]; then
+ checkpath -f -m 644 -o "$command_user" "$_inputfile"
+ fi
+
+ # DHT
+ checkpath -d -m 755 -o "$command_user" "/var/cache/$command_user"
+}
diff --git a/user/aria2/aria2.logrotate b/user/aria2/aria2.logrotate
new file mode 100644
index 000000000..e73ffc044
--- /dev/null
+++ b/user/aria2/aria2.logrotate
@@ -0,0 +1,6 @@
+/var/log/aria2.log {
+ compress
+ copytruncate
+ missingok
+ notifempty
+}
diff --git a/user/aria2/aria2.pre-install b/user/aria2/aria2.pre-install
new file mode 100644
index 000000000..d819d3388
--- /dev/null
+++ b/user/aria2/aria2.pre-install
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+groupadd -r aria2 2>/dev/null
+useradd -c aria2 -d /var/lib/aria2 -s /sbin/nologin -g aria2 \
+ -r aria2 2>/dev/null
+
+exit 0