Skip to content
  • 0 Votes
    1 Posts
    188 Views
    No one has replied
  • 0 Votes
    1 Posts
    521 Views
    No one has replied
  • 0 Votes
    3 Posts
    1k Views
    M

    This is my take. Please comment back if you find a better way. Suggest you use a separate script for installation and de-installation and take care of both the application and maintenance tool together. There are 3 is steps involved:
    Step 1. Creating the scripts to be run on installation and de-installation
    Step 2. Including the scripts into the installation bundle
    Step 3. Modifying the installations and de-installation process to invoke the scrips at the appropriate time

    Step 1: Creating the Scripts
    Step 1a: Creating the Installation Scripts
    The installation scripts can perform the following actions:
    a. Create .desktop files for the application and the maintenance tool
    b. Move the icons to the appropriate location
    c. Use the gnome tool gio to associate the icon with the application and maintenance tool
    b. Add the new application to favourites

    The following is called linuxInstall.bash and is located in my ~/pkg folder

    #------Start of the installation script #!/bin/bash #Get the location of the script = location of executables and icons SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") #Work out the destination file locations ICONDESTINATION=$1"/.local/share/icons/hicolor/48x48/apps/MyApp.png" MYAPPDESKTOP=$1"/.local/share/applications/MyApp.desktop" MyAPPMAINTDESKTOP=$1"/.local/share/applications/MyAppMaintenance.desktop" #Move the icon mv $SCRIPTPATH/MyApp.png $ICONDESTINATION #Write out the MyApp.desktop file echo "[Desktop Entry]" >> $MyAppDESKTOP echo "Version=0.1" >> $MyAppDESKTOP echo "Name=MyApp" >> $MyAppDESKTOP echo "Comment=Does super important stuff" >> $MyAppDESKTOP echo "Exec=$SCRIPTPATH/MyApp" >> $MyAppDESKTOP echo "Icon=$ICONDESTINATION">> $MyAppDESKTOP echo "Terminal=false" >> $MyAppDESKTOP echo "Type=Application" >> $MyAppDESKTOP echo "Categories=Utility" >> $MyAppDESKTOP #Write out the MyAppMaintenance.desktop file echo "[Desktop Entry]" >> $MYAPPMAINTDESKTOP echo "Version=0.2" >> $MYAPPMAINTDESKTOP echo "Name=MyApp Maintenance Tool" >> $MYAPPMAINTDESKTOP echo "Comment=Install, update and delete MyApp" >> $MyAppMAINTDESKTOP echo "Exec=$SCRIPTPATH/MyAppMaintenanceTool --updater" >> $MyAppMAINTDESKTOP echo "Icon=$ICONDESTINATION">> $MyAppMAINTDESKTOP echo "Terminal=false" >> $MyAppMAINTDESKTOP echo "Type=Application" >> $MyAppMAINTDESKTOP echo "Categories=Utility" >> $MyAppMAINTDESKTOP #Associate the icon with the executable gio set $SCRIPTPATH/MyApp metadata::custom-icon file://$ICONDESTINATION #Add MyApp application to favourites FAVORITES=$(gsettings get org.gnome.shell favorite-apps) NEWFAVOURITES=${FAVORITES::-1}", 'MyApp.desktop']" dconf write /org/gnome/shell/favorite-apps "$NEWFAVOURITES" #------End of the installation script

    Once you have create this script test and debug. Copy it to the install directory manually and then invoke it from the command line with one parameter being you home directory. This might looks something like:
    /home/me/MyApp>./linuxInstall.bash /home/me

    Step 1b: Creating the deinstallation script

    #------Start of the de-installation script #!/bin/bash #Get the location of the script = location of executables and icons SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") #Work out the destination file locations MYAPPICON=$1"/.local/share/icons/hicolor/48x48/apps/MyApp.png" MYAPPDESKTOP=$1"/.local/share/applications/MyApp.desktop" MYAPPMAINTDESKTOP=$1"/.local/share/applications/MyAppMaintenance.desktop" #Remove MyApp application from favourites FAVORITES=$(gsettings get org.gnome.shell favorite-apps) NEWFAVOURITES=${FAVORITES/", 'MyApp.desktop']"}"]" dconf write /org/gnome/shell/favorite-apps "$NEWFAVOURITES" #Remove the files rm $MYAPPICON rm $MYAPPDESKTOP rm $MYAPPMAINTDESKTOP #------End of the de-installation script

    As for the installation script make sure you debug the deinstallation script and get it working correctly.

    NEXT STEP: I have not checked this deinstallation script in detail and in particular worry that removing the MyApp from the end of the favourites list will fail if additional favourites are added when MyApp is removed.

    Step 2. Including the scripts into the installation bundle
    I have a separate script that creates the .7z file in the data folder. At a high level it:
    a. Creates a tmp directory off ~/pkg
    B. Copies the MyApp executable, qt .so's the installation and de-installation scripts above and the icon.png into the tmp directory
    c. Uses the archive tool to create the .7z file
    d. Copies the .7z file to the data folder
    e. Removes the tmp directory
    f. Creates the installer
    g. Creates the download archive

    If you don't already have something similar, I'd suggest you create a script to do this - my experience is it takes quite a few iterations to get this right and the script really helps

    Once you've included the .bash scripts into the .7z file, when you run the installer you should find both the installation and deinstallation scripts in the install directory and invoking them manually from the command line should complete the gnome installation and de-installation as expected.

    Step 3. Modifying the installations and De-installation process
    In this final step we get the QT IFW to invoke the installation and deinstallation scripts automatically.

    Step 3a. Modifying the installation process
    In the meta directory in the package.xml file you need the following line:
    <Script>controller.qs</Script>

    Then in the meta directory create a file called controller.qs with something like the following content:

    //------Start of the controller.qs script Component.prototype.installationFinishedPageIsShown = function() { try { if (installer.isInstaller() && installer.status == QInstaller.Success) { var message = "Installation got systemInfo.kernelType == " + systemInfo.kernelType; console.log(message); if (systemInfo.kernelType === "winnt") { //Windows console.log("Installing MyApp on Windows"); } else if (systemInfo.kernelType === "darwin") { //macOS console.log("Installing MyApp on MacOS"); } else if (systemInfo.kernelType === "linux"){ console.log("Installing MyApp on Linux"); //Use a bash to do the linux desktop specific setup var args = ["@HomeDir@"]; installer.executeDetached("@TargetDir@/linuxInstall.bash", args); } else { cancelInstaller("MyApp installers are available for Windows, MacOS and Linux only."); return; } } } catch(e) { console.log(e); } } function Component() { installer.installationFinished.connect(this, Component.prototype.installationFinishedPageIsShown); } //------End of the controller.qs script

    Step 3b. Modifying the de-installation process
    In the config directory in the config.xml file you need the following line:
    <ControlScript>deinstallscript.qs</ControlScript>
    Then in the config directory create a file called deinstallscript.qs with something like the following content:

    //------Start of the deinstallscript.qs script Controller.prototype.uninstallationStartedFunction = function() { try { var message = "Uninstallation got systemInfo.kernelType == " + systemInfo.kernelType; console.log(message); if (systemInfo.kernelType === "winnt") { //Windows console.log("Uninstalling MyApp on Windows"); } else if (systemInfo.kernelType === "darwin") { //macOS console.log("Uninstalling MyApp on MacOS"); } else if (systemInfo.kernelType === "linux"){ console.log("Uninstalling MyApp on Linux"); //Use a bash to do the linux desktop specific de-installation var args = ["@HomeDir@"]; installer.executeDetached("@TargetDir@/linuxUninstall.bash", args); } } catch(e) { console.log(e); } } function Controller() { installer.uninstallationStarted.connect(this, Controller.prototype.uninstallationStartedFunction); } //------End of the deinstallscript.qs script

    I know the .qs scripts to install and de-install look similar, but note the use of 'Component' in controller.qs, but the use of 'Controller' in deinstallscript.qs.

    Some final thoughts:

    The gnome script assume the user has installed MyApp for the current user only. I believe this is an appropriate default, but it might be nice if there was a check-box that allowed the user to specify if the application is for all users and acquired the admin right required. The paths where things are placed will need to be updated. I spent some time looking for how to detect gnome vs KDE, but all methods seemed error prone. My current through is just to check if gio is present and if so do a gnome install, but haven't gotten around to adding it yet. You can use ldd to check which qt .so's you application depends on. It might be nice to do this as part of the packing script.
  • 1 Votes
    3 Posts
    2k Views
    H

    I wonder if you ever found an answer to this issue ?

    I have a similar requirement, in that I want to create an online installer that works both ways. It needs to be able to be run in "download-only" mode (no installation, just download the repo). Then my client's IT dept can have a copy of the repo to put on their server, and their users (some of whom don't have internet access) can do a local installation from their local repo.

    It seems that most of the functionality exists:

    The offline installer will create a local repo if asked to (CreateLocalRepository in config.xml). This could then be relocated to their server. The online installer can be forced to act like an offline installer by pointing it the local repo.

    What I can't seem to do is combine 1 and 2 in the same installer. I could create both an offline and an online installer (one for client's IT and one for their users), except that I cannot package all components into the offline installer because some are licensed, and the client should only have access to the components that they have a licence for.

  • 0 Votes
    5 Posts
    1k Views
    O

    @luca Thank you for your answer, the problem has been solved

  • 0 Votes
    2 Posts
    2k Views
    4

    @4j1th I can only update through the maintenance tool.
    I restarted the system and run the app I don't get the update.

  • 0 Votes
    6 Posts
    25k Views
    X

    hello..
    I solved the problem by installing dependencies as described in below link.
    https://web.stanford.edu/dept/cs_edu/resources/qt/install-linux
    my OS is Xubuntu 20.04

  • 0 Votes
    6 Posts
    2k Views
    SGaistS

    What's the KDE specific problem ?

  • 0 Votes
    2 Posts
    2k Views
    E

    I figured out, that QSslSocket::supportsSsl() returns false due to lack of the OpenSSL installation.
    Adding OpenSSL dlls to the installer dir solved this problem and starts another:
    How to distribute the installer, which depends on OpenSSL dlls?

  • 0 Votes
    2 Posts
    3k Views
    j1eloJ

    Solution:

    Controller.prototype.IntroductionPageCallback = function() { // Installer is "updater" when it is run with "--updater" // or Controller does "installer.setUpdater()" if (installer.isUpdater()) { var widget = gui.currentPageWidget(); // Same as gui.pageById(QInstaller.Introduction); widget.findChild("UpdaterRadioButton").checked = true; // Disable paint events on these widgets, through the QWidget::updatesEnabled property. // I tried with the "visible" property, but it is not enough, because for some reason // that property gets reset under some conditions. For example, if "Next" button is pressed // and no updates are available. widget.findChild("PackageManagerRadioButton").updatesEnabled = false; widget.findChild("UninstallerRadioButton").updatesEnabled = false; } }
  • 0 Votes
    1 Posts
    805 Views
    No one has replied