From 50eaac6b2a57912d1e4e1b6ecf79e7ba77abbe00 Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE <53913510+TuroYT@users.noreply.github.com> Date: Thu, 30 Oct 2025 16:04:40 +0100 Subject: [PATCH 1/4] Add jq and fetch latest SnowShare release tag --- install/snowshare-install.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/install/snowshare-install.sh b/install/snowshare-install.sh index 8debd978f..a00494e49 100644 --- a/install/snowshare-install.sh +++ b/install/snowshare-install.sh @@ -17,6 +17,7 @@ $STD apt-get install -y \ curl \ sudo \ git \ + jq \ make \ gnupg \ ca-certificates \ @@ -49,11 +50,23 @@ echo -e "SnowShare Database Name: \e[32m$DB_NAME\e[0m" >>~/snowshare.creds msg_ok "Set up PostgreSQL Database" msg_info "Installing SnowShare (Patience)" +# Find the latest release tag using the GitHub API +LATEST_TAG=$(curl -s "https://api.github.com/repos/TuroYT/snowshare/releases/latest" | jq -r .tag_name) + +if [ -z "$LATEST_TAG" ] || [ "$LATEST_TAG" == "null" ]; then + msg_error "Failed to fetch the latest release tag from GitHub." + exit 1 +fi +msg_ok "Fetching latest release: $LATEST_TAG" + cd /opt $STD git clone https://github.com/TuroYT/snowshare.git cd /opt/snowshare +$STD git checkout $LATEST_TAG +msg_ok "Checked out $LATEST_TAG" + $STD npm ci -msg_ok "Installed SnowShare" +msg_ok "Installed SnowShare dependencies" msg_info "Creating Environment Configuration" cat </opt/snowshare/.env @@ -110,4 +123,4 @@ customize msg_info "Cleaning up" $STD apt-get -y autoremove $STD apt-get -y autoclean -msg_ok "Cleaned" \ No newline at end of file +msg_ok "Cleaned" From c8b36f3ec50952f5a16ae336158486a598fc0348 Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE <53913510+TuroYT@users.noreply.github.com> Date: Thu, 30 Oct 2025 16:07:00 +0100 Subject: [PATCH 2/4] fix update to latest --- ct/snowshare.sh | 66 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 5 deletions(-) diff --git a/ct/snowshare.sh b/ct/snowshare.sh index c8998b809..32c1b48b9 100644 --- a/ct/snowshare.sh +++ b/ct/snowshare.sh @@ -30,15 +30,71 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - msg_info "Updating ${APP}" - systemctl stop snowshare + + # S'assurer que jq est installé pour l'analyse de l'API + if ! command -v jq &> /dev/null; then + msg_info "Installing 'jq' (required for update check)..." + apt-get update &>/dev/null + apt-get install -y jq &>/dev/null + if ! command -v jq &> /dev/null; then + msg_error "Failed to install 'jq'. Cannot proceed with update." + exit 1 + fi + msg_ok "Installed 'jq'" + fi + + msg_info "Checking for ${APP} updates..." cd /opt/snowshare - git pull + + # Obtenir le tag local actuel + CURRENT_TAG=$(git describe --tags 2>/dev/null) + if [ $? -ne 0 ]; then + msg_warn "Could not determine current version tag. Fetching latest..." + CURRENT_TAG="unknown" + fi + + # Obtenir le tag de la dernière release depuis GitHub + LATEST_TAG=$(curl -s "https://api.github.com/repos/TuroYT/snowshare/releases/latest" | jq -r .tag_name) + + if [ -z "$LATEST_TAG" ] || [ "$LATEST_TAG" == "null" ]; then + msg_error "Failed to fetch the latest release tag from GitHub." + exit 1 + fi + + msg_info "Current version: $CURRENT_TAG" + msg_info "Latest version: $LATEST_TAG" + + if [ "$CURRENT_TAG" == "$LATEST_TAG" ]; then + msg_ok "${APP} is already up to date." + exit + fi + + msg_info "Updating ${APP} to $LATEST_TAG..." + systemctl stop snowshare + + # Récupérer les nouveaux tags + git fetch --tags + + # Se placer sur le dernier tag + git checkout $LATEST_TAG + if [ $? -ne 0 ]; then + msg_error "Failed to checkout tag $LATEST_TAG. Aborting update." + systemctl start snowshare + exit 1 + fi + + # Relancer les étapes d'installation et de build + msg_info "Installing dependencies..." npm ci + msg_info "Generating Prisma client..." npx prisma generate + msg_info "Applying database migrations..." + npx prisma migrate deploy # Important pour les changements de schéma + msg_info "Building application..." npm run build + systemctl start snowshare - msg_ok "Updated ${APP}" + msg_ok "Updated ${APP} to $LATEST_TAG" exit } @@ -49,4 +105,4 @@ 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}" \ No newline at end of file +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}" From 28b6a601c403e5c95c1ad14db28c849ed3c76ea4 Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE <53913510+TuroYT@users.noreply.github.com> Date: Fri, 31 Oct 2025 09:37:11 +0100 Subject: [PATCH 3/4] Update ct/snowshare.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> --- ct/snowshare.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/snowshare.sh b/ct/snowshare.sh index 32c1b48b9..f515ebd18 100644 --- a/ct/snowshare.sh +++ b/ct/snowshare.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) #source <(curl -fsSL https://raw.githubusercontent.com/TuroYT/ProxmoxVED/refs/heads/add-snowshare/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG From 77a82c78e04e7b06b20494c7f9ec9f72fca1c117 Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE <53913510+TuroYT@users.noreply.github.com> Date: Fri, 31 Oct 2025 09:37:20 +0100 Subject: [PATCH 4/4] Update ct/snowshare.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> --- ct/snowshare.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/ct/snowshare.sh b/ct/snowshare.sh index f515ebd18..f5a76507f 100644 --- a/ct/snowshare.sh +++ b/ct/snowshare.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) -#source <(curl -fsSL https://raw.githubusercontent.com/TuroYT/ProxmoxVED/refs/heads/add-snowshare/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG # Author: TuroYT # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE