commit
8d1bc5b229
|
@ -7,12 +7,12 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=aria2
|
PKG_NAME:=aria2
|
||||||
PKG_VERSION:=1.24.0
|
PKG_VERSION:=1.25.0
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||||
PKG_SOURCE_URL:=https://github.com/aria2/aria2/releases/download/release-$(PKG_VERSION)/
|
PKG_SOURCE_URL:=https://github.com/aria2/aria2/releases/download/release-$(PKG_VERSION)/
|
||||||
PKG_MD5SUM:=d8d75cd0ee01c3e50e57214ff552a961
|
PKG_MD5SUM:=edc7f20ba182cec30384489fd3dfe135
|
||||||
PKG_INSTALL:=1
|
PKG_INSTALL:=1
|
||||||
|
|
||||||
PKG_MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>, Hsing-Wang Liao <kuoruan@gmail.com>
|
PKG_MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>, Hsing-Wang Liao <kuoruan@gmail.com>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
# Copyright (C) 2014-2016 nanpuyue <nanpuyue@gmail.com>
|
# Copyright (C) 2014-2016 nanpuyue <nanpuyue@gmail.com>
|
||||||
|
# Copyright (C) 2016 kuoruan <kuoruan@gmail.com>
|
||||||
|
|
||||||
START=99
|
START=99
|
||||||
SERVICE_WRITE_PID=1
|
SERVICE_WRITE_PID=1
|
||||||
|
@ -41,16 +42,24 @@ start_instance() {
|
||||||
config_file="$config_dir/aria2.conf"
|
config_file="$config_dir/aria2.conf"
|
||||||
session_file="$config_dir/aria2.session"
|
session_file="$config_dir/aria2.session"
|
||||||
dht_file="$config_dir/dht.dat"
|
dht_file="$config_dir/dht.dat"
|
||||||
|
log_file="$config_dir/aria2.log"
|
||||||
|
|
||||||
[ -d "$config_dir" ] || {
|
[ -d "$config_dir" ] || {
|
||||||
mkdir -m 0755 -p "$config_dir"
|
mkdir -m 0755 -p "$config_dir"
|
||||||
touch "$config_file"
|
touch "$config_file"
|
||||||
[ -z "$user" ] || chown -R $user $config_dir
|
[ -z "$user" ] || chown -R $user $config_dir
|
||||||
}
|
}
|
||||||
|
|
||||||
touch "$session_file"
|
touch "$session_file"
|
||||||
|
|
||||||
echo -e "enable-rpc=true\nrpc-allow-origin-all=true\nrpc-listen-all=true\nquiet=true" > $config_file
|
echo -e "enable-rpc=true\nrpc-allow-origin-all=true\nrpc-listen-all=true\nquiet=true" > $config_file
|
||||||
echo -e "continue=true\ninput-file=$session_file\nsave-session=$session_file" >> $config_file
|
echo -e "continue=true\ninput-file=$session_file\nsave-session=$session_file" >> $config_file
|
||||||
|
|
||||||
option_disabled "$s" 'enable_dht' || echo "dht-file-path=$dht_file" >> $config_file
|
option_disabled "$s" 'enable_dht' || echo "dht-file-path=$dht_file" >> $config_file
|
||||||
|
option_disabled "$s" 'enable_log' || {
|
||||||
|
touch "$log_file"
|
||||||
|
echo -e "log=$log_file" >> $config_file
|
||||||
|
}
|
||||||
|
|
||||||
append_params "$s" \
|
append_params "$s" \
|
||||||
file_allocation bt_enable_lpd enable_dht rpc_user rpc_passwd rpc_listen_port dir bt_tracker disk_cache \
|
file_allocation bt_enable_lpd enable_dht rpc_user rpc_passwd rpc_listen_port dir bt_tracker disk_cache \
|
||||||
|
@ -61,7 +70,7 @@ start_instance() {
|
||||||
config_list_foreach "$s" extra_settings append_extrasettings
|
config_list_foreach "$s" extra_settings append_extrasettings
|
||||||
|
|
||||||
SERVICE_UID="$user" \
|
SERVICE_UID="$user" \
|
||||||
service_start /usr/bin/aria2c --conf-path="$config_file"
|
service_start /usr/bin/aria2c --conf-path="$config_file" # start service
|
||||||
}
|
}
|
||||||
|
|
||||||
append_extrasettings() {
|
append_extrasettings() {
|
||||||
|
@ -69,10 +78,24 @@ append_extrasettings() {
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
|
logger -t ARIA2C 'Starting aria2c service'
|
||||||
config_load 'aria2'
|
config_load 'aria2'
|
||||||
config_foreach start_instance 'aria2'
|
config_foreach start_instance 'aria2'
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
service_stop /usr/bin/aria2c
|
if [ -n "`pidof aria2c`" ]; then
|
||||||
|
logger -t ARIA2C 'Shutting down aria2c service'
|
||||||
|
service_stop /usr/bin/aria2c
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
restart() {
|
||||||
|
logger -t ARIA2C 'Restarting aria2c service'
|
||||||
|
stop
|
||||||
|
sleep 2 # give time to shutdown
|
||||||
|
start
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue