From a386765e33233f96ee342291d1f20fc382f00b83 Mon Sep 17 00:00:00 2001 From: "push-app-to-main[bot]" <203845782+push-app-to-main[bot]@users.noreply.github.com> Date: Mon, 19 May 2025 14:35:10 +0200 Subject: [PATCH] rclone (#4579) * 'Add new script' * remove alpine only file * Update rclone.json --------- Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> Co-authored-by: CanbiZ <47820557+MickLesk@users.noreply.github.com> --- ct/headers/rclone | 6 ++ ct/rclone.sh | 65 +++++++++++++++++++ .../json/{alpine-rclone.json => rclone.json} | 14 ++-- install/rclone-install.sh | 65 +++++++++++++++++++ 4 files changed, 143 insertions(+), 7 deletions(-) create mode 100644 ct/headers/rclone create mode 100644 ct/rclone.sh rename frontend/public/json/{alpine-rclone.json => rclone.json} (86%) create mode 100644 install/rclone-install.sh diff --git a/ct/headers/rclone b/ct/headers/rclone new file mode 100644 index 000000000..90ef6df4a --- /dev/null +++ b/ct/headers/rclone @@ -0,0 +1,6 @@ + ____ __ + / __ \_____/ /___ ____ ___ + / /_/ / ___/ / __ \/ __ \/ _ \ + / _, _/ /__/ / /_/ / / / / __/ +/_/ |_|\___/_/\____/_/ /_/\___/ + diff --git a/ct/rclone.sh b/ct/rclone.sh new file mode 100644 index 000000000..18107d911 --- /dev/null +++ b/ct/rclone.sh @@ -0,0 +1,65 @@ +#!/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: Slaviša Arežina (tremor021) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/rclone/rclone + +APP="Rclone" +var_tags="${var_tags:-os}" +var_cpu="${var_cpu:-1}" +var_ram="${var_ram:-512}" +var_disk="${var_disk:-2}" +var_os="${var_os:-debian}" +var_version="${var_version:-12}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -d /opt/rclone ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + RELEASE=$(curl -s https://api.github.com/repos/rclone/rclone/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then + msg_info "Stopping Service" + systemctl stop rclone-web + msg_ok "Stopped Service" + + msg_info "Updating ${APP} to v${RELEASE}" + temp_file=$(mktemp) + rm -rf /opt/rclone/* + curl -fsSL "https://github.com/rclone/rclone/releases/download/v${RELEASE}/rclone-v${RELEASE}-linux-amd64.zip" -o "$temp_file" + $STD unzip -j "$temp_file" '*/**' -d /opt/rclone + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated $APP to v${RELEASE}" + + msg_info "Starting Service" + systemctl start rclone-web + msg_ok "Started Service" + + msg_info "Cleaning up" + rm -f "$temp_file" + msg_ok "Cleaned" + msg_ok "Updated Successfully" + else + msg_ok "No update required. ${APP} is already at v${RELEASE}" + 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 it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}" diff --git a/frontend/public/json/alpine-rclone.json b/frontend/public/json/rclone.json similarity index 86% rename from frontend/public/json/alpine-rclone.json rename to frontend/public/json/rclone.json index 7bdc79a37..d2fd37838 100644 --- a/frontend/public/json/alpine-rclone.json +++ b/frontend/public/json/rclone.json @@ -1,10 +1,10 @@ { - "name": "Alpine-rclone", - "slug": "alpine-rclone", + "name": "Rclone", + "slug": "rclone", "categories": [ 11 ], - "date_created": "2025-05-06", + "date_created": "2025-05-15", "type": "ct", "updateable": true, "privileged": false, @@ -17,16 +17,16 @@ "install_methods": [ { "type": "default", - "script": "ct/alpine-rclone.sh", + "script": "ct/rclone.sh", "resources": { "cpu": 1, "ram": 256, "hdd": 1, - "os": "alpine", - "version": "3.21" + "os": "debian", + "version": "12" } }, - { + { "type": "alpine", "script": "ct/alpine-rclone.sh", "resources": { diff --git a/install/rclone-install.sh b/install/rclone-install.sh new file mode 100644 index 000000000..35cae3ae3 --- /dev/null +++ b/install/rclone-install.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Slaviša Arežina (tremor021) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/rclone/rclone + +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 \ + apache2-utils \ + unzip +msg_ok "Installed Dependencies" + +msg_info "Installing rclone" +temp_file=$(mktemp) +mkdir -p /opt/rclone +RELEASE=$(curl -s https://api.github.com/repos/rclone/rclone/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +curl -fsSL "https://github.com/rclone/rclone/releases/download/v${RELEASE}/rclone-v${RELEASE}-linux-amd64.zip" -o "$temp_file" +$STD unzip -j "$temp_file" '*/**' -d /opt/rclone +cd /opt/rclone +RCLONE_PASSWORD=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) +$STD htpasswd -cb -B /opt/login.pwd admin "$RCLONE_PASSWORD" +{ + echo "rclone-Credentials" + echo "rclone User Name: admin" + echo "rclone Password: $RCLONE_PASSWORD" +} >>~/rclone.creds +echo "${RELEASE}" >/opt/rclone_version.txt +msg_ok "Installed rclone" + +msg_info "Creating Service" +cat </etc/systemd/system/rclone-web.service +[Unit] +Description=Rclone Web GUI +After=network-online.target + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/rclone +ExecStart=/opt/rclone/rclone rcd --rc-web-gui --rc-web-gui-no-open-browser --rc-addr :3000 --rc-htpasswd /opt/login.pwd +Restart=on-failure + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now rclone-web +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -f "$temp_file" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned"