From 6c110e91f7769f0c12990cf12f61875b3daf8989 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Tue, 1 Oct 2024 12:32:32 +0300 Subject: [PATCH 1/2] Exit scripts when try to update non-git installs --- UpdateAndStart.bat | 11 +++++++++-- UpdateForkAndStart.bat | 10 ++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/UpdateAndStart.bat b/UpdateAndStart.bat index 55cee5ce9..8bf70f368 100644 --- a/UpdateAndStart.bat +++ b/UpdateAndStart.bat @@ -2,9 +2,15 @@ pushd %~dp0 git --version > nul 2>&1 if %errorlevel% neq 0 ( - echo Git is not installed on this system. Skipping update. - echo If you installed with a zip file, you will need to download the new zip and install it manually. + echo Git is not installed on this system. + echo Install it from https://git-scm.com/downloads + goto end ) else ( + if not exist .git ( + echo Not running from a Git repository. Reinstall using an officially supported method to get updates. + echo See: https://docs.sillytavern.app/installation/windows/ + goto end + ) call git pull --rebase --autostash if %errorlevel% neq 0 ( REM incase there is still something wrong @@ -14,5 +20,6 @@ if %errorlevel% neq 0 ( set NODE_ENV=production call npm install --no-audit --no-fund --loglevel=error --no-progress --omit=dev node server.js %* +:end pause popd diff --git a/UpdateForkAndStart.bat b/UpdateForkAndStart.bat index 8bfae8609..8088962bb 100644 --- a/UpdateForkAndStart.bat +++ b/UpdateForkAndStart.bat @@ -5,8 +5,14 @@ pushd %~dp0 echo Checking Git installation git --version > nul 2>&1 if %errorlevel% neq 0 ( - echo Git is not installed on this system. Skipping update. - echo If you installed with a zip file, you will need to download the new zip and install it manually. + echo Git is not installed on this system. + echo Install it from https://git-scm.com/downloads + goto end +) + +if not exist .git ( + echo Not running from a Git repository. Reinstall using an officially supported method to get updates. + echo See: https://docs.sillytavern.app/installation/windows/ goto end ) From 9e3307576ef835da5ae399c80f7f865ecd964059 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Tue, 1 Oct 2024 12:43:20 +0300 Subject: [PATCH 2/2] Crash when update failed --- UpdateAndStart.bat | 4 +++- UpdateForkAndStart.bat | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/UpdateAndStart.bat b/UpdateAndStart.bat index 8bf70f368..fbb3ac9bb 100644 --- a/UpdateAndStart.bat +++ b/UpdateAndStart.bat @@ -14,7 +14,9 @@ if %errorlevel% neq 0 ( call git pull --rebase --autostash if %errorlevel% neq 0 ( REM incase there is still something wrong - echo There were errors while updating. Please download the latest version manually. + echo There were errors while updating. + echo See the update FAQ at https://docs.sillytavern.app/usage/update/#common-update-problems + goto end ) ) set NODE_ENV=production diff --git a/UpdateForkAndStart.bat b/UpdateForkAndStart.bat index 8088962bb..d788b9470 100644 --- a/UpdateForkAndStart.bat +++ b/UpdateForkAndStart.bat @@ -95,7 +95,8 @@ git pull --rebase --autostash origin %TARGET_BRANCH% :install if %errorlevel% neq 0 ( - echo There were errors while updating. Please check manually. + echo There were errors while updating. + echo See the update FAQ at https://docs.sillytavern.app/usage/update/#common-update-problems goto end )