Rev 192 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 192 | Rev 194 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | @echo off |
1 | @echo off |
- | 2 | setlocal enableextensions enabledelayedexpansion |
|
- | 3 | rem // change directory to the script's path, in case we are started as Administrator |
|
- | 4 | cd /d %~dp0 |
|
2 | 5 | ||
3 | set PRODUCT_NAME=Chess Giants |
6 | set PRODUCT_NAME=Chess Giants |
4 | set PRODUCT_URL=http://www.pmbaty.com/chess/ |
- | |
5 | set OUTPUT_FILE=Z:\Documents\Mes projets\www.pmbaty.com\chess\Chess Giants Installer.exe |
7 | set OUTPUT_FILE=Z:\Documents\Mes projets\www.pmbaty.com\chess\Chess Giants Installer.exe |
- | 8 | rem // NOTE NO DASH v----- HERE IN THE FIRST NAME! THE CERTIFICATE WAS ISSUED BY GLOBALSIGN WITHOUT IT! |
|
- | 9 | set PUBLISHER=Pierre Marie Baty |
|
- | 10 | rem // NOTE NO DASH ^----- HERE IN THE FIRST NAME! THE CERTIFICATE WAS ISSUED BY GLOBALSIGN WITHOUT IT! |
|
- | 11 | set PUBLISHER_WEBSITE=https://www.pmbaty.com/chess/ |
|
6 | 12 | ||
- | 13 | set OSSLSIGNCODE=%~dp0osslsigncode.Win32-x64.exe |
|
- | 14 | set OSSLSIGNCODE_SIGN_FLAGS=-pkcs11module IDPrimePKCS1164.dll -pass 0000 -key "pkcs11:object=%PUBLISHER%;type=private" -certs "%PUBLISHER%+Verokey Secure Code+DigiCert Trusted Root G4.pem" -ts http://timestamp.digicert.com |
|
- | 15 | ||
- | 16 | if not exist "%OSSLSIGNCODE%" echo osslsigncode not found - Please fix the path in this installer script!&& goto :error |
|
- | 17 | del *.log > nul 2>&1 |
|
- | 18 | ||
- | 19 | rem //////////////////////////////////// |
|
- | 20 | rem // create the Chess Giants installer |
|
- | 21 | ||
- | 22 | rem // sign the main executable if it's not signed already |
|
- | 23 | set BINARY=..\Chess Giants.exe |
|
- | 24 | set DESCRIPTION=%PRODUCT_NAME% executable |
|
- | 25 | set URL=%PUBLISHER_WEBSITE% |
|
- | 26 | "%OSSLSIGNCODE%" verify "%BINARY%" > nul && ( |
|
- | 27 | echo Already signed: %BINARY% |
|
- | 28 | ) || ( |
|
- | 29 | echo Signing %BINARY%... |
|
- | 30 | "%OSSLSIGNCODE%" sign %OSSLSIGNCODE_SIGN_FLAGS% -n "%DESCRIPTION%" -i "%URL%" -in "%BINARY%" >> codesigning.log || goto :error |
|
- | 31 | ) |
|
- | 32 | ||
- | 33 | rem // sign the game engines if they're not signed already |
|
- | 34 | for /f "usebackq delims=|" %%e in (`dir /b ..\engines`) do ( |
|
- | 35 | set ENGINE_SUBDIR=%%e |
|
- | 36 | for /f "usebackq delims=|" %%f in (`dir /b ^"..\engines\^!ENGINE_SUBDIR^!\^"*.exe ^"..\engines\^!ENGINE_SUBDIR^!\^"*.dll`) do ( |
|
- | 37 | "%OSSLSIGNCODE%" verify "..\engines\!ENGINE_SUBDIR!\%%f" > nul && ( |
|
- | 38 | echo Already signed: ..\engines\!ENGINE_SUBDIR!\%%f |
|
- | 39 | ) || ( |
|
- | 40 | echo Signing ..\engines\!ENGINE_SUBDIR!\%%f... |
|
- | 41 | "%OSSLSIGNCODE%" sign %OSSLSIGNCODE_SIGN_FLAGS% -n "Chess engine for %PRODUCT% by %PUBLISHER%" -i "%PUBLISHER_WEBSITE%" -in "..\engines\!ENGINE_SUBDIR!\%%f" >> codesigning.log || goto :error |
|
- | 42 | ) |
|
- | 43 | ) |
|
- | 44 | ) |
|
- | 45 | ||
- | 46 | rem // reset the config file |
|
7 | echo Backing up config file... |
47 | echo Backing up config file... |
8 |
|
48 | if not exist .\config.ini.bak ( |
- | 49 | if exist ..\config.ini move ..\config.ini .\config.ini.bak |
|
9 | copy ..\config-DEFAULT.ini ..\config.ini |
50 | copy ..\config-DEFAULT.ini ..\config.ini |
- | 51 | ) > nul |
|
10 | 52 | ||
- | 53 | rem // create the NSIS install package |
|
11 | echo Creating the installer... |
54 | echo Creating the installer... |
12 | "%ProgramFiles(x86)%\NSIS\makensis.exe" "/XOutFile \"%OUTPUT_FILE%\"" |
55 | "%ProgramFiles(x86)%\NSIS\makensis.exe" "/XOutFile \"%OUTPUT_FILE%\"" installer.nsi > installer.nsi.log || goto :error |
13 | if errorlevel 1 goto exiterror |
- | |
14 | 56 | ||
15 | rem // some time is needed for antiviruses etc to release the newly created file |
57 | rem // some time is needed for antiviruses etc to release the newly created file |
16 | ping 127.0.0.1 > nul |
58 | ping 127.0.0.1 > nul |
17 | 59 | ||
- | 60 | rem // sign the installer |
|
- | 61 | set BINARY=%OUTPUT_FILE% |
|
- | 62 | set DESCRIPTION=%PRODUCT_NAME% installer |
|
- | 63 | set URL=%PUBLISHER_WEBSITE% |
|
18 | echo Signing the installer... |
64 | echo Signing the installer... |
19 |
|
65 | "%OSSLSIGNCODE%" sign %OSSLSIGNCODE_SIGN_FLAGS% -n "%DESCRIPTION%" -i "%URL%" -in "%BINARY%" >> codesigning.log || goto :error |
20 | 66 | ||
- | 67 | :success |
|
21 | echo Restoring configuration... |
68 | echo Restoring configuration... |
22 | del ..\config.ini > nul |
- | |
23 | move .\config.ini.bak ..\config.ini > nul |
69 | if exist .\config.ini.bak del ..\config.ini > nul && move .\config.ini.bak ..\config.ini > nul |
24 | - | ||
25 | echo Finished. |
70 | echo Finished. |
26 | pause > nul |
71 | pause > nul |
27 | exit /b 0 |
72 | exit /b 0 |
28 | 73 | ||
29 | : |
74 | :error |
- | 75 | if exist .\config.ini.bak del ..\config.ini > nul && move .\config.ini.bak ..\config.ini > nul |
|
30 |
|
76 | echo An error occured. |
31 | pause > nul |
77 | pause > nul |
32 | exit /b 1 |
78 | exit /b 1 |