Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autoupdate ala Google Chrome workflow

Tags:

auto-update

In the company I am I was asked to write an autoupdate function a la chrome. I.e. It should check periodically whether a new version is available, download the new version and apply it silently the next time the application starts.

I already have something up and running but it is more like a dirty hack than something I feel happy about it. So, I would like to know how to design and implement such a solution. My horrible hack works as this:

  1. Have a mechanism to check whether a new version exists (a database query or a web service)

  2. Download a full zip with the whole new version.

  3. Check file signature. If everything went alright, set a registry value: must update to true.

  4. When the application restarts, if the must update value is true, launch an update program and exist.

  5. The update deletes the contents of the application folder, unzips the update and replaces the old contents, launches the application and exits.

Now, I would like to change it, so it works cleaner. I am planning to send the update as a bsdiff file. It gets downloaded. But the question is, what happens next?

When do apply the update? Who is in charge of applying the patch? is it the program itself or is it a third program, as I did, which is in charge of applying the patch and relaunch the application?

like image 423
Sambatyon Avatar asked May 23 '11 12:05

Sambatyon


People also ask

How do I force Chrome to update itself?

Go to "About Google Chrome," and click Automatically update Chrome for all users. Linux users: To update Google Chrome, use your package manager. Windows users: Close all Chrome windows and tabs on the desktop, then relaunch Chrome to apply the update.

Do browser extensions automatically update?

Chrome does a good job of updating your extensions automatically, but it checks for updates on its own schedule. If you know that a new version of an extension is out but Chrome hasn't updated it, here's how to do it manually. Start Google Chrome.


2 Answers

If your going down the C++ route you can go to chromium and download the Chrome source code and dig around to see how the update is done, this might give you a better idea on how to approach it. Here's an article that might help.

If your familiar with .NET the recently release nuget also has an auto update feature that might be useful to look at, you can get the source code from here. David Ebbo has a blog about how its done here.

I'm not up to date on Delphi but you might be able to use either of the above options.

like image 192
lancscoder Avatar answered Nov 11 '22 15:11

lancscoder


The workflow you proposed is more or less like it should work, but there's no need to re-invent the wheel - there are plenty libraries out there that will do this for you. Using a 3rd party library has the benefit of keeping your code cleaner while making sure the dirty process of auto-update is contained and working flawlessly.

Trust me, I know. I'm the author of NAppUpdate, an app update framework for .NET (which you might want to try out or learn from).

like image 41
synhershko Avatar answered Nov 11 '22 15:11

synhershko