-
Notifications
You must be signed in to change notification settings - Fork 22
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
Sign exe before MSI installer is created #138
Comments
I sign it within the jpackageImageTask (kotlin dsl): /**
* Extends the jpackageImage task.
* For Windows, signs the exe file
*/
tasks.jpackageImage {
when (osdetector.os) {
Os.WINDOWS.osName -> {
doLast {
logger.info("Windows jpackageImage")
//Add signing code here
}
}
else -> {
doLast {
logger.info("Other OS")
}
}
}
} Note, you can ignore the Hopefully, that helps |
I'm adding this as enhancement because, although really it was just a question, similar plugins do just have a simple way to get things signed as they are built, and, in some cases, jpackage itself can be instructed to do signing. Things to think about:
|
Thanks @vewert for your input 👍 I have an external bat script that I would like to start. Unfortunately with your solution I did not manage to start the script within
The
Hope this might be useful for others.
@hakanai see above for options I need to sign.. |
jpackage builds both an MSI and an EXE for Windows. To sign the EXE I have this small task:
In order to sign the EXE within the MSI, I have overridden the package resource Post-image script, project-name-post-image.wsf. This is a custom script that is executed after the application image is created and before the MSI installer is built for both .msi and .exe packages.
|
I used to use signtool, but now I use the jsign plugin: https://ebourg.github.io/jsign/ I also noticed about the read-only problem (sorry I should have mentioned that problem). Here is my more complete code, including jsign and removing read-only: /**
* Extends the jpackageImage task.
* For Windows, signs the exe file
*/
tasks.jpackageImage {
when (osdetector.os) {
Os.WINDOWS.osName -> {
doLast {
logger.info("Windows jpackageImage")
Paths.get(jpackageWinDir.absolutePath, "${project.name}.exe").toFile().setWritable(true)
val jsign = project.extensions.getByName("jsign") as groovy.lang.Closure<*>
jsign(
"file" to Paths.get(jpackageWinDir.absolutePath, "${project.name}.exe").toString(),
"name" to longName,
"url" to projectUrl,
"keystore" to pfxFile.absolutePath,
"storepass" to pfxPass,
"alg" to signingAlg,
"tsaurl" to tsaUrl,
"tsmode" to tsMode
)
}
}
else -> {
doLast {
logger.info("Other OS")
}
}
}
} |
The task
jpackageImage
creates an application image.The task
jpackage
creates an MSI Installer of the application image (at least on Windows).Requirement: I need to sign the executable which is wrapped in the MSI installer.
I can sign the MSI installer after the task
jpackage
is finished. However, virus scanner seem to need a signed executable in some cases as well. Hence I tried to first runjpackageImage
, afterwards I signed the executable and after that I calledjpackage
to pack the result.Unfortunately
jpackage
depends onjpackageImage
and creates again a new application image which is not signed. How can I achieve that the already existing application image is used instead of creating a new one.Thanks for any hint!
The text was updated successfully, but these errors were encountered: