Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I implement an auto-updater?

Tags:

auto-update

Many programs include an auto-updater, where the program occasionally looks online for updates, and then downloads and applies any updates that are found. Program bugs are fixed, supporting files are modified, and things are (usually) made better.

Unfortunately no matter how hard I look, I can't find information on this process anywhere. It seems like the auto-updaters that have been implemented have either been proprietary or not considered important.

It seems fairly easy to implement the system that looks for updates on a network and downloads them if they are available. That part of the auto-updater will change significantly from implementation to implementation. The question is what are the different approaches of applying patches. Just downloading files and replacing old ones with new ones, running a migration script that was downloaded, monkey patching parts of the system, etc.? Concepts are preferred, but examples in Java, C, Python, Ruby, Lisp, etc. would be appreciated.

like image 427
num1 Avatar asked Oct 24 '08 02:10

num1


People also ask

How do I set up automatic updates?

Tap Manage apps & device.Tap Manage, then find the app you want to update automatically. To open the app's "Details" page, tap the app. Turn on Enable auto update.

How do you implement software update?

For example, provide criteria that retrieves all security or critical software updates that are required on more than 50 clients. Create a software update group that contains the software updates. Download the content for the software updates in the software update group. Manually deploy the software update group.

How do I get exe to auto update?

So the trick on an auto-update is for the application to rename itself (e.g. "MyApplication.exe" to "MyApplication_OLD.exe"), download the new version into the application folder (named "MyApplication.exe"), notify the user that an update has occured which requires a restart of the application, and then end.

How is automatic update used?

Automatic updates allow users to keep their software programs updated without having to check for and install available updates manually. The software automatically checks for available updates, and if found, the updates are downloaded and installed without user intervention.


2 Answers

I think that "language agnostic" is going to be a limiting factor here. Applications come in so many shapes and sizes that there is no one-size-fits-all answer. I have implemented several auto-updaters in several languages, and no two were similar.

The most general philosophy is that the application checks with some home location (web address, web query, corporate network location, etc.) to either ask if it's version is current, or ask what the most current version is. If the answer calls for an update, that process will be different for each situation.

A popular alternative is to invite the home location to run a script when the application is initiated. The script can check the version, download updates if necessary, and ask for usage feedback, for example.

We can probably help better if you narrow the parameters.

UPDATE: The approach to "patching" also depends on the nature of the application, and there's a very wide diversity here. If you have a single executable file, for instance, then it's probably most practical to replace the executable. If your application has many files, you should look for ways to minimize the number of files replaced. If your application is highly customized or parameterized, you should strive to minimize the re-tailoring effort. If your application employs interpreted code (such as an Excel VBA application or MS Access MDB application), then you may be able to replace parts of the code. In a Java application you may only need to replace a JAR file, or even a subset of the JAR contents. You'll also need to have a way to recognize the current client version, and update it appropriately. I could go on and on, but I hope you see my point about diversity. This is one of those many times when the best answer usually starts with "Well, it depends ...!" That's why so many answers include "Please narrow the parameters."

like image 74
Ken Paul Avatar answered Oct 07 '22 14:10

Ken Paul


Be sure to also consider the security implications of sucking down information about the update, as well as the update binaries themselves.

Do you trust the source of the download? You maybe phoning home to got your update, but what if there is a man in the middle who redirects to a malicious server. An HTTPS or similar secure connection will help, but double checking the bits that you eventually download by using a digital signature check is recommended.

like image 40
Ants Avatar answered Oct 07 '22 12:10

Ants