11th February 2006, 03:38
Is it possible to make a install using NSIS on a CD but then when an update is available the first screen they see tells them "There is a newer version available, click here to update" and it'll download the update instead of installing the old version on the CD? If so, what do I need and any example code would help. Thanks!
11th February 2006, 05:31
You can ask server about updates on install start using InetLoad (http://nsis.sourceforge.net/InetLoad) plug-in (included to NSIS distribution NSISdl works in section only). Then you can read available version number from file and display message box followed by next download.
10th March 2006, 01:08
Any example of script please? Or a working generic application that does this, I can't get it to work as Takhir says? Thanks...
10th March 2006, 02:07
Not really, because in general, the design of your update mechanisms depend on the components you are trying to update, the OS you will support, etc.
But a logical outline would be:
a) Check whether the user is online.
a1) if they are not, do you want to prompt to go online, or just skip the update check?
a2) if they are, do you want to prompt them to check for updates, or do you want to just go ahead check for updates?
a3) If you want to go ahead and check for updates:
b) Use InetLoad (http://nsis.sourceforge.net/InetLoad_plug-in) or NSIS::dl (http://nsis.sourceforge.net/NSISdl_Smooth) to download an .ini, .xml, or .txt file with current version information from your website.
c) Compare the internal version number from the copy they currently are running against the version number in the file you downloaded from your website. Preferably you will have the filesize for the new version in the .ini (http://nsis.sourceforge.net/Category:INI%2C_CSV_%26_Registry_Functions)/xml (http://nsis.sourceforge.net/XML_plug-in) as well, for reasons discussed in a sec.
d) Prompt the user to download a new version. Make sure you save the new version to a writeable medium, in case they are running from CD.
e) (1) Compare the actual filesize/MD5 whatever against the filesize/MD5 (http://nsis.sourceforge.net/MD5_plugin) in the xml file. If they match, the installer you downloaded is probably not corrupt. If they dont, inform the user that their download appears to have failed/been corrupted, and ask them if they want to retry, or just install the old version. Otherwise, if the filesize/MD5 looks good, (2) Hide the window for the old version (on cd), (2) start the new version, (3) exit the old version. Take care not to use the exact same mutex between versions (if you do that sort of thing), or the new copy won't start because your old installer is still running temporarily and has the same mutex.
Now, writing example script to do all those things is not something that most people would write in two or three minutes, so you are unlikely to get a lot of examples here. But the InetLoad (http://nsis.sourceforge.net/InetLoad_plug-in) plugin has plenty of examples, the Internet (http://nsis.sourceforge.net/Category:Internet_Functions) plugins and scripts to detect online status come with some examples, the MD5 (http://nsis.sourceforge.net/MD5_plugin) plugin has docs, the XML (http://nsis.sourceforge.net/XML_plug-in) plugin (if you use that) has docs, and if you go with plain .ini files - the NSIS manual (http://nsis.sourceforge.net/Docs/) (and the NSIS wiki (http://nsis.sourceforge.net/Developer_Center)) goes over reading strings from text files.
Besides - in the process of understanding how to piece together an update system, you'll learn a lot of valuable information about NSIS itself.
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.