From de3efb8760dc3cbfd5349afb731b4cdb29854de2 Mon Sep 17 00:00:00 2001 From: Jakub Matraszek Date: Fri, 7 Feb 2025 22:56:31 +0100 Subject: [PATCH] New script: cross-seed --- ct/cross-seed.sh | 56 +++++++++++++++++++++++++++++ install/cross-seed-install.sh | 66 +++++++++++++++++++++++++++++++++++ json/cross-seed.json | 39 +++++++++++++++++++++ 3 files changed, 161 insertions(+) create mode 100644 ct/cross-seed.sh create mode 100644 install/cross-seed-install.sh create mode 100644 json/cross-seed.json diff --git a/ct/cross-seed.sh b/ct/cross-seed.sh new file mode 100644 index 00000000..bbc2e4d5 --- /dev/null +++ b/ct/cross-seed.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Jakub Matraszek (jmatraszek) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://www.cross-seed.org + +# App Default Values +APP="cross-seed" +var_tags="arr" +var_cpu="1" +var_ram="1024" +var_disk="2" +var_os="debian" +var_version="12" +var_unprivileged="1" + +# App Output & Base Settings +header_info "$APP" +base_settings + +# Core +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if command -v cross-seed &> /dev/null; then + current_version=$(cross-seed --version) + latest_version=$(npm show cross-seed version) + if [ "$current_version" != "$latest_version" ]; then + msg_info "Updating ${APP} from version v${current_version} to v${latest_version}" + npm install -g cross-seed@latest &> /dev/null + msg_ok "Updated Successfully" + else + msg_ok "${APP} is already at v${current_version}" + fi + else + msg_error "No ${APP} Installation Found!" + exit + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access cross-seed API using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:2468${CL}" diff --git a/install/cross-seed-install.sh b/install/cross-seed-install.sh new file mode 100644 index 00000000..535b1711 --- /dev/null +++ b/install/cross-seed-install.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Jakub Matraszek (jmatraszek) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://www.cross-seed.org + +# Import Functions und Setup +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +# Installing Dependencies with the 3 core dependencies (curl;sudo;mc) +msg_info "Installing Dependencies" +$STD apt-get install -y \ + curl \ + sudo \ + mc \ + gnupg +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Setup Node.js Repository" + +msg_info "Setting up Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Setup Node.js" + +msg_info "Setup ${APPLICATION}" +$STD npm install cross-seed@latest -g +$STD cross-seed gen-config +msg_ok "Setup ${APPLICATION}" + +# Creating Service (if needed) +msg_info "Creating Service" +cat </etc/systemd/system/${APPLICATION}.service +[Unit] +Description=${APPLICATION} daemon Service +After=network.target + +[Service] +ExecStart=cross-seed daemon +Restart=always + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now ${APPLICATION}.service +msg_ok "Created Service" + +motd_ssh +customize + +# Cleanup +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/json/cross-seed.json b/json/cross-seed.json new file mode 100644 index 00000000..a8a8a7cd --- /dev/null +++ b/json/cross-seed.json @@ -0,0 +1,39 @@ +{ + "name": "cross-seed", + "slug": "cross-seed", + "categories": [ + 14 + ], + "date_created": "2025-02-07", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 2468, + "documentation": "https://www.cross-seed.org/docs/category/basics", + "website": "https://www.cross-seed.org/", + "logo": "https://www.cross-seed.org/img/cross-seed.svg", + "description": "cross-seed is an app designed to help you download torrents that you can cross seed based on your existing torrents. It is designed to match conservatively to minimize manual intervention.", + "install_methods": [ + { + "type": "default", + "script": "ct/cross-seed.sh", + "resources": { + "cpu": 1, + "ram": 1024, + "hdd": 2, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "After the installation cross-seed will fail to start with an empty configuration. To fix this, edit `~/.cross-seed/config.js` to properly configure cross-seed, then restart by running `systemctl restart cross-seed`.", + "type": "info" + } + ] +}