mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-12-24 09:24:15 +08:00
update the signing script to avoid racing when building in parallel
This commit is contained in:
parent
3ccfe84491
commit
90be4ce820
@ -13,9 +13,14 @@ if not defined file (
|
||||
pushd "%~dp0"
|
||||
set "OPENSSL_CONF=%cd%\openssl.cnf"
|
||||
|
||||
set "pvt_file=%cd%\prvt.pem"
|
||||
set "cer_file=%cd%\cert.pem"
|
||||
set "pfx_file=%cd%\cfx.pfx"
|
||||
call :gen_rnd rr
|
||||
set "pvt_file=%cd%\prvt-%rr%.pem"
|
||||
|
||||
call :gen_rnd rr
|
||||
set "cer_file=%cd%\cert-%rr%.pem"
|
||||
|
||||
call :gen_rnd rr
|
||||
set "pfx_file=%cd%\cfx-%rr%.pfx"
|
||||
|
||||
set "openssl_exe=%cd%\openssl.exe"
|
||||
set "signtool_exe=%cd%\signtool.exe"
|
||||
@ -41,13 +46,14 @@ if %exit% neq 0 (
|
||||
|
||||
call "%openssl_exe%" pkcs12 -export -out "%pfx_file%" -inkey "%pvt_file%" -in "%cer_file%" -passout pass:
|
||||
set /a exit+=%errorlevel%
|
||||
if %exit% neq 0 (
|
||||
goto :end_script
|
||||
)
|
||||
|
||||
del /f /q "%cer_file%"
|
||||
del /f /q "%pvt_file%"
|
||||
|
||||
if %exit% neq 0 (
|
||||
goto :end_script
|
||||
)
|
||||
|
||||
call "%signtool_exe%" sign /d "GSE" /fd sha256 /f "%pfx_file%" /p "" "%~1"
|
||||
set /a exit+=%errorlevel%
|
||||
if %exit% neq 0 (
|
||||
@ -59,3 +65,18 @@ del /f /q "%pfx_file%"
|
||||
:end_script
|
||||
endlocal
|
||||
exit /b %exit%
|
||||
|
||||
|
||||
:: when every project is built in parallel '/MP' with Visual Studio,
|
||||
:: the regular random variable might be the same, causing racing
|
||||
:: this will waste some time and hopefully generate a different number
|
||||
:: 1: (ref) out random number
|
||||
:gen_rnd
|
||||
setlocal enabledelayedexpansion
|
||||
for /l %%A in (1, 1, 100) do (
|
||||
set "_r=!random!"
|
||||
)
|
||||
endlocal & (
|
||||
set "%~1=%random%"
|
||||
exit /b
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user