Przeglądaj źródła

Version 2.6.0: New additional function script

master
P3TERX 4 lat temu
rodzic
commit
d04fc40550
1 zmienionych plików z 6 dodań i 19 usunięć
  1. +6
    -19
      aria2.sh

+ 6
- 19
aria2.sh Wyświetl plik

@ -9,10 +9,10 @@
# https://github.com/P3TERX/aria2.sh # https://github.com/P3TERX/aria2.sh
# Description: Aria2 One-click installation management script # Description: Aria2 One-click installation management script
# System Required: CentOS/Debian/Ubuntu # System Required: CentOS/Debian/Ubuntu
# Version: 2.5.6
# Version: 2.6.0
# #
sh_ver="2.5.6"
sh_ver="2.6.0"
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH export PATH
aria2_conf_dir="/root/.aria2c" aria2_conf_dir="/root/.aria2c"
@ -76,9 +76,6 @@ check_pid() {
PID=$(ps -ef | grep "aria2c" | grep -v grep | grep -v "aria2.sh" | grep -v "init.d" | grep -v "service" | awk '{print $2}') PID=$(ps -ef | grep "aria2c" | grep -v grep | grep -v "aria2.sh" | grep -v "init.d" | grep -v "service" | awk '{print $2}')
} }
check_new_ver() { check_new_ver() {
#echo -e "${Info} 请输入 Aria2 版本号,格式如:[ 1.35.0 ],获取地址:[ https://github.com/P3TERX/aria2-builder/releases ]"
#read -e -p "默认回车自动获取最新版本号:" aria2_new_ver
#if [[ -z ${aria2_new_ver} ]]; then
aria2_new_ver=$( aria2_new_ver=$(
{ {
wget -t2 -T3 -qO- "https://api.github.com/repos/P3TERX/aria2-builder/releases/latest" || wget -t2 -T3 -qO- "https://api.github.com/repos/P3TERX/aria2-builder/releases/latest" ||
@ -89,18 +86,9 @@ check_new_ver() {
echo -e "${Error} Aria2 最新版本获取失败,请手动获取最新版本号[ https://github.com/P3TERX/aria2-builder/releases ]" echo -e "${Error} Aria2 最新版本获取失败,请手动获取最新版本号[ https://github.com/P3TERX/aria2-builder/releases ]"
read -e -p "请输入版本号:" aria2_new_ver read -e -p "请输入版本号:" aria2_new_ver
[[ -z "${aria2_new_ver}" ]] && echo "取消..." && exit 1 [[ -z "${aria2_new_ver}" ]] && echo "取消..." && exit 1
#else
# echo -e "${Info} 检测到 Aria2 最新版本为 [ ${aria2_new_ver} ]"
fi fi
#else
# echo -e "${Info} 即将准备下载 Aria2 版本为 [ ${aria2_new_ver} ]"
#fi
} }
check_ver_comparison() { check_ver_comparison() {
#aria2_now_ver=$(${aria2c} -v | head -n 1 | awk '{print $3}')
#[[ -z ${aria2_now_ver} ]] && echo -e "${Error} Aria2 当前版本获取失败 !" && exit 1
#if [[ "${aria2_now_ver}" != "${aria2_new_ver}" ]]; then
# echo -e "${Info} 发现 Aria2 已有新版本 [ ${aria2_new_ver} ](当前版本:${aria2_now_ver})"
read -e -p "是否更新(会中断当前下载任务) ? [Y/n] :" yn read -e -p "是否更新(会中断当前下载任务) ? [Y/n] :" yn
[[ -z "${yn}" ]] && yn="y" [[ -z "${yn}" ]] && yn="y"
if [[ $yn == [Yy] ]]; then if [[ $yn == [Yy] ]]; then
@ -110,9 +98,6 @@ check_ver_comparison() {
Download_aria2 "update" Download_aria2 "update"
Start_aria2 Start_aria2
fi fi
#else
# echo -e "${Info} 当前 Aria2 已是最新版本 [ ${aria2_new_ver} ]" && exit 1
#fi
} }
Download_aria2() { Download_aria2() {
update_dl=$1 update_dl=$1
@ -147,6 +132,9 @@ Download_aria2_conf() {
PROFILE_LIST=" PROFILE_LIST="
aria2.conf aria2.conf
clean.sh clean.sh
core
script.conf
rclone.env
upload.sh upload.sh
delete.sh delete.sh
dht.dat dht.dat
@ -166,9 +154,8 @@ LICENSE
exit 1 exit 1
} }
done done
sed -i "s@^\(DOWNLOAD_PATH='\).*@\1${download_path}'@" ${aria2_conf_dir}/*.sh
sed -i "s@^\(dir=\).*@\1${download_path}@" ${aria2_conf} sed -i "s@^\(dir=\).*@\1${download_path}@" ${aria2_conf}
sed -i "s@/root/.aria2/@${aria2_conf_dir}/@" ${aria2_conf_dir}/{*.sh,aria2.conf}
sed -i "s@/root/.aria2/@${aria2_conf_dir}/@" ${aria2_conf_dir}/*.conf
sed -i "s@^\(rpc-secret=\).*@\1$(date +%s%N | md5sum | head -c 20)@" ${aria2_conf} sed -i "s@^\(rpc-secret=\).*@\1$(date +%s%N | md5sum | head -c 20)@" ${aria2_conf}
sed -i "s@^#\(retry-on-.*=\).*@\1true@" ${aria2_conf} sed -i "s@^#\(retry-on-.*=\).*@\1true@" ${aria2_conf}
sed -i "s@^\(max-connection-per-server=\).*@\132@" ${aria2_conf} sed -i "s@^\(max-connection-per-server=\).*@\132@" ${aria2_conf}

Ładowanie…
Anuluj
Zapisz