aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2018-12-01 16:08:29 +0000
committerJakub Jirutka <jakub@jirutka.cz>2018-12-01 17:09:27 +0100
commit179325d5d671a061959f905fc47a5c9a26b32ca9 (patch)
treefeb6402d3629288c5b6b8ba0f441d63ea2bd5757
parent19387b642b974aa981bb9ea7eadbe6394e929687 (diff)
downloadaports-179325d5d671a061959f905fc47a5c9a26b32ca9.tar.gz
aports-179325d5d671a061959f905fc47a5c9a26b32ca9.tar.bz2
aports-179325d5d671a061959f905fc47a5c9a26b32ca9.tar.xz
main/aria2: add subpackage -daemon for running aria2 as a daemon
-rw-r--r--main/aria2/APKBUILD37
-rw-r--r--main/aria2/aria2-daemon.pre-install7
-rw-r--r--main/aria2/aria2.conf61
-rw-r--r--main/aria2/aria2.confd10
-rw-r--r--main/aria2/aria2.initd32
-rw-r--r--main/aria2/aria2.logrotate6
6 files changed, 149 insertions, 4 deletions
diff --git a/main/aria2/APKBUILD b/main/aria2/APKBUILD
index e8d4eb01ab..378124fb51 100644
--- a/main/aria2/APKBUILD
+++ b/main/aria2/APKBUILD
@@ -1,9 +1,10 @@
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Jeff Bilyk <jbilyk@gmail.com>
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=aria2
pkgver=1.34.0
-pkgrel=0
+pkgrel=1
pkgdesc="Download utility for HTTP(S), (S)FTP, Bittorrent, and Metalink"
url="https://aria2.github.io/"
arch="all"
@@ -11,8 +12,16 @@ license="GPL-2.0-or-later"
depends="ca-certificates"
makedepends="gnutls-dev expat-dev sqlite-dev c-ares-dev"
checkdepends="cppunit-dev"
-subpackages="$pkgname-doc $pkgname-bash-completion:bashcomp:noarch"
-source="https://github.com/aria2/$pkgname/releases/download/release-$pkgver/$pkgname-$pkgver.tar.xz"
+pkgusers="aria2"
+pkggroups="aria2"
+install="$pkgname-daemon.pre-install"
+subpackages="$pkgname-doc $pkgname-daemon::noarch $pkgname-bash-completion:bashcomp:noarch"
+source="https://github.com/aria2/$pkgname/releases/download/release-$pkgver/$pkgname-$pkgver.tar.xz
+ $pkgname.conf
+ $pkgname.initd
+ $pkgname.confd
+ $pkgname.logrotate
+ "
builddir="$srcdir/$pkgname-$pkgver"
build() {
@@ -48,4 +57,24 @@ bashcomp() {
"$subpkgdir"/usr/share/bash-completion/completions/_aria2c
}
-sha512sums="80bc43e242c06acc95030021cb347b4ec230729f3d7e512ca1932941b34ef95c312a34007a226869e5d720839a400e66cdb072ccab5d42228d8cf3d828723dcc aria2-1.34.0.tar.xz"
+daemon() {
+ pkgdesc="Support for running Aria2 as a daemon using OpenRC"
+ depends="$pkgname=$pkgver-r$pkgrel openrc"
+
+ mkdir -p "$subpkgdir"
+ cd "$subpkgdir"
+
+ install -m 755 -D "$srcdir"/$pkgname.initd etc/init.d/$pkgname
+ install -m 644 -D "$srcdir"/$pkgname.confd etc/conf.d/$pkgname
+ install -m 644 -D "$srcdir"/$pkgname.logrotate etc/logrotate.d/$pkgname
+ install -m 644 -D "$srcdir"/$pkgname.conf etc/$pkgname.conf
+
+ install -m 750 -o aria2 -g aria2 -d var/lib/$pkgname
+ install -m 700 -o aria2 -g aria2 -d var/cache/$pkgname
+}
+
+sha512sums="80bc43e242c06acc95030021cb347b4ec230729f3d7e512ca1932941b34ef95c312a34007a226869e5d720839a400e66cdb072ccab5d42228d8cf3d828723dcc aria2-1.34.0.tar.xz
+dd716f27eae2628bd528fd2842de7881e8f8f00d587b179e832f1639241db5bd8f4e74a5b791ca4de984923654b38a28813a89ad49a864f64534903a46878a60 aria2.conf
+a191655122d8d4379dd7aef773c6273387d8417b88f4f8f96d4a2121e71d9d005c84f15382b46b90501ecb3675f2505b22fb9494a0e5c4d96792bf8b29c2c01a aria2.initd
+ee49208c36be85fdf820eda0b47549732f720624a6f94702c16e1711823d74a23728944f60c85c11d09db6dbde3515adb32bb5ddf44786645b9a36883a5b6404 aria2.confd
+2ed9ff7a5fd1801643e4fb3cdd8cb21f0ead60420c87636bb581fe00828a98a5290a0888e49f6a6becb9f39c3c145b1399aa3a9ae452eb10ac2064c0e7bca1f8 aria2.logrotate"
diff --git a/main/aria2/aria2-daemon.pre-install b/main/aria2/aria2-daemon.pre-install
new file mode 100644
index 0000000000..c2cb5d2664
--- /dev/null
+++ b/main/aria2/aria2-daemon.pre-install
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+addgroup -S aria2 2>/dev/null
+adduser -S -D -H -h /var/lib/aria2 -s /sbin/nologin -G aria2 \
+ -g 'added by apk for aria2-daemon' aria2 2>/dev/null
+
+exit 0
diff --git a/main/aria2/aria2.conf b/main/aria2/aria2.conf
new file mode 100644
index 0000000000..abca1ea739
--- /dev/null
+++ b/main/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/main/aria2/aria2.confd b/main/aria2/aria2.confd
new file mode 100644
index 0000000000..d0381c75e7
--- /dev/null
+++ b/main/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.conf"
+
+# Path of the log file.
+#logfile="/var/log/aria2.log"
diff --git a/main/aria2/aria2.initd b/main/aria2/aria2.initd
new file mode 100644
index 0000000000..c8e2edcc2f
--- /dev/null
+++ b/main/aria2/aria2.initd
@@ -0,0 +1,32 @@
+#!/sbin/openrc-run
+
+: ${cfgfile:="/etc/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}"
+}
diff --git a/main/aria2/aria2.logrotate b/main/aria2/aria2.logrotate
new file mode 100644
index 0000000000..e73ffc0444
--- /dev/null
+++ b/main/aria2/aria2.logrotate
@@ -0,0 +1,6 @@
+/var/log/aria2.log {
+ compress
+ copytruncate
+ missingok
+ notifempty
+}