This commit is contained in:
2025-07-03 16:06:00 -05:00
3 changed files with 72 additions and 2 deletions

View File

@@ -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%

34
repair tool.bat Normal file
View File

@@ -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

View File

@@ -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%"
)