diff --git a/ct/rclone.sh b/ct/rclone.sh index 66700cf288..79009af3c8 100644 --- a/ct/rclone.sh +++ b/ct/rclone.sh @@ -28,27 +28,19 @@ function update_script() { 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 + if [[ ! -f ~/.rclone ]] || [[ "${RELEASE}" != "$(cat ~/.rclone 2>/dev/null)" ]]; 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}" + fetch_and_deploy_gh_release "rclone" "rclone/rclone" "prebuild" "latest" "/opt/rclone" "rclone*linux-amd64.zip" 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}" diff --git a/install/rclone-install.sh b/install/rclone-install.sh index 5340ab7532..3fb65c729c 100644 --- a/install/rclone-install.sh +++ b/install/rclone-install.sh @@ -17,12 +17,9 @@ msg_info "Installing Dependencies" $STD apt-get install -y apache2-utils fuse3 msg_ok "Installed Dependencies" +fetch_and_deploy_gh_release "rclone" "rclone/rclone" "prebuild" "latest" "/opt/rclone" "rclone*linux-amd64.zip" + 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" @@ -31,7 +28,6 @@ $STD htpasswd -cb -B /opt/login.pwd admin "$RCLONE_PASSWORD" 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" @@ -57,7 +53,6 @@ motd_ssh customize msg_info "Cleaning up" -rm -f "$temp_file" $STD apt-get -y autoremove $STD apt-get -y autoclean msg_ok "Cleaned"