How do you make an update installer with NSIS?
Asked Answered
N

6

15

I currently have a project with an installer I made with NSIS, but I would like to have an update to new versions that only has the changed files and will show a changelog. The target platform is windows. What methods/suggestions do you have to do this?

Nonesuch answered 13/6, 2009 at 9:26 Comment(3)
Have you completed your project? What did you use in the end? Perhaps you could accept one of the answers :)Sediment
Yes, I completed it... but I did not use any of these methods as it was more complicated than I would have liked. So I just did a full release build for updates and required the user to download them before letting the application be run.Nonesuch
I just accepted your answer... even though I didn't use it, it looks like the best method available.Nonesuch
S
18

You might want to reconsider using NSIS. If you are into patching and distributing updates you will probably get the most benefit from using an installer technology that utilises the Windows Installer capabilities (msiexec).

NSIS is basically a program that runs and does what you want whereas a Windows Installer type installer forces you to split your application into features and components which can be managed by the windows installer msi service. MSI will track things like what versions of products you have installed, whether running the installer again will run in maintenance mode, whether you are allowed to install 2 products of different versions, whether a patch can be applied to a particular version of a product or any other question relating to updates and installs.

Basically most of the stuff you are requesting will be available out-of-the-box if you change to a Windows Installer technology. Whereas if you use NSIS (which doesn't use Windows Installer technology) then you will have to implement it all yourself.

Just as an example there is a pretty comprehensive installer builder called AdvancedInstaller ( http://www.advancedinstaller.com/ ) that sounds like what you want. Alternatively, if you want to spend the rest of your life trawling forums and newsgroups then there is an open source product called WiX that does something similar ;)

Sediment answered 27/5, 2010 at 14:2 Comment(1)
Not sure why I've been marked down for this. While NSIS is open source, you have to think of the best tool for the job after all you are running under Windows.Sediment
S
8

In spite of my previous comment I have written a 5000 line installer using NSIS with 13 custom pages. I have even looked at patching and it's a bit of a hack. The main bit of advice is to make sure you are patching the version you think you are patching then use one of the patching plugins available.

There are several patching technologies that compare files and produce patch change files and the NSIS code required to "install" them. I have found that NSIS Patch Gen did what I wanted pretty well with the least amount of hassle. The documentation is a bit thin but once you figure it out you think "Oh yeh".

You are probably going to have a little bit of trouble with an automatically generated Change Log. I would suggest that you create the Change Log yourself (or at least add the extra changes to it with each application change you make) and just include it as if it was a normal application file and let the patch generator update it.

http://sourceforge.net/projects/nsispatchgen/

Sediment answered 12/11, 2010 at 11:6 Comment(0)
R
2

One possible way would be to store an XML file on your download server that has each released version and a list of files that changed for each release. The installer would write a registry key on install of the version of files it installed.

Then, on update, the installer downloads and parses the XML file, and finds any nodes that have higher version numbers than what is currently installed. You display all the files in a text box on an installer page, and when the user confirms, the installer downloads all the files, and then updates the registry to the latest version.

Reginareginald answered 16/6, 2009 at 12:21 Comment(1)
I only have a few files, and they will get changed with almost every update. So I just wanted to bundle them in an updater.exe, and have that installer be different than the full installation exe file. Still not sure what is best... maybe a full installation everytime is good enough for my case.Nonesuch
F
1

are you familiar with cURL? http://www.shininglightpro.com/products/Win32OpenSSL.html http://curl.haxx.se/download.html#openssl

it will download any protocol, and you can use it to download your files. it's a commandline app.

in the installer, schedule a program which should check first to see if the main program is running or not and quit if it is running if not, calls curl to download a batch file from your site with the updates, then runs the batch file.
the batch file it downloads updates the app by downloading the correct files using curl. the process should run maybe every 2 weeks or once a month, depending on how often you update.

the uninstall part of the installer should be capable of removing all parts of the app in question,including any updates. this can be accomplished by removing all files from that subdir of program files.

RMDir /r /REBOOTOK '$INSTDIR'
RMDir /r /REBOOTOK "$SMPROGRAMS\$StartMenuFolder"
Delete '$SMPROGRAMS\$StartMenuFolder\gpl3license.lnk'
Delete '$SMPROGRAMS\$StartMenuFolder\readme.lnk'
Delete '$SMPROGRAMS\$StartMenuFolder\${PRODUCT_TITLE}.lnk'
DeleteRegKey HKCU "Software\Your major subkey\${PRODUCT_NAME}"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
DeleteRegKey /ifempty HKCU "Software\${PRODUCT_NAME}"

PRODUCT_NAME is a !define I made because I use these nsi files like a template. this is only a piece of the installer file's uninstaller section.

Flexed answered 7/4, 2012 at 21:1 Comment(0)
P
0

Some compilers like Delphi make a lot of changes in the final executable even if you change a little part of your code.

So first you should see if it worth patching.

Another consideration is patching by itself. Patching maybe blocked by some Anti Virus Software specially in some system folders.

and finally incremental patching data size can grow beyond the original files.

Based on above subjects I don't suggest you patching. Use full installers instead

Pleading answered 24/5, 2011 at 6:48 Comment(0)
B
0

I've been able to create a patch updater program for my Windows app (a CLI which uses NSIS as its installer) by releasing the app to my personal CDN (or some hosting platform) and taking advantage of Node.js modules like path to replace the binary (using a similar procedure to equinox.io) with a given version from the CDN and winreg to update the Windows Registry accordingly. Since I've namespaced my Windows Registry key, the uninstaller still works for it.

If anyone wants more details on this, please ask. I'm happy to help.

Blossom answered 8/8, 2019 at 17:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.