mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 00:02:55 +00:00
fix: properly interpret windows errorlevels
This commit is contained in:
parent
419481b4da
commit
0f1c67b54c
27
generate.bat
27
generate.bat
@ -3,9 +3,9 @@
|
|||||||
set PREMAKE_URL="https://github.com/premake/premake-core/releases/download/v5.0.0-beta4/premake-5.0.0-beta4-windows.zip"
|
set PREMAKE_URL="https://github.com/premake/premake-core/releases/download/v5.0.0-beta4/premake-5.0.0-beta4-windows.zip"
|
||||||
set PREMAKE_HASH="12d741d3b70445b025c03e26148e2d129801041fa5ddde61b4ac888a76017395"
|
set PREMAKE_HASH="12d741d3b70445b025c03e26148e2d129801041fa5ddde61b4ac888a76017395"
|
||||||
|
|
||||||
REM The following variables can be set:
|
@REM The following variables can be set:
|
||||||
REM PREMAKE_NO_GLOBAL - Ignore premake5 executable from path
|
@REM PREMAKE_NO_GLOBAL - Ignore premake5 executable from path
|
||||||
REM PREMAKE_NO_PROMPT - Download premake5 without prompting
|
@REM PREMAKE_NO_PROMPT - Download premake5 without prompting
|
||||||
|
|
||||||
goto start
|
goto start
|
||||||
|
|
||||||
@ -14,22 +14,22 @@ goto start
|
|||||||
if not exist "build" mkdir "build"
|
if not exist "build" mkdir "build"
|
||||||
|
|
||||||
where /q "pwsh"
|
where /q "pwsh"
|
||||||
IF %ERRORLEVEL% EQU 0 (
|
IF NOT ERRORLEVEL 1 (
|
||||||
set POWERSHELL_BIN="pwsh"
|
set POWERSHELL_BIN="pwsh"
|
||||||
) else (
|
) else (
|
||||||
set POWERSHELL_BIN="powershell"
|
set POWERSHELL_BIN="powershell"
|
||||||
)
|
)
|
||||||
|
|
||||||
echo Downloading...
|
echo Downloading...
|
||||||
%POWERSHELL_BIN% -Command "Invoke-WebRequest %PREMAKE_URL% -OutFile build/premake.zip"
|
%POWERSHELL_BIN% -NoProfile -NonInteractive -Command "Invoke-WebRequest %PREMAKE_URL% -OutFile build/premake.zip"
|
||||||
IF %ERRORLEVEL% NEQ 0 (
|
IF ERRORLEVEL 1 (
|
||||||
echo Download failed >&2
|
echo Download failed >&2
|
||||||
exit 2
|
exit 2
|
||||||
)
|
)
|
||||||
|
|
||||||
echo Extracting...
|
echo Extracting...
|
||||||
%POWERSHELL_BIN% -Command "Expand-Archive -LiteralPath build/premake.zip -DestinationPath build"
|
%POWERSHELL_BIN% -NoProfile -NonInteractive -Command "Expand-Archive -LiteralPath build/premake.zip -DestinationPath build"
|
||||||
IF %ERRORLEVEL% NEQ 0 (
|
IF ERRORLEVEL 1 (
|
||||||
echo Extraction failed >&2
|
echo Extraction failed >&2
|
||||||
exit 2
|
exit 2
|
||||||
)
|
)
|
||||||
@ -37,8 +37,8 @@ IF %ERRORLEVEL% NEQ 0 (
|
|||||||
rm build/premake.zip
|
rm build/premake.zip
|
||||||
|
|
||||||
echo Verifying hash...
|
echo Verifying hash...
|
||||||
%POWERSHELL_BIN% -Command "if ((Get-FileHash -LiteralPath build/premake5.exe -Algorithm SHA256).Hash -eq \"%PREMAKE_HASH%\") { exit 0 } else { exit 1 }"
|
%POWERSHELL_BIN% -NoProfile -NonInteractive -Command "if ((Get-FileHash -LiteralPath build/premake5.exe -Algorithm SHA256).Hash -eq \"%PREMAKE_HASH%\") { exit 0 } else { exit 1 }"
|
||||||
IF %ERRORLEVEL% NEQ 0 (
|
IF ERRORLEVEL 1 (
|
||||||
echo Hash verification failed >&2
|
echo Hash verification failed >&2
|
||||||
rm build/premake5.exe
|
rm build/premake5.exe
|
||||||
exit 2
|
exit 2
|
||||||
@ -50,9 +50,10 @@ cd %~dp0
|
|||||||
|
|
||||||
:start
|
:start
|
||||||
|
|
||||||
IF /i "%PREMAKE_NO_GLOBAL%" EQU "" (
|
IF "%PREMAKE_NO_GLOBAL%" EQU "" (
|
||||||
where /q "premake5.exe"
|
where /Q "premake5.exe"
|
||||||
IF %ERRORLEVEL% EQU 0 (
|
IF NOT ERRORLEVEL 1 (
|
||||||
|
echo success
|
||||||
set PREMAKE_BIN="premake5.exe"
|
set PREMAKE_BIN="premake5.exe"
|
||||||
goto runpremake
|
goto runpremake
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user