From 5c0cffce6fd16761c6899182763d8b3047cea107 Mon Sep 17 00:00:00 2001 From: Tobias <96661824+CrazyWolf13@users.noreply.github.com> Date: Tue, 22 Jul 2025 12:17:53 +0200 Subject: [PATCH] gitea-mirror: add: migration to 3.0 (#6138) --- ct/gitea-mirror.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ct/gitea-mirror.sh b/ct/gitea-mirror.sh index 3866514ca..7459895e8 100644 --- a/ct/gitea-mirror.sh +++ b/ct/gitea-mirror.sh @@ -28,6 +28,26 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi + + APP_VERSION=$(grep -o '"version": *"[^"]*"' /opt/gitea-mirror/package.json | cut -d'"' -f4) + if [[ $APP_VERSION =~ ^2\. ]]; then + if ! whiptail --backtitle "Gitea Mirror Update" --title "⚠️ VERSION 2.x DETECTED" --yesno \ + "WARNING: Version $APP_VERSION detected!\n\nUpdating from version 2.x will CLEAR ALL CONFIGURATION.\n\nThis includes:\n• API tokens\n• User settings\n• Repository configurations\n• All custom settings\n\nDo you want to continue with the update process?" 15 70 --defaultno + then + exit 0 + fi + + if ! whiptail --backtitle "Gitea Mirror Update" --title "⚠️ FINAL CONFIRMATION" --yesno \ + "FINAL WARNING: This update WILL clear all configuration!\n\nBEFORE PROCEEDING, please:\n\n• Copy API tokens to a safe location\n• Backup any custom configurations\n• Note down repository settings\n\nThis action CANNOT be undone!" 18 70 --defaultno + then + whiptail --backtitle "Gitea Mirror Update" --title "Update Cancelled" --msgbox "Update process cancelled. Please backup your configuration before proceeding." 8 60 + exit 0 + fi + whiptail --backtitle "Gitea Mirror Update" --title "Proceeding with Update" --msgbox \ + "Proceeding with version $APP_VERSION update.\n\nAll configuration will be cleared as warned." 8 50 + rm -rf /opt/gitea-mirror + fi + RELEASE=$(curl -fsSL https://api.github.com/repos/RayLabsHQ/gitea-mirror/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') if [[ "${RELEASE}" != "$(cat ~/.${APP} 2>/dev/null || cat /opt/${APP}_version.txt 2>/dev/null)" ]]; then