From a55650694b64ed6f1f0fbd68e0c50f23ea1d8622 Mon Sep 17 00:00:00 2001 From: Augustus <123775785+OlegTheSnowman@users.noreply.github.com> Date: Wed, 2 Jul 2025 14:43:50 +0300 Subject: [PATCH 1/3] added a repair tool to fix repos if broken --- repair tool.bat | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 repair tool.bat diff --git a/repair tool.bat b/repair tool.bat new file mode 100644 index 0000000..cd8af84 --- /dev/null +++ b/repair tool.bat @@ -0,0 +1,34 @@ +@echo off +setlocal + +:: Define repo paths +set "SCRIPTS_DIR=%~dp0" +set "SOUNDS_DIR=%~dp0sounds" + +:: Try to use system git, fallback to GitPortable +where git >nul 2>nul +if %errorlevel%==0 ( + set "GIT=git" +) else if exist "%~dp0GitPortable\cmd\git.exe" ( + set "GIT=%~dp0GitPortable\cmd\git.exe" +) else ( + echo Git not found. Please install Git or place GitPortable in the same folder. + exit /b 1 +) + +:: Reset scripts repo +echo Resetting scripts repo to remote... +pushd "%SCRIPTS_DIR%" +%GIT% fetch origin +%GIT% reset --hard origin/main +popd + +:: Reset sounds repo +echo Resetting sounds repo to remote... +pushd "%SOUNDS_DIR%" +%GIT% fetch origin +%GIT% reset --hard origin/main +popd + +echo Done. +endlocal From e7a5da16d59390e1ece0bef663506ed806383181 Mon Sep 17 00:00:00 2001 From: nathan smith Date: Wed, 2 Jul 2025 20:47:55 +0100 Subject: [PATCH 2/3] Adding more safety checks to updater --- cosmic rage/worlds/plugins/CosmicRage.xml | 2 +- updator.bat | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cosmic rage/worlds/plugins/CosmicRage.xml b/cosmic rage/worlds/plugins/CosmicRage.xml index 107e434..49545b2 100644 --- a/cosmic rage/worlds/plugins/CosmicRage.xml +++ b/cosmic rage/worlds/plugins/CosmicRage.xml @@ -78,7 +78,7 @@ function RegisterMushClient(name, line, wildcards) end -- Define the latest soundpack version here -CURRENT_SP_VERSION = 2 +CURRENT_SP_VERSION = 3 function CheckSoundpackVersion(name, line, wildcards, styles) local user_version = tonumber(wildcards.user_version) diff --git a/updator.bat b/updator.bat index 9e13126..3062845 100644 --- a/updator.bat +++ b/updator.bat @@ -42,6 +42,13 @@ set "MCL_FILE=cosmic rage\worlds\cosmic rage\cosmic rage.mcl" if exist "%MAIN_REPO_DIR%\%MCL_FILE%" ( %GIT_CMD% -C "%MAIN_REPO_DIR%" update-index --assume-unchanged "%MCL_FILE%" echo [%DATE% %TIME%] Marked %MCL_FILE% as assume-unchanged. >> "%LOG_FILE%" + if errorlevel 1 ( + echo [%DATE% %TIME%] WARNING: Failed to mark %MCL_FILE% as assume-unchanged. Will proceed without excluding it. >> "%LOG_FILE%" + echo WARNING: Could not mark %MCL_FILE% as assume-unchanged. + %GIT_CMD% -C "%MAIN_REPO_DIR%" update-index --no-assume-unchanged "%MCL_FILE%" >nul 2>&1 + ) else ( + echo [%DATE% %TIME%] Marked %MCL_FILE% as assume-unchanged. >> "%LOG_FILE%" + ) ) else ( echo [%DATE% %TIME%] WARNING: %MCL_FILE% not found, skipping assume-unchanged. >> "%LOG_FILE%" ) From 63389381c0ec28b7e214425ba21aac3718fdc3f4 Mon Sep 17 00:00:00 2001 From: Augustus <123775785+OlegTheSnowman@users.noreply.github.com> Date: Thu, 3 Jul 2025 06:51:51 +0300 Subject: [PATCH 3/3] github installer . bat will now use three different downloading methods if the powershell one fails --- git installer.bat | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/git installer.bat b/git installer.bat index bc7701f..b0b4036 100644 --- a/git installer.bat +++ b/git installer.bat @@ -17,6 +17,8 @@ set "SCRIPT_DIR=%~dp0" set "EXTRACT_DIR=%SCRIPT_DIR%gitportable" set "LOG_FILE=%SCRIPT_DIR%git_setup.log" +echo Downloading Git, please wait... It may take a while. + :: Redirect output to log call :main >> "%LOG_FILE%" 2>&1 goto :end @@ -49,9 +51,9 @@ if exist "%EXTRACT_DIR%\" ( ) ) -:: Download Git +:: Download Git using available method echo Downloading Git... -powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri '%GIT_URL%' -OutFile '%SCRIPT_DIR%%GIT_ARCHIVE%'" +call :download "%GIT_URL%" "%SCRIPT_DIR%%GIT_ARCHIVE%" if %errorlevel% neq 0 ( echo Error: Download failed. goto :done @@ -97,6 +99,33 @@ echo ==================================================== :done exit /b +:download +:: Args: %1 - URL, %2 - Output file + +:: Try PowerShell +where powershell >nul 2>nul +if %errorlevel%==0 ( + powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri '%~1' -OutFile '%~2'" + if %errorlevel%==0 exit /b 0 +) + +:: Try curl +where curl >nul 2>nul +if %errorlevel%==0 ( + curl -L -o "%~2" "%~1" + if %errorlevel%==0 exit /b 0 +) + +:: Try bitsadmin +where bitsadmin >nul 2>nul +if %errorlevel%==0 ( + bitsadmin /transfer downloadjob /download /priority normal "%~1" "%~2" + if %errorlevel%==0 exit /b 0 +) + +echo Error: No supported downloader (certutil, PowerShell, curl, bitsadmin) found. +exit /b 1 + :end echo. echo Log saved to: %LOG_FILE%