This question is about version 2.0 of the Qt Installer Framework.
At this point, it is common knowledge for people using the Qt Installer Framework that, without customization, you simply can't overwrite an existing installation through your installer. This was apparently done to resolve some issues that occurred when this was done with the Qt framework.
However, for smaller, relatively simple projects, overwriting is perfectly fine and much more convenient than having to manually run the maintenance tool beforehand.
I am looking for a solution involving a custom UI + component script that adds a button to the target directory page that allows the user to either
- Remove the specified directory if it exists, or
- Run the maintenance tool in that directory.
It would be preferable to be able to run the maintenance tool in the target directory, having it automatically remove a given package, but I realize that that is asking for a little too much.
I have read answers to other questions on this site about solving the same problem, but none of the solutions work correctly. I would also like to mention that I have a component script up and running, but no custom UIs.
There are few things you need to do:
To get past of TargetDirectoryPage which you can achieve by adding this code
installer.setValue("RemoveTargetDir", false)
Custom UI (or message box) that allow you to to run this code. This UI should be inserted after the TargetDirectoryPage.
// you need to append .exe on the maintenance for windows installation installer.execute(installer.findPath(installer.value("MaintenanceToolName"), installer.value("TargetDir")));
I finally found a workable solution.
You need three things to pull this off:
I will now list verbatim what is working for me (with my project specific stuff). My component is called
Atlas4500 Tuner
config.xml:
packages/Atlas4500 Tuner/meta/package.xml:
custom component script packages/Atlas4500 Tuner/meta/installscript.qs:
Custom target directory widget packages/Atlas4500 Tuner/meta/targetwidget.ui:
packages/Atlas4500 Tuner/data/scripts/auto_uninstall.qs:
The idea here is to detect if the current directory has an installation in it or not, and, if it does, run the maintenance tool in that directory with a controller script that just clicks through it.
Note that I put the controller script in a scripts directory that is part of the actual component data. You could probably do something cleaner if you have multiple components, but this is what I am using.
You should be able to copy these files for yourself and just tweak the strings to make it work.