Archive: How to create an NSIS Software Updater


How to create an NSIS Software Updater
Hi All,

I'm new to NSIS. I just finished creating an installer that works perfectly with Vista and XP. It sets the installation folder depending on the level of priviledge the user has (admin, user, etc...) and it also bypasses the UAC prompt in Vista.

My other problem though is creating a software updater. I've checked the forums and a lot of guys out there are looking for one good example, which unfortunately I think, there isn't any yet.

I've read the user guide and have run some of the examples, using the SilentInstall and the /s switch but I can't figure how all works in real world.

I understand the concept how an updater should work, but I wanna know how it's done. Could anyone please tell me how it's done in NSIS step by step? an updater that silently installs...

Thanks...


Updater via web or desktop application?

Is very easy:
1.- Locate the old app (registry, ini entry, by the user)
2.- Replace with new files, delete old stuff.
3.- Write things back with the new stuff.


Via desktop application.
Let's say I've got a desktop application installed. When I launch my application, it will check if there are available updates through web service. If there is, it will silently install the updates.
How is it done with NSIS?


Hello

did you find a solution to this question?


Please, think about it logically! There is no single all-in-one solution for this. How would you go about it?

1. Get the currently installed version.
2. Get the latest version and download URL.
3. Compare the versions.
4. Download the new version.
5. Install it.

Any good programmer uses 'divide and conquer' which is to split these steps into more smaller steps.

For 1.
a) Get it from the Windows registry, OR
b) Get it from an installed dll or exe file using GetDLLVersion (see manual).

For 2.
a) Download an INI/XML file from the internet using the InetC or NSISdl plugins either from a stored file on a web server or from the output of a web script.
b) Read the INI file using ReadINIStr or the XML file using one of the XML plugins.

For 3.
a) If the versions are version strings, compare with VersionCompare from the NSIS manual.
b) If the versions to compare are UNIX timestamps, compare using the System plugin's Int64Op function (actually, just IntCmp may do).
c) If the versions are plain text dates, make do with a StrCmp/${If} a != b.

For 4.
Best to make this a silent NSIS installer which handles all the file replacements. You will already have used the InetC or NSISdl plugins. Use them again to download.

For 5.
Simple. Exec or ExecWait the downloaded NSIS installer. Search the forum for the InstallOnReboot macro if you need to install files on reboot.

Stu


I have a local updater that is able to download a mini installer from the web server using the NSISdl plugin.

Is there also a way for the local installer to check for the latest mini installer available from the web server. I've heard you can do that through a web service. But is it possible with NSIS too?