Update patch.bat to ignore sha

This commit is contained in:
dazedanon 2025-06-30 18:20:37 -05:00
parent c2e59e64a9
commit fc35e86719

View file

@ -41,37 +41,8 @@ for /f "tokens=1,2 delims==" %%a in (patch-config.txt) do (
if "%%a"=="branch" set "branch=%%b"
)
REM Get the latest hash
echo "Getting latest commit SHA hash"
!_my_shell! -Command "(Invoke-RestMethod -Uri 'https://gitgud.io/api/v4/projects/%username%%%2F%repo%/repository/branches/%branch%').commit.id" > latest_patch_sha.txt
REM Read the latest SHA from the file
set /p latest_patch_sha=<latest_patch_sha.txt
REM Check if previous_patch_sha.txt exists
if not exist previous_patch_sha.txt (
echo "Previous SHA hash not found!"
echo "Assuming first time patching..."
goto download_extract
)
REM Read the stored SHA from previous check
set /p previous_patch_sha=<previous_patch_sha.txt
REM Trim whitespace from SHA strings
set "previous_patch_sha=%previous_patch_sha: =%"
set "latest_patch_sha=%latest_patch_sha: =%"
REM Compare trimmed SHAs
if "%latest_patch_sha%" neq "%previous_patch_sha%" (
echo "Update found! Patching..."
goto download_extract
) else (
echo "Patch is up to date."
)
REM Delete latest_patch_sha.txt
del latest_patch_sha.txt
REM Begin Patch Process
goto download_extract
endlocal
pause
@ -100,10 +71,7 @@ REM Clean up
echo "Cleaning up..."
del repo.zip
rmdir /s /q "%repo%-%branch%"
del latest_patch_sha.txt
REM Store latest SHA for next check
echo %latest_patch_sha% > previous_patch_sha.txt
endlocal
pause
exit /b