Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Solved Qt Installer Framework

    Tools
    3
    5
    1999
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Q
      qpmr last edited by qpmr

      Hi, i am trying to execute some bash script when Uninstaller finished.(Ubuntu 14.04)

      function Controller() {
          if (installer.isUninstaller()) {
      
          	installer.setDefaultPageVisible(QInstaller.Introduction, false);
              installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
              installer.setDefaultPageVisible(QInstaller.LicenseCheck, false);
      
              //Script successfull start 
              installer.executeDetached("@TargetDir@/script.sh","param");     
          }
      }
      
      Controller.prototype.FinishedPageCallback = function()
      {
      		// Message appear when Installer or Uninstaller finish
      		var result = QMessageBox["question"]("test.quit", "Installer",
              "Complete.", QMessageBox.Ok | QMessageBox.Cancel);
      
      	if (installer.isUninstaller()) {
      
      		// Message appear when Uninstaller finish
      		var result = QMessageBox["question"]("test.quit", "Installer",
              "Uninstall complete.", QMessageBox.Ok | QMessageBox.Cancel);
      
      		// Script don't start!
      		installer.executeDetached("@TargetDir@/script.sh","param");
      		// also don't work 
      		installer.execute("@TargetDir@/script.sh","param");
      	}	
      

      Why i can't starting my script in finished page callback?

      1 Reply Last reply Reply Quote 0
      • mrjj
        mrjj Lifetime Qt Champion last edited by mrjj

        Hi
        I assume the QMessageBox is shown so we know for sure that the code is
        executed?

        Are you sure that @TargetDir@ will be expanded?
        I think its not. It must be full path or script.sh must be place in folder that is path of "path" for OS and
        simply be called with
        installer.execute("script.sh","param");

        Where does @TargetDir@ come from ?
        It is a environment variable?

        also, you should hook up
        http://doc.qt.io/qt-5/qprocess.html#errorOccurred
        and see what error code is - if any.

        Also,
        the "param" is normally a QStringList, not just a string. Not sure if issue.
        installer.execute("script.sh", QStringList() << "param");

        HojjatJafary 1 Reply Last reply Reply Quote 0
        • Q
          qpmr last edited by

          My script wasn't execute because the uninstaller delete his folder)

          mrjj 1 Reply Last reply Reply Quote 2
          • mrjj
            mrjj Lifetime Qt Champion @qpmr last edited by

            @qpmr
            HeHe well that kinda complicates it for QProcess :)

            1 Reply Last reply Reply Quote 0
            • HojjatJafary
              HojjatJafary @mrjj last edited by

              Hi,
              @mrjj

              Where does @TargetDir@ come from ?
              It is a environment variable?
              

              it is a predefined variable you can find a list of them in the following link:

              http://doc.qt.io/qtinstallerframework/scripting.html#predefined-variables

              1 Reply Last reply Reply Quote 1
              • First post
                Last post