Aria2 LXC - Updated (#2826)

This commit is contained in:
Sam Heinz 2024-04-20 17:18:51 +10:00 committed by GitHub
parent da964fcacc
commit e3b4543ef5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 172 additions and 0 deletions

74
ct/aria2.sh Normal file
View File

@ -0,0 +1,74 @@
#!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func)
# Copyright (c) 2021-2024 tteck
# Author: tteck (tteckster)
# License: MIT
# https://github.com/tteck/Proxmox/raw/main/LICENSE
function header_info {
clear
cat <<"EOF"
___ _ ___
/ | _____(_)___ |__ \
/ /| | / ___/ / __ `/_/ /
/ ___ |/ / / / /_/ / __/
/_/ |_/_/ /_/\__,_/____/
EOF
}
header_info
echo -e "Loading..."
APP="Aria2"
var_disk="8"
var_cpu="2"
var_ram="1028"
var_os="debian"
var_version="12"
variables
color
catch_errors
function default_settings() {
CT_TYPE="1"
PW=""
CT_ID=$NEXTID
HN=$NSAPP
DISK_SIZE="$var_disk"
CORE_COUNT="$var_cpu"
RAM_SIZE="$var_ram"
BRG="vmbr0"
NET="dhcp"
GATE=""
APT_CACHER=""
APT_CACHER_IP=""
DISABLEIP6="no"
MTU=""
SD=""
NS=""
MAC=""
VLAN=""
SSH="no"
VERB="no"
echo_default
}
function update_script() {
header_info
if [[ ! -d /var ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
msg_info "Updating $APP LXC"
apt-get update &>/dev/null
apt-get -y upgrade &>/dev/null
msg_ok "Updated $APP LXC"
exit
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${APP} should be accessible via the following IP.
${BL}http://${IP}:6800${CL}"
echo -e "AriaNG should be reachable by going to the following URL.
${BL}http://${IP}:6880${CL} \n"

98
install/aria2-install.sh Normal file
View File

@ -0,0 +1,98 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2024 tteck
# Author: tteck (tteckster)
# License: MIT
# https://github.com/tteck/Proxmox/raw/main/LICENSE
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt-get install -y curl
$STD apt-get install -y sudo
$STD apt-get install -y mc
msg_ok "Installed Dependencies"
msg_info "Installing Aria2"
$STD apt-get install -y aria2
msg_ok "Installed Aria2"
read -r -p "Would you like to add AriaNG? <y/N> " prompt
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
msg_info "Installing AriaNG"
$STD apt-get install -y nginx
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 <<EOF >/etc/nginx/conf.d/ariang.conf
server {
listen 6880 default_server;
listen [::]:6880 default_server;
server_name _;
root /var/www;
index index.html;
location / {
try_files \$uri \$uri/ =404;
}
}
EOF
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 <<EOF >/root/aria2.daemon
dir=/root/downloads
file-allocation=falloc
max-connection-per-server=4
max-concurrent-downloads=2
max-overall-download-limit=0
min-split-size=25M
rpc-allow-origin-all=true
rpc-secret=${rpc_secret}
input-file=/var/tmp/aria2c.session
save-session=/var/tmp/aria2c.session
EOF
cat <<EOF >/etc/systemd/system/aria2.service
[Unit]
Description=Aria2c download manager
After=network.target
[Service]
Type=simple
User=root
Group=root
ExecStartPre=/usr/bin/env touch /var/tmp/aria2c.session
ExecStart=/usr/bin/aria2c --console-log-level=warn --enable-rpc --rpc-listen-all --conf-path=/root/aria2.daemon
TimeoutStopSec=20
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now aria2.service
systemctl enable -q --now ariang
msg_ok "Created Service"
motd_ssh
customize
msg_info "Cleaning up"
rm AriaNg-*-AllInOne.zip
$STD apt-get autoremove
$STD apt-get autoclean
msg_ok "Cleaned"