forked from Collective-Software/ClickPaste
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sign.bat
36 lines (28 loc) · 866 Bytes
/
sign.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
@echo off
set argC=0
for %%x in (%*) do Set /A argC+=1
set /A tries=3
rem the build task will fail if it sees any stderr printing, so 2> it.
signtool verify /pa /tw %1 1> nul 2> nul
if ERRORLEVEL 1 goto :try
echo %1 already signed.
if %argC% EQU 1 goto :eof
signtool verify /pa /tw %2 1> nul 2> nul
if ERRORLEVEL 1 goto :try
echo %2 already signed.
goto :eof
:retry
if %tries%==0 goto :barf
ping -n 2 127.0.0.1>nul
:try
set /A tries=%tries%-1
rem signtool sign /n "Collective Software" /i GlobalSign /t "http://timestamp.globalsign.com/scripts/timstamp.dll" /v %1 %2 1>>sign.out 2>>&1
signtool sign /n "Collective Software" /a /i GlobalSign /tr "http://timestamp.globalsign.com/tsa/r6advanced1" /td SHA256 /v %1 %2 1>>sign.out 2>>&1
if ERRORLEVEL 1 goto :retry
del sign.out >nul
echo Signed %1 %2 OK.
goto :eof
:barf
type sign.out
del sign.out >nul
exit /b 1