installationinno-setupcode-signingsigntool

Setting Inno Setup sign tool with relative paths


I'm trying to set the Inno Setup IDE "Sign Tools" command to use a relative path. I made a sign.bat script which calls signtool.exe following the file structure below:

code_sign\
          + sign.bat
          + signtool.exe
          + cert.pfx
script.iss

If I set the Sign Tool (Tools / Configure Sign Tools...) command to code_sign\sign.bat $p, I got the following error message:

   Sign Tool command failed (Failed to execute Sign Tool.

Error 2: The system cannot find the file specified). Will retry (2 tries left).
   Running Sign Tool command: sign.bat "(...)\uninst.e32.tmp"
   Sign Tool command failed (Failed to execute Sign Tool.
(...)

What is the working path when the sign tool is called?

Sadly I cannot use an absolute path (which works) as the code_sign folder is meant to be a submodule shared with other applications and other users.

What I'm doing wrong here? Should I use the command line version?

The sign.bat contents:

SET script_path=%~dp0
SET stool=%script_path%signtool.exe
SET pfx=%script_path%cert.pfx

SET ntp=http://timestamp.globalsign.com/scripts/timstamp.dll
SET pwd=12345

"%stool%" sign /f %pfx% /p %pwd% /tr %ntp% /td SHA256 %1

Solution

  • Configure your sign tool command as only $p.

    And then in your .iss, set the SignTool directive as follows (assuming the sign tool command is named custom), with a use of SourcePath preprocessor predefined variable.

    [Setup]
    SignTool=custom {#SourcePath}\code_sign\sign.bat $f