Subversion Repositories Games.Chess Giants

Rev

Rev 192 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  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
  5.  
  6. set PRODUCT_NAME=Chess Giants
  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/
  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
  47. echo Backing up config file...
  48. if not exist .\config.ini.bak (
  49.         if exist ..\config.ini move ..\config.ini .\config.ini.bak
  50.         copy ..\config-DEFAULT.ini ..\config.ini
  51. ) > nul
  52.  
  53. rem // create the NSIS install package
  54. echo Creating the installer...
  55. "%ProgramFiles(x86)%\NSIS\makensis.exe" "/XOutFile \"%OUTPUT_FILE%\"" installer.nsi > installer.nsi.log || goto :error
  56.  
  57. rem // some time is needed for antiviruses etc to release the newly created file
  58. ping 127.0.0.1 > nul
  59.  
  60. rem // sign the installer
  61. set BINARY=%OUTPUT_FILE%
  62. set DESCRIPTION=%PRODUCT_NAME% installer
  63. set URL=%PUBLISHER_WEBSITE%
  64. echo Signing the installer...
  65. "%OSSLSIGNCODE%" sign %OSSLSIGNCODE_SIGN_FLAGS% -n "%DESCRIPTION%" -i "%URL%" -in "%BINARY%" >> codesigning.log || goto :error
  66.  
  67. :success
  68. echo Restoring configuration...
  69. if exist .\config.ini.bak del ..\config.ini > nul && move .\config.ini.bak ..\config.ini > nul
  70. echo Finished.
  71. pause > nul
  72. exit /b 0
  73.  
  74. :error
  75. if exist .\config.ini.bak del ..\config.ini > nul && move .\config.ini.bak ..\config.ini > nul
  76. echo An error occured.
  77. pause > nul
  78. exit /b 1
  79.