Archive: Installer to update a already installed product!


Installer to update a already installed product!
Hi together,

I am using the NSIS installer since a while. I created my script and I am able to install the product with all things I need.

Now I am releasing new versions of that product and I want the NSIS installer to check if the product is already installed and if so it should uninstall it first and then install the new version.

Is there any solution to do that?

What I also like to have is a possibility that if the version installed equals the version within my installer the installer should provide the update mechanism to select or unselect and update the installation.

Thanks and Regards
-dm82m


This question has been asked hundreds of times before. Are you sure you searched before you asked?

Here's what I do:
- During install, save version number to registry
- Before installing again, read registry and compare previous version number with current one. (Use the versioncompare macro in WordFunc.nsh.) If newer, go into update mode.

Everything is possible with NSIS, but nothing is automatic. You'll have to code your updating functionality yourself.


Hey MSG,

thanks for your reply. I solved my problem as you have written. If the installer detects a already installed older version it asks for uninstalling and deletes this version.

Now my product has several components (client, server, ...). Lets say I run my installer 1.0.0 the first time and install the client.
Then I start the same installer again, it detects that 1.0.0 is already installed. How is it possible to lets say go into a update mode. this means that it will show what was recently installed (in this case the client).
Now if i deselect the Client and select the Server the installer should remove the client and install the Server.
Can you give me some hints how this could be done?

Regards,
Dirk


Then I start the same installer again, it detects that 1.0.0 is already installed. How is it possible to lets say go into a update mode. this means that it will show what was recently installed (in this case the client).
Sections.nsh has two macros called SelectSection and UnselectSection, you can use these to change the default component selection. You can try to autodetect the installed components (with ${If} ${FileExists} for example), or save the selected components to registry and read them in .onInit.

Now if i deselect the Client and select the Server the installer should remove the client and install the Server.
Can you give me some hints how this could be done?
Create an invisible section (Section "-HiddenSection") and use ${If} / ${IfNot} ${SectionIsSelected}.

1. Can the scripts update just the files that need to be updated instead of doing a full download/re-install?

2. Would it be possible to make these scripts available? I'm trying to accomplish the same functionality

Many thanks