How can I enable auto-updates in a Qt cross-platform application?
Asked Answered
R

13

49

I love applications that are able to update themselves without any effort from the user (think: Sparkle framework for Mac). Is there any code/library I can leverage to do this in a Qt application, without having to worry about the OS details?

At least for Windows, Mac and user-owned Linux binaries.

I could integrate Sparkle on the Mac version, code something for the Linux case (only for a standalone, user-owned binary; I won't mess with distribution packaging, if my program is ever packaged), and find someone to help me on the Windows side, but that's horribly painful.

Rojo answered 16/1, 2010 at 14:11 Comment(0)
R
0

OK, so I guess I take it as a "no (cross-platform) way". It's too bad!

Rojo answered 24/1, 2010 at 15:7 Comment(2)
It really, really is. I end up googling for a "proper" WinSparkle about once a month. One of these days I'm going to just write my own.Hallsy
In fact there is one. Check my answer.Katharina
B
21

It is not a complete solution, but a cross-platform (Windows, Mac, Linux) tool for creating packages for auto-updates and installing them is available at https://github.com/mendeley/Update-Installer. This tool does not deal with publishing updates or downloading them.

This was written for use with a Qt-based application but to make the update installer small, standalone and easy to build, the installer uses only standard system libraries (C++ runtime, pthreads/libz/libbz2 on Linux/Mac, Win32 API on Windows, Cocoa on Mac, GTK with fallback on Linux). This simplifies delivering updates which include new versions of Qt and other non-system libraries that your application may depend on.

Before considering this though, I would suggest:

  • If you are only building for two platforms, consider using standard and well-tested auto-update frameworks for those platforms - eg. Sparkle on Mac, Google's Omaha on Windows or auto-update systems built into popular install frameworks (eg. InstallShield). I haven't tried BitRock.
  • On Mac, the Mac App Store may be a good option. See https://bugreports.qt.io/browse/QTBUG-16549 though.
  • On Linux, consider creating a .deb package and a simple repository to host it. Once users have a repository set up, the system-wide software update tools will take care of checking for and installing new releases. The steps for setting up a new repository however are too complex for many new Ubuntu/Debian users. What we did, and also what Dropbox and Google have done, is to create a .deb package which sets up the repository as part of the package installation.

A few other notes on creating an updater:

  • On Windows Vista/7, if the application is installed system-wide (eg. in C:\Program Files\$APPNAME) your users will see a scary UAC prompt when the updater tries to obtain permissions to write to the install directory. This can be avoided either by installing to a user-writable directory (I gather that this is what Google Chrome does) or by obtaining an Authenticode certificate and using it to sign the updater binary.
  • On Windows Vista/7, an application .exe or DLL cannot be deleted if in use, but the updater can move the existing .exe/DLL out of the way into a temporary directory and schedule it for deletion on the next reboot.
  • On Ubuntu, 3rd-party repositories are disabled after distribution updates. Google works around this by creating a cron-job to re-add the repository if necessary.
Bentwood answered 11/9, 2011 at 12:3 Comment(1)
A system service is another way to avoid a UAC prompt when updating on Windows. Mozilla are using this for Firefox's new silent update system.Bentwood
O
9

Shameless plug: Fervor, a simple multiplatform (Qt-based) application autoupdater inspired by Sparkle.

Oid answered 2/6, 2012 at 0:18 Comment(3)
From the Ferver readme: "Ferver is not able to install the actual update automatically. The user is given an option to download and install the update manually." In other words: it's hardly more than a popup saying "new version available"?Uvea
Jens, yes, but someone has to create that pop-up too. Push requests are welcome though ;-)Oid
I found the auto-updater branch. Which looks good :) thanks for working on this!!Uvea
O
6

Shameless plug: this a relatively old question, but I thought that it may be useful to mention a library that I created recently, which I named "QSimpleUpdater". Aside from notifying you if there's a newer version, it allows you to download the change log in any format (such as HTML or RTF) and download the updates directly from your application using a dialog.

As you may expect from a Qt project, it works on any platform supported by Qt (tested on Windows, Mac & Linux).

Links:

Screenshot:

enter image description here

Obola answered 16/1, 2015 at 1:2 Comment(0)
A
3

I've developed an auto-updater library which works beautifully on Mac OS X, Linux and pretty much every Unix that allows you to unlink a file while the file is still open. The reason being that I simply extracted the downloaded package on top of the existing application. Unfortunately, because I relied on this functionality, I ran into problems on Windows as Windows does not let you unlink an open file.

The only alternative I could find is to use MoveFileEx with the replace on reboot flag, but that is awful.

However, renaming the working directory of the application works on Windows 7 and Windows XP. I haven't tried Windows Vista yet.

Aestivation answered 3/4, 2010 at 21:46 Comment(2)
A link to your library? How do you deal with updating more than one exe file? (shared libraries, resources, etc.)Solidus
It's not online yet. If there is interest, I might remove my application dependencies from it and put it on github. On Windows, the way it works at the moment is that it downloads a zip file, moves the current installation out of the way (which I think will probably only work on NTFS, not FAT, but I don't care) and unzips on top of the current install directory. So this way, multiple resources are updated without a problem. On Unix, it is much simpler: just unzip on top of the application because Unix allows you to unlink files while they are still open.Aestivation
H
3

Though it works a bit differently than Sparkle, BitRock InstallBuilder contains an autoupdater written in Qt that can be used independently (disclaimer, I am the original BitRock developer). It is a commercial app, but we have free licenses for open source projects.

