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
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
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
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
plugin has plenty of examples, the Internet
plugins and scripts to detect online status come with some examples, the MD5
plugin has docs, the XML
plugin (if you use that) has docs, and if you go with plain .ini files - the NSIS manual
(and the NSIS wiki
) 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.