Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add SignTool to the Inno Setup script #7

Merged
merged 2 commits into from
Aug 27, 2024

Conversation

rivafarabi
Copy link
Contributor

  • Add SignTool by adding sign_tool under inno_bundle in the pubspec.yaml file
  • If not specified/empty, the SignTool won't be added to the script, otherwise the script will become invalid.

@@ -117,6 +117,7 @@ All attributes should be under `inno_bundle` in `pubspec.yaml`.
- `false`: Don't require elevated privileges during installation. App will
install into user-specific folder.
- `license_file`: A path relative to the project that points to a text license file, if not provided, `inno_bundle` will look up for `LICENSE` file in your project root folder. Otherwise, it is set to an empty string.
- `sign_tool`: Specifies the name and parameters of the Sign Tool to be used to digitally sign the installer. The name of the sign tool can be added in Inno Setup's `Tools > Configure Sign Tools...`.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your PR is much appreciated ❤️,
Been reading more about sign tools for Windows to understand how to better integrate this attribute before another release, I'm curious here where you wrote "Specifies the name and parameters of the Sign Tool", can you elaborate more with some values you would give to sign_tool attribute so I can better understand about the parameters part of the description.

Thanks again!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. To summaries, in Inno Setup's Configure Sign Tools configuration, user can assign a named variable with the command line and parameters as its value.

Here is the sample of the "SampleCodeSign" that run signtool.exe sign with parameters /tr {TIMESTAMP_URL} /td sha256 /fd sha256 /a $p $f
image

In pubspec.yaml, user can use the named variable or the complete command like below:

# sign_tool: SampleCodeSign
# or
# sign_tool: "signtool.exe sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /a $p $f"

I've just added the sign_tool attribute sample in the example app's pubspec.yaml with the complete command as

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the thorough explanation, correct me if I'm wrong, according to inno setup docs and my own testing:

This works ✅ if you added SampleCodeSign to the Sign Tools list in the UI.

sign_tool: SampleCodeSign

This doesn't work ❌

sign_tool: "signtool.exe sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /a $p $f"

Inno cannot contain the full signtool.exe sign ... command in its .iss file,

I think to overcome this is a bit more complicated, something like this should be implemented:

sign_tool:
  command: "signtool.exe sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /a $p $f"

This way the command is appended to the compiler as

iscc /SMyCodeSign="signtool.exe sign ..." "/path/to/my_script.iss"

then the .iss file will have this

SignTool=MyCodeSign

If you have the capacity to implement this it would be awesome, otherwise, your code is great as it is rn, I can merge your PR and do these changes myself later. let me know.

@@ -92,3 +92,4 @@ inno_bundle:
license_file: assets/LICENSE.txt
languages:
- french
sign_tool: "signtool.exe sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /a $p $f"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added line results to the following when I try to run dart run inno_bundle:build

image

@hahouari
Copy link
Owner

I'm merging this PR, I will fine tune this feature a bit to make clear separation between sign-tool command and sign-tool name.
This will land in version 0.7.0, along with Inno Setup version 6.3.3 support.

If you have more thoughts to add later, let me know, cheers 👍 .

@hahouari hahouari merged commit cd310f2 into hahouari:dev Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants