Qt Installer framework, uninstalling / updating offline - qt

I'm trying to make an installer using the Qt Installer framework and when an upgrade is available in the software (checked through our rest API), our software will download the new installer and run it.
This should of course uninstall the previous version first, however, it seems just running it will give you "The folder you selected already exists..." error.
I thought using the maintenance tool that is generated would provide a solution, however, it seems that there is no way to run this with a switch to just do the uninstall. It shows up with the dialogue of uninstall, upgrade... which would confuse the users.
Is there a way to get the maintenance tool or otherwise to uninstall the program, so the update can be run?
EDIT:
If this cannot be done, can anyone suggest a good cross platform installer framework?

Do not try to run the installer again, run the maintenancetool.exe to update. You can make a "silent" update by passing a script to the maintenance tool like this:
#echo off
maintenancetool.exe --checkupdates > checkUpdate.txt
findstr /c:"updates" checkUpdate.txt
if %errorlevel% == 0 maintenancetool.exe --script=script.qs
http://doc.qt.io/qtinstallerframework/noninteractive.html

Related

How to run angular 2 application?

I have downloaded angular 2 application from this link:
https://github.com/aravindfz/firstAngular2App
How to run this application?
Which angular cli version install to run angular 2 application?
I tried from some questions stackoverflow but not working properly.guys this question is not duplicate..Please understand.
Anyone can give clear details?
I need step by step procedure.
If you cloned the repo and did nothing else, there are a few things you need to do before you can run the app. Since I don't know how much web development you have done, I'm going to include things some people will think unnecessary.
Install node.js, if you haven't yet. Grab the LTS release from https://nodejs.org/en/. Do not use the "Current" version, because that may not be compatible with Angular just yet. If you have and older version of Node, upgrade. If you already have the LTS version, skip this step.
Now open a new command prompt or terminal and change to the directory where you cloned the repo. To be sure you're in the right place, make sure you can see a file named package.json.
In this command prompt/terminal window, execute this command: npm install. This will download and install all the dependencies (which could rather disturbingly add up to a few hundred Megabytes). You may experience timeout errors if you're behind a corporate proxy server. That's not something you can fix as of 2018. Just connect using something else and try again.
Once everything is installed, you should be able to run the Angular app. Everything I mentioned already only need to be done before you run it the first time. To ensure you are in the right folder, navigate to where your index.html is located and run this command: ng serve. If ng cannot be found, you may need to install it. To do so, execute npm install --save-dev #angular/cli. Now it should work. If not, close your command prompt/terminal window, open a new one and try ng serve again.
Once ng serve is finished compiling, you should be able to view your app by opening http://localhost:4200 in your favourite browser.
And that's it!
Here's a bonus tip: Take the time to work through the official Angular Quick Start. It really is a fantastic guide and will get you skilled up much quicker than just hacking it ever will.
Good luck.

Setup & Deployment Project creates extra Add/Remove Programs Icons

I'm having a weird problem...
I created a basic WinForms app in C# using Visual Studio 2013, and I added a Setup & Deployment project to the solution to build my .msi installer. For the Setup & Deployment Project's properties, I have the DetectNewerInstalledVersion to true, and the RemovePreviousVersions set to true. Then, with every build, I'll increment the version number and let Visual Studio change the ProductCode. Lastly, I'll make sure that the UpgradeCode stays the same.
In this configuration, if users run the .msi with a previous version installed, then it performs an upgrade. Everything works (as in all files are updated to the new versions, etc.). But, when they open Add/Remove Programs, the icon for the old version(s) is still there, as well as the icon for the new version.
For example, if they used the .msi to install MyApp version 1.1, then used the .msi to upgrade to 1.2, then again to 1.3, then MyApp will correctly update to version 1.3, but the user goes to uninstall it in Control Panel->Programs and Features->Uninstall a program, there will be three MyApp icons (one for each version). And to properly uninstall MyApp, they must right-click/uninstall all three. If I delete the old versions from the registry (the usual fix for stale icons), then MyApp will not uninstall correctly. The uninstall will go through the motions without error, but the program files and icons will remain, and the application will still function like normal. To troubleshoot, I've made a series of builds with sequential version numbers, then opened each build's .vdproj file in a text editor to ensure that the ProductCode and PackageCode have been updated, but the UpgradeCode remains the same. They do, so it's not a problem of the UpgradeCode changing. I've also tried deleting the registry keys for the old icons. This gets them out of the Programs and Features uninstall list, but it prevents the program from being properly uninstalled this way, so this isn't an option.
Anybody have any ideas?
This will happen when the first install is (say) Everyone and the upgrade is installed Just me (or vice versa). One type will not upgrade the other, so files will be replaced if installed to the same location, but there will be an entry for each in Programs&Features. They all must be Everyone or Just me to replace previous products.
You can install the upgrade with msiexec /I [path to msi file] /l*v [path to a log file] to see what's going on. If you search for occurrences of FindRelatedProducts you should see something about what it found and if it was the right context.
Note that Visual Studio setups can change the context if you do not have administrator privileges. You might specify an Everyone install but Visual Studio will change that to Just me if you don't have the privileges.
Ok. Weird...
The issue comes from the way that it's run. Once installed, the program checks the network share for a newer .msi, and if it detects one, it downloads it, then launches it with Process.Start and command-line args. The StartInfo.Arguments string looked like:
startInfo.Arguments = "/i \"[MSIPATH]\" /log \"[LOGPATH]\" TARGETDIR=\"[APPPATH]\" /qr+";
I guess someone fat-fingered the UI mode switch at the end. The "/qr+" switch should be "/qb!-". When I changed it, the problem stopped. I don't think that "/qr+" is even a valid switch, so I'm not sure why the install didn't just fail outright??? Anyway, that was the problem should anyone see something similar.
Special thanks to PhilDW for pointing me to the logs. :-)

Run shell process during QT Install Framework and wait for the result

I would like to run some shell commands during using the QT Install Framework in order to recover information required to configure the installation itself (e.g listing the network adapter).
Currently IFW seems to allow one to prepare canned shell operations (addOperation, addElevatedOperation) that run only after the installer configuration process.
I would like, instead, to run them during the installation set-up. E.g. running an operation in one of the installer page and retrieve the result.
Something like:
Component.prototype.pageChanged = function (page) {
if (page === QInstaller.ReadyForInstallation) {
component.runOperation(...)
}
};
QT Installation Framework installer provides a way to solve this issue.
You can use installer.performOperation running a ConsumeOutput operation.
ConsumeOutput allows one to run an external process and store the process output into an installer key.
I would like to run an external process and wait on its result in my
installer based on Qt Installer Framework. How can I do that?
This can be resolved either with native API (Windows example) or with Qt QProcess::WaitOnFinish (more universal). So, likely you need to somehow work around the installer's API with C++ code.

Msi installer stopped working

I previously installed a website on the server by running an msi package and everything worked fine. Now, when I try to run the same msi file (to Repair/Uninstall), I get a message:
When I click Cancel, I get the following message:
Anybody has an idea what happened and how it can be fixed?
I would recommend that you run the MSI with logging enabled. This can be done by using the /l*v C:\mylog.txt switch or by modifying the registry. The log will provide you with more precise information as to what is going wrong during the msi process.
The articles below describe how to enable logging and the logging process in more detail
http://support.microsoft.com/kb/223300
http://technet.microsoft.com/en-us/library/cc759262(v=WS.10).aspx
http://msdn.microsoft.com/en-us/library/aa372847(v=vs.85).aspx
Once you have the log you can use a set of MSI tools like the Orca installer database editor tool on the Windows SDK to correct any issues.
This is the link for Windows 7 SDK which contains the msi tools.
http://www.microsoft.com/en-us/download/details.aspx?id=8279
Sorry for answering my own question, but I found the problem and I want to share the solution:
After I installed the old version on the server, I changed the name of the msi file. Consequently, I could not run the old version to repair/update. I could not even install a newer version over the old version, as the installer needed the old msi to uninstall the old version.
When I changed back the filename of the old version, it allowed me to install the new version.
CONCLUSION: Don't change the name of the msi file after installation.

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

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.
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.
Shameless plug: Fervor, a simple multiplatform (Qt-based) application autoupdater inspired by Sparkle.
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:
Website
GitHub repository
Screenshot:
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.
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.
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.
The blog post Mixing Cocoa and Qt may solve the problem for the Mac platform.
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!
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
download nuget package explorer release
https://github.com/NuGetPackageExplorer/NuGetPackageExplorer/releases
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.
add all files into this folder specify your version in the metadata
save nupkg file
download squirrel release https://github.com/Squirrel/Squirrel.Windows/releases
add squirrel to windows environment path
open cmd and cd to directory of nupkg file
squirrel --releasify file_name.nupkg -> now inide releases folder, there should be setup.exe file which will install app and other files.
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
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
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.
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.
OK, so I guess I take it as a "no (cross-platform) way". It's too bad!
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

Resources