-
Notifications
You must be signed in to change notification settings - Fork 54
/
sign_win.bat
64 lines (55 loc) · 2.78 KB
/
sign_win.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
cd %CQZ_WORKSPACE%\obj
set ff_version=''
set archivator_exe=c:\mozilla-build\bin\7z.exe
for /F %%f in (..\mozilla-release\browser\config\version_display.txt) do set ff_version=%%f
set ff_exe=%ff_version%.en-US
echo %ff_exe%
if NOT "%lang%" == "" set ff_exe=%ff_version%.%lang%
echo %ff_exe%
echo %lang%
set timestamp_server_sha1=http://timestamp.verisign.com/scripts/timstamp.dll
set timestamp_server_sha256=http://sha256timestamp.ws.symantec.com/sha256/timestamp
echo %CLZ_SIGNTOOL_PATH%
IF "%CQZ_BUILD_64BIT_WINDOWS%"=="1" (
SET platform_prefix=win64
) ELSE (
SET platform_prefix=win32
)
if exist ./pkg%STUB_PREFIX%_%lang% rmdir /q /s "pkg%STUB_PREFIX%_%lang%"
%archivator_exe% l dist\install\sea\cliqz-%ff_exe%.%platform_prefix%.installer%STUB_PREFIX%.exe
%archivator_exe% x -opkg%STUB_PREFIX%_%lang% -y dist\install\sea\cliqz-%ff_exe%.%platform_prefix%.installer%STUB_PREFIX%.exe
if not exist ./pkg%STUB_PREFIX%_%lang% (goto :error)
cd pkg%STUB_PREFIX%_%lang%
for /R %%f in (
*.exe *.dll
) do (
rem Check does file already have a digital sign. If not - try to create one
echo Check and sign %%f
"%CLZ_SIGNTOOL_PATH%" verify /pa %%f
if ERRORLEVEL 1 (
"%CLZ_SIGNTOOL_PATH%" sign /t %timestamp_server_sha1% /f %WIN_CERT% /p %WIN_CERT_PASS% %%f
"%CLZ_SIGNTOOL_PATH%" sign /fd sha256 /tr %timestamp_server_sha256% /td sha256 /f %WIN_CERT% /p %WIN_CERT_PASS% /as %%f
"%CLZ_SIGNTOOL_PATH%" verify /pa %%f
)
if ERRORLEVEL 1 (goto :error)
)
if defined STUB_PREFIX goto prepare_stub_installer
rem Prepare usual installer
del installer.7z
%archivator_exe% a -r -t7z installer.7z -mx -m0=BCJ2 -m1=LZMA:d25 -m2=LZMA:d19 -m3=LZMA:d1 -mb0:1 -mb0s1:2 -mb0s2:3
cd ..
copy /b ..\mozilla-release\other-licenses\7zstub\firefox\7zSD.Win32.sfx + browser\installer\windows\instgen\app.tag + pkg_%lang%\installer.7z dist\install\sea\cliqz-%ff_exe%.%platform_prefix%.installer.exe
goto sign_installer
:prepare_stub_installer
del stub.7z
%archivator_exe% a -t7z stub.7z setup-stub.exe -mx -m0=BCJ2 -m1=LZMA:d21 -m2=LZMA:d17 -m3=LZMA:d17 -mb0:1 -mb0s1:2 -mb0s2:3
cd ..
copy /b ..\mozilla-release\other-licenses\7zstub\firefox\7zSD.Win32.sfx + browser\installer\windows\instgen\stub.tag + pkg%STUB_PREFIX%_%lang%\stub.7z dist\install\sea\cliqz-%ff_exe%.%platform_prefix%.installer-stub.exe
:sign_installer
"%CLZ_SIGNTOOL_PATH%" sign /t %timestamp_server_sha1% /f %WIN_CERT% /p %WIN_CERT_PASS% dist\install\sea\cliqz-%ff_exe%.%platform_prefix%.installer%STUB_PREFIX%.exe
"%CLZ_SIGNTOOL_PATH%" sign /fd sha256 /tr %timestamp_server_sha256% /td sha256 /f %WIN_CERT% /p %WIN_CERT_PASS% /as dist\install\sea\cliqz-%ff_exe%.%platform_prefix%.installer%STUB_PREFIX%.exe
"%CLZ_SIGNTOOL_PATH%" verify /pa dist\install\sea\cliqz-%ff_exe%.%platform_prefix%.installer%STUB_PREFIX%.exe
if ERRORLEVEL 1 (goto :error)
goto :eof
:error
exit /b 1