summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.AURINFO18
-rw-r--r--.SRCINFO21
-rw-r--r--PKGBUILD40
-rw-r--r--aria2c-daemon.install26
-rw-r--r--aria2c-env.conf10
-rw-r--r--aria2c.conf131
-rw-r--r--aria2cd.service18
7 files changed, 264 insertions, 0 deletions
diff --git a/.AURINFO b/.AURINFO
new file mode 100644
index 000000000000..cf0647cc713c
--- /dev/null
+++ b/.AURINFO
@@ -0,0 +1,18 @@
+pkgbase = aria2c-daemon
+ pkgdesc = Daemonize aria2c
+ pkgver = 0.1
+ pkgrel = 1
+ url = https://github.com/yhfudev/aria2c-daemon-arch.git
+ install = aria2c-daemon.install
+ arch = any
+ license = GPL3
+ makedepends = git
+ depends = aria2
+ conflicts = aria2-daemon-svn
+ replaces = aria2-daemon-svn
+ source = aria2c-env.conf
+ source = aria2c.conf
+ source = aria2cd.service
+
+pkgname = aria2c-daemon
+
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..fb118c1b6432
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,21 @@
+pkgbase = aria2c-daemon
+ pkgdesc = Daemonize aria2c
+ pkgver = 0.1
+ pkgrel = 1
+ url = https://github.com/yhfudev/aria2c-daemon-arch.git
+ install = aria2c-daemon.install
+ arch = any
+ license = GPL3
+ makedepends = git
+ depends = aria2
+ conflicts = aria2-daemon-svn
+ replaces = aria2-daemon-svn
+ source = aria2c-env.conf
+ source = aria2c.conf
+ source = aria2cd.service
+ md5sums = ed34ec0a71bf7c9e4174a6ffffa6decc
+ md5sums = d111fc93fb44b9da061179c5642f539c
+ md5sums = 31e046f846131a3a88ee2cf732723d4e
+
+pkgname = aria2c-daemon
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..55cb5bb73bae
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,40 @@
+# Maintainer: Yunhui Fu <yhfudev@gmail.com>
+
+pkgname=aria2c-daemon
+pkgver=0.1
+pkgrel=1
+pkgdesc='Daemonize aria2c'
+license=('GPL3')
+arch=(any)
+depends=('aria2')
+conflicts=('aria2-daemon-svn')
+replaces=('aria2-daemon-svn')
+makedepends=('git')
+url='https://github.com/yhfudev/aria2c-daemon-arch.git'
+install=$pkgname.install
+source=( aria2c-env.conf aria2c.conf aria2cd.service )
+md5sums=('ed34ec0a71bf7c9e4174a6ffffa6decc'
+ 'd111fc93fb44b9da061179c5642f539c'
+ '31e046f846131a3a88ee2cf732723d4e')
+
+_giturl='https://github.com/yhfudev/aria2c-daemon-arch.git'
+_gitdir='aria2c-daemon-git'
+
+build() {
+ msg 'Cloning GIT repository...'
+ cd "${srcdir}"
+ cd ${srcdir}
+ if [ -d ${_gitdir}/.git ]; then
+ (cd ${_gitdir} && git pull origin)
+ else
+ (git clone ${_giturl} ${_gitdir})
+ fi
+ msg 'GIT repository downloaded...'
+}
+
+package() {
+ install -D -m644 "${srcdir}/${_gitdir}/aria2c-env.conf" "${pkgdir}/etc/conf.d/aria2c-env.conf"
+ install -D -m600 "${srcdir}/${_gitdir}/aria2c.conf" "${pkgdir}/etc/conf.d/aria2c.conf"
+ install -D -m755 "${srcdir}/${_gitdir}/aria2cd.service" "${pkgdir}/etc/systemd/system/aria2cd.service"
+}
+
diff --git a/aria2c-daemon.install b/aria2c-daemon.install
new file mode 100644
index 000000000000..9910864f8311
--- /dev/null
+++ b/aria2c-daemon.install
@@ -0,0 +1,26 @@
+post_install() {
+ echo -n "Adding aria2c user and group ..."
+ # --no-create-home
+ useradd aria2c -d /var/share/aria2c/ -U -s /bin/nologin && echo " done."
+ passwd -l aria2c &>/dev/null
+
+ install -d /var/share/aria2c/
+ touch /var/share/aria2c/aria2c.log
+ touch /var/share/aria2c/aria2c.session
+
+ chmod 600 /etc/conf.d/aria2c.conf
+ chown aria2c:aria2c /etc/conf.d/aria2c.conf
+ chown aria2c:aria2c /etc/conf.d/aria2c-env.conf
+ chown -R aria2c:aria2c /var/share/aria2c/
+
+ echo "Now the aria2cd is installed, you may want to ..."
+ echo " 1. check the config file for aria2cd at /etc/conf.d/aria2c.conf"
+ echo " 2. get the downloaded files at /var/share/aria2c/"
+}
+
+post_remove() {
+ echo -n -e "\nRemoving aria2c user/group..."
+ userdel aria2c && echo " done."
+ echo "Now the aria2cd was removed from your system,"
+ echo "you may need to check the directory /var/share/aria2c/ by manual."
+}
diff --git a/aria2c-env.conf b/aria2c-env.conf
new file mode 100644
index 000000000000..6fc2c077dd53
--- /dev/null
+++ b/aria2c-env.conf
@@ -0,0 +1,10 @@
+# environment parameters
+
+#ARIA2C_USER="aria2c"
+#ARIA2C_GROUP="aria2c"
+#ARIA2C_HOME="/var/share/aria2c"
+
+ARIA2C_CONF="/etc/conf.d/aria2c.conf"
+ARIA2C_SESSION="/var/share/aria2c/aria2c.session"
+
+#ARIA2C_ARGS="-D --conf-path=${ARIA2C_CONF} --save-session-interval=180 --save-session=${ARIA2C_SESSION}"
diff --git a/aria2c.conf b/aria2c.conf
new file mode 100644
index 000000000000..6e174a320698
--- /dev/null
+++ b/aria2c.conf
@@ -0,0 +1,131 @@
+# Run as daemon.
+daemon=true
+
+# Dir needs to be changed to the download location.
+dir=/var/share/aria2c/
+
+# Logging
+log=/var/share/aria2c/aria2c.log
+log-level=warn
+
+# save completed state
+force-save=true
+# Save a control file(*.aria2) every SEC seconds.
+auto-save-interval=60
+# Downloads URIs found in FILE.
+input-file=/var/share/aria2c/aria2c.session
+# Save error/unfinished downloads to FILE on exit.
+save-session=/var/share/aria2c/aria2c.session
+# Save error/unfinished downloads to a file every SEC seconds.
+save-session-interval=60
+
+# Initializing EpollEventPoll failed.
+#event-poll=select
+
+# Continue downloading a partially downloaded file.
+continue=true
+
+# RPC options, user and password should be changed.
+#Enable JSON-RPC/XML-RPC server.
+enable-rpc=true
+# Add Access-Control-Allow-Origin header field with value, for YAAW
+rpc-allow-origin-all=true
+# Listen incoming JSON-RPC/XML-RPC requests on all network interfaces.
+rpc-listen-all=true
+# Save the uploaded torrent or metalink metadata in the directory specified by --dir option
+rpc-save-upload-metadata=true
+# Specify a port number for JSON-RPC/XML-RPC server to listen to.
+#rpc-listen-port=6800
+# Set JSON-RPC/XML-RPC user.
+rpc-user=aria2c
+rpc-passwd=aria2c
+
+# Advanced
+# Restart download from scratch if the corresponding control file doesn't exist.
+allow-overwrite=true
+# Specify file allocation method. none, prealloc, trunc, falloc Default: prealloc
+file-allocation=prealloc
+
+# Set max overall download speed in bytes/sec.
+max-overall-download-limit=0
+
+# Set max overall upload speed in bytes/sec.
+max-overall-upload-limit=0
+
+# Download a file using N connections.
+split=5
+
+# The maximum number of connections to one server for each download.
+max-connection-per-server=5
+
+# Set maximum number of parallel downloads for every static (HTTP/FTP) URI,
+max-concurrent-downloads=4
+
+min-split-size=20M
+
+# Fetch URIs in the command-line sequentially and download each URI in a separate session,
+force-sequential=true
+
+# Enable parameterized URI support. for example:
+# http://{sv1,sv2,sv3}/foo.iso
+# http://host/image[000-100:2].img
+parameterized-uri=true
+
+
+# HTTP
+check-certificate=false
+
+# HTTP/FTP
+max-file-not-found=5
+max-tries=2
+remote-time=true
+
+# Set user agent for HTTP(S) downloads
+user-agent=Transmission/2.61 (13407)
+#user-agent=uTorrent/2210(25130)
+
+# BT
+
+# Enable Local Peer Discovery.
+bt-enable-lpd=true
+
+# Set TCP port number for BitTorrent downloads.
+listen-port=25000
+#listen-port=6881-6999
+
+# Specify share ratio.
+seed-ratio=1.0
+# Specify seeding time in minutes.
+seed-time=60
+
+# Specify the prefix of peer ID.
+peer-id-prefix=-TR2610-
+#peer-id-prefix=-UT2210-
+
+# Enable IPv4 DHT functionality. fro PT
+enable-dht=true
+# Set UDP listening port used by DHT(IPv4, IPv6) and UDP tracker.
+dht-listen-port=51414
+
+# Set host and port as an entry point to IPv4 DHT network.
+dht-entry-point=dht.transmissionbt.com:6881
+#dht-entry-point6=
+
+# Specify the maximum number of peers per torrent.
+bt-max-peers=80
+
+# Configuring this option with your preferred download speed can increase your download speed in some cases.
+bt-request-peer-speed-limit=200K
+
+# Enable Peer Exchange extension.
+enable-peer-exchange=true
+
+bt-hash-check-seed=true
+bt-seed-unverified=true
+bt-save-metadata=true
+
+# If true is given, aria2 doesn't accept and establish connection with legacy BitTorrent handshake(19BitTorrent protocol). Thus aria2 always uses Obfuscation handshake.
+bt-require-crypto=true
+
+# If true or mem is specified, when a file whose suffix is .torrent or content type is application/x-bittorrent is downloaded, aria2 parses it as a torrent file and downloads files mentioned in it.
+follow-torrent=true
diff --git a/aria2cd.service b/aria2cd.service
new file mode 100644
index 000000000000..82fcdd070b45
--- /dev/null
+++ b/aria2cd.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=aria2c Service
+Requires=network.target
+After=dhcpcd.service
+
+[Service]
+Type=forking
+User=aria2c
+Group=aria2c
+WorkingDirectory=/var/share/aria2c
+EnvironmentFile=/etc/conf.d/aria2c-env.conf
+ExecStart=/usr/bin/aria2c -D --conf-path=${ARIA2C_CONF} --save-session-interval=180 --save-session=${ARIA2C_SESSION}
+ExecReload=/usr/bin/kill -HUP $MAINPID
+RestartSec=1min
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target