From 447482cada5b772957e9f973440326eb51cf9ba5 Mon Sep 17 00:00:00 2001 From: Sam Heinz <54530346+asylumexp@users.noreply.github.com> Date: Mon, 15 Apr 2024 17:55:21 +1000 Subject: [PATCH] [Aria2] Add Aria2 Installer --- ct/aria2.sh | 72 +++++++++++++++++++++++++++++++++++++ install/aria2-install.sh | 76 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+) create mode 100644 ct/aria2.sh create mode 100644 install/aria2-install.sh diff --git a/ct/aria2.sh b/ct/aria2.sh new file mode 100644 index 00000000..a8511cf5 --- /dev/null +++ b/ct/aria2.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/asylumexp/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="6" +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} maintenance page should be reachable by going to the following URL. + ${BL}http://${IP}:6800 \n" diff --git a/install/aria2-install.sh b/install/aria2-install.sh new file mode 100644 index 00000000..3d3b3d7e --- /dev/null +++ b/install/aria2-install.sh @@ -0,0 +1,76 @@ +#!/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 +$STD apt-get install -y wget +$STD apt-get install -y unzip +msg_ok "Installed Dependencies" + +msg_info "Installing Aria2" +DEBIAN_FRONTEND=noninteractive $STD apt-get -o Dpkg::Options::="--force-confold" install -y aria2 +systemctl enable -q --now apt-cacher-ng +msg_ok "Installed Aria2" + +read -r -p "Would you like to add ar? " prompt +if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then + msg_info "Installing AriaNG" + mkdir -p /var/www + wget -q $(curl -s https://api.github.com/repos/maywind/ariang/releases/latest | grep download | grep AllInOne.zip | cut -d\" -f4) + ZIP="$(ls -l /root | grep zip$ | awk '{print $9}')" + unzip $FILENAME -d /var/www + service_path="/etc/systemd/system/ariang.service" +echo '[Unit] +Description=AriaNG +ConditionFileIsExecutable=/usr/local/bin/caddy +After=network.target + +[Service] +ExecStart=/usr/local/bin/caddy "-root /var/www "browse" +Restart=always +RestartSec=120 + +[Install] +WantedBy=multi-user.target' >$service_path + msg_ok "Installed AriaNG" +fi +msg_info "Creating Service" + service_path="/etc/systemd/system/aria2.service" +echo '[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' >$service_path +systemctl enable --now -q aria2.service + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get autoremove +$STD apt-get autoclean +msg_ok "Cleaned"