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

NSIS sign uninstaller #526

Closed
demetris-manikas opened this issue Jun 18, 2016 · 6 comments · May be fixed by qcif/data-curator#563
Closed

NSIS sign uninstaller #526

demetris-manikas opened this issue Jun 18, 2016 · 6 comments · May be fixed by qcif/data-curator#563

Comments

@demetris-manikas
Copy link
Contributor

Before Squirrel came to electron-builder I was about to file a PR concerning not having to sign the uninstaller after doing a windows installation etc. I don't still have the code but the idea was to create the uninstaller as a normal program sign it and then pack it along with the installer.
This way the installer becomes somewhat bigger but then one can build the installer without using Windows. The idea was based on http://nsis.sourceforge.net/Signing_an_Uninstaller which as it is would speed up the build process on a Windows machine.

@develar
Copy link
Member

develar commented Jun 19, 2016

Yes, it is known issue in the nsis todo list. Will be cool if you prepare PR.

This way the installer becomes somewhat bigger but then one can build the installer without using Windows

Currently, you can build installer without windows, — we bundle posix makensis, but the problem in the rcedit — we still need use wine to set icon and version string for app exe (nsis will set it for installer exe without wine, I guess using some template setup).

http://nsis.sourceforge.net/Signing_an_Uninstaller
The answer is to run the installer on the development machine in a special mode which only writes the uninstaller to some known location, then sign that binary in the usual way

It means, that on non-windows machine we still need to use wine "to run the installer on the development machine in a special mode"

I don't still have the code but the idea was to create the uninstaller as a normal program sign it and then pack it along with the installer

If want you to get rid of WriteUninstaller — I doubt that it is possible — user can write any uninstaller script and should just use nsis WriteUninstaller to get uninstaller exe.

@demetris-manikas
Copy link
Contributor Author

demetris-manikas commented Jun 19, 2016

we still need use wine to set icon and version string for app exe (nsis will set it for installer exe without wine, I guess using some template setup).

In the old template there existed the following entries that provided all the needed info.

WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall${APP_NAME}"
"DisplayName" "${APP_NAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall${APP_NAME}"
"UninstallString" "$INSTDIR\Uninstall ${APP_NAME}.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall${APP_NAME}"
"DisplayIcon" "$INSTDIR\icon.ico"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall${APP_NAME}"
"DisplayVersion" "${APP_VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall${APP_NAME}"
"Publisher" "${APP_PUBLISHER}"

${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall${APP_NAME}"
"EstimatedSize" "${APP_INSTALLSIZE}"
"EstimatedSize" "$0"

As you can see the executable for the uninstaller is configurable so yes you can avoid the WriteUninstaller and replace it with another program that just undoes what the installer does

It means, that on non-windows machine we still need to use wine "to run the installer on the development machine in a special mode"

The special mode noted refers to executing makensis twice. First with some flag set (something like makensis \DINNER ) to create the uninstaller and a second one that packs the actual installer (without the INNER flag set). In the mean time electron-builder can sign the uninstaller so that the created installer is good to go.

If want you to get rid of WriteUninstaller — I doubt that it is possible — user can write any uninstaller script and should just use nsis WriteUninstaller to get uninstaller exe.

I don't know how common is to write custom uninstallers for an electron app but for a simple app the developer would not bother to write one.

Thanks for answering so quickly. I 'll wait until we settle on what should be done before writing an code.
Cheers.

@develar
Copy link
Member

develar commented Jun 19, 2016

I don't know how common is to write custom uninstallers for an electron app but for a simple app the developer would not bother to write one.

Yes. But we should not add unnecessary complexity/restriction.

Why do you want to get rid of WriteUninstaller? To avoid wine requirement (because we must invoke makensis \DINNER result exe using wine)? Well, I am OS X user and I understand how it will be cool... but price, price — "you cannot write custom uninstaller" (i.e. we will be bundle 2 variants — for one-click and boring installers) — I think, it is not acceptable. Instead, if someone really want it — we should fix it in the makensis (i.e. call WriteInstaller implementation code directly, not as part of installer exe).

And again — wine in any case is require to setup icon/version string for app exe (well, you pointed me that is possible using WriteRegStr — maybe it is a solution, but I think is is not real solution (I don't like it — metadata should be embedded into the exe)).

So, I propose just follow http://nsis.sourceforge.net/Signing_an_Uninstaller

@develar
Copy link
Member

develar commented Jun 26, 2016

Are you going to work on it or I can do it?

@demetris-manikas
Copy link
Contributor Author

Sorry but I got really busy the last few days, do it if you wish. I could have the PR ready it in a couple o days

@demetris-manikas
Copy link
Contributor Author

Well go ahead and do it. I don't want to keep you waiting. Sorry for not notifying earlier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants