From 8fb2ddbd24cd92594f7a78cc0541e9eb8cec3699 Mon Sep 17 00:00:00 2001 From: Sam Heinz <54530346+asylumexp@users.noreply.github.com> Date: Fri, 19 Apr 2024 18:19:19 +1000 Subject: [PATCH] [Aria2] Updated with tteck's fixes and formatting --- install/aria2-install.sh | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/install/aria2-install.sh b/install/aria2-install.sh index d00a9744..e57b9e8a 100644 --- a/install/aria2-install.sh +++ b/install/aria2-install.sh @@ -20,18 +20,17 @@ $STD apt-get install -y mc msg_ok "Installed Dependencies" 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" read -r -p "Would you like to add AriaNG? " prompt if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then msg_info "Installing AriaNG" $STD apt-get install -y nginx - $STD apt-get install -y unzip - cd /root - mkdir -p /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 - $STD unzip "$(ls -l /root | grep zip$ | awk '{print $9}')" -d /var/www + systemctl disable -q --now nginx + wget -q "$(curl -s https://api.github.com/repos/mayswind/ariang/releases/latest | grep download | grep AllInOne.zip | cut -d\" -f4)" + $STD unzip AriaNg-*-AllInOne.zip -d /var/www + rm /etc/nginx/sites-enabled/* cat </etc/nginx/conf.d/ariang.conf server { listen 6880 default_server; @@ -47,18 +46,15 @@ server { } } EOF - rm /etc/nginx/sites-enabled/* - $STD systemctl disable --now nginx - $STD cp /lib/systemd/system/nginx.service /lib/systemd/system/ariang.service - $STD systemctl enable --now ariang + cp /lib/systemd/system/nginx.service /lib/systemd/system/ariang.service msg_ok "Installed AriaNG" fi msg_info "Creating Service" - mkdir /root/downloads +rpc_secret=$(openssl rand -base64 8) +echo "rpc-secret: $rpc_secret" >>~/rpc.secret cat </root/aria2.daemon -continue dir=/root/downloads file-allocation=falloc max-connection-per-server=4 @@ -66,13 +62,13 @@ max-concurrent-downloads=2 max-overall-download-limit=0 min-split-size=25M rpc-allow-origin-all=true -rpc-secret=YouShouldChangeThis +rpc-secret=${rpc_secret} input-file=/var/tmp/aria2c.session save-session=/var/tmp/aria2c.session EOF cat </etc/systemd/system/aria2.service -echo '[Unit] +[Unit] Description=Aria2c download manager After=network.target @@ -86,17 +82,17 @@ TimeoutStopSec=20 Restart=on-failure [Install] -WantedBy=multi-user.target' +WantedBy=multi-user.target EOF -systemctl enable --now -q aria2.service - +systemctl enable -q --now aria2.service +systemctl enable -q --now ariang msg_ok "Created Service" motd_ssh customize msg_info "Cleaning up" -rm /root/ariang.zip +rm AriaNg-*-AllInOne.zip $STD apt-get autoremove $STD apt-get autoclean -msg_ok "Cleaned" +msg_ok "Cleaned" \ No newline at end of file