[Aria2] Updated with tteck's fixes and formatting

This commit is contained in:
Sam Heinz 2024-04-19 18:19:19 +10:00
parent 135f944d85
commit 8fb2ddbd24

View file

@ -20,18 +20,17 @@ $STD apt-get install -y mc
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Installing Aria2" msg_info "Installing Aria2"
DEBIAN_FRONTEND=noninteractive $STD apt-get -o Dpkg::Options::="--force-confold" install -y aria2 $STD apt-get install -y aria2
msg_ok "Installed Aria2" msg_ok "Installed Aria2"
read -r -p "Would you like to add AriaNG? <y/N> " prompt read -r -p "Would you like to add AriaNG? <y/N> " prompt
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
msg_info "Installing AriaNG" msg_info "Installing AriaNG"
$STD apt-get install -y nginx $STD apt-get install -y nginx
$STD apt-get install -y unzip systemctl disable -q --now nginx
cd /root wget -q "$(curl -s https://api.github.com/repos/mayswind/ariang/releases/latest | grep download | grep AllInOne.zip | cut -d\" -f4)"
mkdir -p /var/www $STD unzip AriaNg-*-AllInOne.zip -d /var/www
wget -q "$(curl -s https://api.github.com/repos/mayswind/ariang/releases/latest | grep download | grep AllInOne.zip | cut -d\" -f4)" -O /root/ariang.zip rm /etc/nginx/sites-enabled/*
$STD unzip "$(ls -l /root | grep zip$ | awk '{print $9}')" -d /var/www
cat <<EOF >/etc/nginx/conf.d/ariang.conf cat <<EOF >/etc/nginx/conf.d/ariang.conf
server { server {
listen 6880 default_server; listen 6880 default_server;
@ -47,18 +46,15 @@ server {
} }
} }
EOF EOF
rm /etc/nginx/sites-enabled/* cp /lib/systemd/system/nginx.service /lib/systemd/system/ariang.service
$STD systemctl disable --now nginx
$STD cp /lib/systemd/system/nginx.service /lib/systemd/system/ariang.service
$STD systemctl enable --now ariang
msg_ok "Installed AriaNG" msg_ok "Installed AriaNG"
fi fi
msg_info "Creating Service" msg_info "Creating Service"
mkdir /root/downloads mkdir /root/downloads
rpc_secret=$(openssl rand -base64 8)
echo "rpc-secret: $rpc_secret" >>~/rpc.secret
cat <<EOF >/root/aria2.daemon cat <<EOF >/root/aria2.daemon
continue
dir=/root/downloads dir=/root/downloads
file-allocation=falloc file-allocation=falloc
max-connection-per-server=4 max-connection-per-server=4
@ -66,13 +62,13 @@ max-concurrent-downloads=2
max-overall-download-limit=0 max-overall-download-limit=0
min-split-size=25M min-split-size=25M
rpc-allow-origin-all=true rpc-allow-origin-all=true
rpc-secret=YouShouldChangeThis rpc-secret=${rpc_secret}
input-file=/var/tmp/aria2c.session input-file=/var/tmp/aria2c.session
save-session=/var/tmp/aria2c.session save-session=/var/tmp/aria2c.session
EOF EOF
cat <<EOF >/etc/systemd/system/aria2.service cat <<EOF >/etc/systemd/system/aria2.service
echo '[Unit] [Unit]
Description=Aria2c download manager Description=Aria2c download manager
After=network.target After=network.target
@ -86,17 +82,17 @@ TimeoutStopSec=20
Restart=on-failure Restart=on-failure
[Install] [Install]
WantedBy=multi-user.target' WantedBy=multi-user.target
EOF EOF
systemctl enable --now -q aria2.service systemctl enable -q --now aria2.service
systemctl enable -q --now ariang
msg_ok "Created Service" msg_ok "Created Service"
motd_ssh motd_ssh
customize customize
msg_info "Cleaning up" msg_info "Cleaning up"
rm /root/ariang.zip rm AriaNg-*-AllInOne.zip
$STD apt-get autoremove $STD apt-get autoremove
$STD apt-get autoclean $STD apt-get autoclean
msg_ok "Cleaned" msg_ok "Cleaned"