Hale answered 8/5, 2011 at 1:48 Comment(0)
B
2

The blog post Mixing Cocoa and Qt may solve the problem for the Mac platform.

Berg answered 12/2, 2011 at 16:42 Comment(0)
A
2

I have found WebUpdate to be quite useful, though it's written with the wxWidgets. But don't worry, it's a separate app which handles your updates. The steps to integrate it are pretty simple - just write two XML files and run the updater. And yes, it's cross-platform.

The advantage of it is it will automatically download and unzip/install all you required and not just provide a popup with a notification about a new version and a link to download it. Another thing you can do with it is customizable actions.

Project's main page is here, you can read the docs or take a look at the official tutorial.

Aulos answered 10/8, 2012 at 8:34 Comment(0)
S
2

You can use UpdateNode which gives you all the possibilities to update your software. It's using a cross platform Qt client and is free for Open Source!

UPDATE Just did some further analysis on that and really like this solution:

Pros:

  • Free for Open Source!!! Even the client is Open Source: https://github.com/updatenode/unclient
  • The client is already localized in several languages
  • Very flexible in terms of updates. You can even update single non-binaries.
  • Provides additionally a way to display messages though the client.
  • Ready to use binaries & installer for all common Linux distributions, single Windows binary, as well as installer and a solution for Mac (which I have not tried, as I don't have a Mac)
  • Easy to use web service, nice statistics and update check is integrated within few minutes

Cons:

  • I am missing a multi-user management in the online service. Maybe they will do it in future - I will definitely suggest that in their feedback portal
  • The client is a GUI client only - so, you will need to shrink it down to run without a GUI frontend (maybe only necessary for people like me ;-) )

So, bottom line, as this solution is quite new, I think there is lot of potential here. I will definitely use it in my project and I am looking forward for more from them! Thumbs up!

Succoth answered 20/3, 2014 at 9:2 Comment(0)
V
2

This is an old question but there is not Squirrel in answers which is BEST SOLUTION , here is what I'm doing in qt 5.12.4 with qt quick "my qml app" you can do this in any other language

I'm doing this in windows there is mac version of squirrel too, I don't know about Linux

  1. download nuget package explorer release https://github.com/NuGetPackageExplorer/NuGetPackageExplorer/releases
  2. open nuget package explorer and add this directory 'lib/net45' it doesn't matter you have a .net app or not, I did this for my qt application otherwise it won't work.
  3. add all files into this folder specify your version in the metadata
  4. save nupkg file
  5. download squirrel release https://github.com/Squirrel/Squirrel.Windows/releases
  6. add squirrel to windows environment path
  7. open cmd and cd to directory of nupkg file
  8. squirrel --releasify file_name.nupkg -> now inide releases folder, there should be setup.exe file which will install app and other files.
  9. to create new version do 2,3,4,7,8 again if its an update it will create delta file which is only needed file to update, put this files into your service directory for example in updates folder of your website which you need to disable directory browsing in IIS , and to auto-update application you need to call Update.exe which is in parent folder of application root directory appdir/../update.exe --update http://yourserver.com/upates/ after application restart app should start with new version
  10. you can find documentation for squirrel in https://github.com/Squirrel/Squirrel.Windows/blob/develop/docs/getting-started/0-overview.md and nuget package explorer here https://github.com/NuGetPackageExplorer/NuGetPackageExplorer and you can use only nuget.exe too if you don't want to use nuget package explorer which can be used for dynamic generation of versions, which can be download from https://www.nuget.org/downloads

That easy. Now you have auto-update app which will download updates from the server and auto-update app. For more info you can read documentations.
note: for iis uses https://github.com/Squirrel/OldSquirrelForWindows/issues/205

Vitreous answered 17/8, 2019 at 7:27 Comment(0)
P
1

I suggest you read on plugin and how to create and use them. If your application architecture is modular and be split into different plugins. Take a look at Google Auto Update utility http://code.google.com/p/omaha/. We use this.

Pterosaur answered 16/1, 2010 at 18:46 Comment(0)
D
1

Thibault Cuvelier is writing a tutorial (in French) to develop an updater. I know the explanations are in French (and everyone is not understanding French), but I think this can be readable with a web translator like Google Translate. With this you will have a cross-platform updater, but you need to write it by yourself.

For what I know, the only part of the updater that is explained in the tutorial, is the file downloading part. In the case this can help you, refer to the tutorial, Un updater avec Qt.

I hope that helps.

Douceur answered 17/1, 2010 at 19:55 Comment(1)
I do speak french, so that won't be a problem. However, this tutorial was started 7 months ago, and it still only has part one available, so I doubt it's soon gonna be ready to use "as is".Solidus
R
0

OK, so I guess I take it as a "no (cross-platform) way". It's too bad!

Rojo answered 24/1, 2010 at 15:7 Comment(2)
It really, really is. I end up googling for a "proper" WinSparkle about once a month. One of these days I'm going to just write my own.Hallsy
In fact there is one. Check my answer.Katharina
B
0

I have found a solution that can be automated with built-in self-extracting patches and updates. for windows. I have started using their sdk. take a look at the massive documentation here, https://agersoftware.com/docs/ the sdk is called securesdk and comes with their app, SecureDelta sdk. does a great job on any kind of files, better results than lzma-included delta updaters

Bum answered 28/4, 2021 at 11:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.