问题
I'm trying to write my first Qt installer and having trouble. In my installer, in one of the packages, I need to run an .exe
file at the end of the installation and add an environment variable as well.
I think the way to do it is with the script option in the package.xml
file but I don't know how to write that script, I cannot find a step by step explanation of how to do it anywhere.
Can someone help?
回答1:
I have been recently suffering the same fate as yourself but have managed, for the most part, to achieve what you are trying to do from the Qt installer framework examples and documentation found here http://qt-project.org/doc/qtinstallerframework-1.5/index.html and http://doc.qt.io/qtinstallerframework/qtifwexamples.html.
The information provided on these pages is a little ambiguous but with a little experimentation you should be able to create the install script that you require.
The package.xml file you would like to implement the install script requires that you add a
<Script>installscript.qs</Script>
tag and that the installscript.qs
its self should be located in the meta folder of that package. The installscript.qs
will then contain, among a few other things, a
component.addOperation("Execute".....)
command which will execute your required .exe
. The same process for the environment variable could be implemented using the execute operation to run a batch file which creates the variable on the users system.
I have been trying over the last few weeks to implement the custom operations detailed in the qt installer framework documentation but have so far been unsuccessful so if you make any progress in this area feel free to pass the information on ;)
来源:https://stackoverflow.com/questions/19422317/how-to-write-the-scripts-for-qt-installer