Skip to content

Commit

Permalink
Optimize fix mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
P3TERX committed May 29, 2020
1 parent 152e6d4 commit 37e5245
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions root/etc/cont-init.d/28-fix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@
# Blog: https://p3terx.com (chinese)
#=================================================

[[ -e /config/HelloWorld ]] && exit 0
[[ $(grep 'root/.aria2' /config/aria2.conf) ]] && {
sed -i "s@root/.aria2@config@" /config/aria2.conf
sed -i "s@^\(rpc-listen-port=\).*@\16800@" /config/aria2.conf
sed -i "s@^\(listen-port=\).*@\16888@" /config/aria2.conf
sed -i "s@^\(dht-listen-port=\).*@\16888@" /config/aria2.conf
}

[[ $(grep 'root/.aria2' /config/*.sh) ]] &&
sed -i "s@root/.aria2@config@" /config/*.sh

sed -i "s@^\(DOWNLOAD_PATH='\).*@\1/downloads'@" /config/*.sh

Expand All @@ -23,6 +31,8 @@ sed -i "s@^\(save-session=\).*@\1/config/aria2.session@" /config/aria2.conf
sed -i "s@^\(dht-file-path=\).*@\1/config/dht.dat@" /config/aria2.conf
sed -i "s@^\(dht-file-path6=\).*@\1/config/dht6.dat@" /config/aria2.conf

[[ -e /config/HelloWorld ]] && exit 0

[[ $RPC_PORT ]] &&
sed -i "s@^\(rpc-listen-port=\).*@\1$RPC_PORT@" /config/aria2.conf

Expand All @@ -48,11 +58,4 @@ sed -i "s@^\(dht-file-path6=\).*@\1/config/dht6.dat@" /config/aria2.conf
[[ "$SPECIAL_MODE" = "move" ]] &&
sed -i 's@^\(on-download-complete=\).*@\1/config/move.sh@' /config/aria2.conf

[[ $(grep 'root/.aria2' /config/aria2.conf) ]] && {
sed -i "s@root/.aria2@config@" /config/aria2.conf
sed -i "s@^\(rpc-listen-port=\).*@\16800@" /config/aria2.conf
sed -i "s@^\(listen-port=\).*@\16888@" /config/aria2.conf
sed -i "s@^\(dht-listen-port=\).*@\16888@" /config/aria2.conf
}

exit 0

0 comments on commit 37e5245

Please sign in to comment.