Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt Installer Framework and sh-scripts


  • Moderators

    Hello everyone,

    I try to deploy an App with the Qt InstallerFramework across platforms.

    For MacOS I run into a bit of an problem.

    The component.addOperation("CreateShortcut"...) is not supported and there seems to be no alternative. Pls correct me if I'm wrong here.

    So I created a script make-alias.sh

    #!/bin/bash
    osascript <<END_SCRIPT
    tell application "Finder" to make alias file to file (posix file "$1") at desktop
    END_SCRIPT
    

    this is shipped with my App-Bundle and executed in the Component.prototype.installationFinished = function()

    So far so good, it works as I want it to.

    Using the MaintenanceTool that is created by the Framework and upon selecting

    • Update components
    • Remove all components

    The alias gets not deleted/removed automatically.

    So I created a 2nd simple script remove-alias.sh

    #!/bin/bash
    rm -r ~/Desktop/AppName
    

    But I have no idea where and how to include this in the installerscript.qs. Any help is appreciated.



  • @j-hilk said in Qt Installer Framework and sh-scripts:

    osascript

    In /config/config.xml you specify a control script:

    <ControlScript>deinstallscript.qs</ControlScript>
    

    Then in /config/deinstallscript.qs you invoke the .bash shell script using something like:

    Controller.prototype.uninstallationStartedFunction = function() {
    	try {
    
    		if (systemInfo.kernelType === "winnt") {
    			console.log("Uninstalling on Windows"); 
    
    		} else if (systemInfo.kernelType === "darwin") {
    			console.log("Uninstalling on MacOS");
    
    			//Use a bash to do the linux desktop specific de-installation
    			var args = ["@HomeDir@"];
    		    	installer.executeDetached("@TargetDir@/macUninstall.bash", args);
    
    		} else if (systemInfo.kernelType === "linux"){
    			console.log("Uninstalling on Linux");
    		}
    	} catch(e) {
    		console.log(e);
    	}
    }
    
    function Controller() {
    	installer.uninstallationStarted.connect(this, Controller.prototype.uninstallationStartedFunction);
    }
    

  • Moderators

    hi @myk321

    thanks for the answer, I hadn't the time to test it yet, so I'll leave to topic open for now, but I#ll come back to it later this week.

    I think you've tested this and from what I see your solution seems sounds. Is this bound to a specific version of the QtIFW ? Or has it been there from the beginning?



  • @jhilk: I'm not sure if it's been there since the beginning, but have tested it against the latest version of QtIFW, so 3.1 on MacOs and Ubuntu and 3.0 on Windows.


Log in to reply