Archive: Add, Remove, Repair from Install executable


Add, Remove, Repair from Install executable
One of the nice things about InstallShield is it's ability to detect, when executing the installation executable, if a previous installation exists, and then bring you to the add/remove/repair selection. If there is no existing installation, it continues as normal.

So for example, lets say I run the installation for program X. Right after it's installed, I can re-run the installation program to uninstall program X, without having to go through Control Panel, or the Start Menu Program Groups, etc.

Is there any way to do this with NSIS? I've looked into Thrash's add/remove programs, but that just customizes the menu from the Add/Remove programs in control panel and for the uninstall script.

This involves 'branching' into two different sets of pages, depending on if it detected an installation. As far as I know, that's not possible, since you can't use function calls to customize the page layout.

I thought about doing stuff in .onInit, but I think it sets the page layout before doing .onInit, so it won't matter. Any ideas?

Another idea, which seems a bit complex, would be to have an installation package which automatically packages two different installation packages. Then, if it detects the installation, it runs one, and if it doesn't, it runs the other. However, this would result in a 2x size bloat/overhead in file size.


I found this a few days ago. I think it may help.


I found this too, but unfortunately it's under the GPL. Is there any version of this that is under the NSIS 'as-is' license, including commercial?


What about detecting your app in .onInit and then displaying a confirmation MessageBox that executes the UninstallString and exits if the user chooses to uninstall?

Or you should be able to have a custom page to handle the confirmation, which would get skipped if your app isn't detected--isn't that functionally the same as what InstallShield can do?


Why not just detecting if a previous version is installed in .onInit and then display a custom page. From this custom page, have the add/remove/repair options. When next is selected, launch something else (or another custom page(s)). When a previous version isn't detected, just use Abort in the Pre functions of your custom pages.


The other problem is that I'm not sure how to have radio button functionality in a custom page. Sections.nsh support for radio buttons only applies to normal sections, not sections within a custom page.


Use the "group" flag to group radio buttons together.

Hint: I've found that it's usually a good idea to have the radio buttons as the last 3 options on the page to make the group work properly.

See the InstallOptions doc for more info.


By the way, thanks for the tips. I have a custom page where I skip all of the !insertmacro stuff for the page if it doesn't detect an installation, and an empty custom page seems to get skipped, which is good. I also rediscovered that there's a type RadioButton for .ini files. Thanks!