Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. QtIF: Extract Update sequence
Forum Updated to NodeBB v4.3 + New Features

QtIF: Extract Update sequence

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
12 Posts 3 Posters 1.9k Views
  • 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.
  • S Offline
    S Offline
    Schenk
    wrote on last edited by
    #1

    Hi,

    i would like to know what is the correct sequence of extracting new contents.
    I have an update and will updat emy installer via maintenance-tool. If i update a specific component, i have to stop a process so that is possible to update this component.

    The Update mechnism used the normal function?

    Component.prototype.createOperations = function()
    
    

    In https://doc.qt.io/qtinstallerframework/scripting.html#adding-operations-to-components :
    You might want to add custom operations after extracting the content, when copying files or patching file content, for example. You can create and add update operations to the installation from within a script using component::addOperation(). If you need to run an operation that requires administrative rights, use component::addElevatedOperation() instead.

    I do not really understand these sentences:
    Operations need to be added before the actual installation step. Override component::createOperations() to register custom operations for a component.
    These are two differnet senteces, because i implement my implementation logic AFTER extracting in createOperations.

    So i would like to know, how to this Operations need to be added before the actual installation step.

    What if i the content, e.g. a foo.exe, is delivered to a path, where the foo.exe is still used and have to be stopped before?
    When and where in the code i have to call these methods before the new content is delivered?

    function Component()
    {}
    
    
    Component.prototype.createOperations = function()
    {
            component.createOperations();		
    
    	if(installer.isUpdater())
    	{		
    		if(component.updateRequested())
    		{
    			// stop here the processes BEFORE the normal installation?!?!?!?
    		}		
    	}
    	else 
    	{	
    		// Installer AND Uninstaller and Updater-function?!
    	}
    		
    }
    
    
    Component.prototype.createOperationsForArchive = function(archive) {		
    	component.addOperation("Extract", archive, "@TargetDir@/foo");
    }
    

    Thank you for your help in advance.

    1 Reply Last reply
    0
    • AndySA Offline
      AndySA Offline
      AndyS
      Moderators
      wrote on last edited by
      #2

      Hi @Schenk,

      Can you clarify a bit as to what you mean here, I am not entirely sure what you need to achieve, so if you could give a scenario then I can understand a bi better. Thanks.

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

      S 1 Reply Last reply
      0
      • AndySA AndyS

        Hi @Schenk,

        Can you clarify a bit as to what you mean here, I am not entirely sure what you need to achieve, so if you could give a scenario then I can understand a bi better. Thanks.

        S Offline
        S Offline
        Schenk
        wrote on last edited by
        #3

        @AndyS Hi Andy,

        I want to stop my process, install/extract the content by the installer/updater and restart my process.

        i have an installation with an already running process. The update should update this process, which have to be stopped before it can be updated. When i want to update my installation with the maintanance.exe the log says, that this process should be stopped first of all and then retry. My problem is wehre to put these "Stopping"-routine in the script.

        I already tried:

        function Component()
        {}
        
        
        Component.prototype.createOperations = function()
        {
                component.createOperations();		
        	// STOP HERE - DOES NOT WORK!	
        }
        
        
        Component.prototype.createOperationsForArchive = function(archive) {		
               // STOP HERE - DOES NOT WORK!
        	component.addOperation("Extract", archive, "@TargetDir@/foo");
        }
        
        1 Reply Last reply
        0
        • S Offline
          S Offline
          Schenk
          wrote on last edited by
          #4

          Ok, issue solved. This behaviour is not described in the so-called documentation.
          You have to overwrite the beginInstallation-Method and there you can do whatever you want to do before the extraction of the new content.

          A good hint was the package installation script of the Qt Creator setup. There are serveral good hints which are not described in the api documentation.

          1 Reply Last reply
          1
          • AndySA Offline
            AndySA Offline
            AndyS
            Moderators
            wrote on last edited by
            #5

            I am glad that you have been able to solve it. I agree that the documentation needs some updating and this is something I am hoping to improve on at some point over the next weeks or so.

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

            1 Reply Last reply
            1
            • S Offline
              S Offline
              Schenk
              wrote on last edited by
              #6

              It is not the solution. At the beginning of the update mechinsm the beginInstasllation method is called, but no component-methods. The first method called is the UNDOEXECUTE routine.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                Schenk
                wrote on last edited by
                #7

                The createOperatiosn method is executed backwards and it is exeuted the UNDOEXECUTE routine. So, is there no way than put my "routine" in the UNDO ECUTE of the installer for the update?

                RatzzR 1 Reply Last reply
                0
                • S Schenk

                  The createOperatiosn method is executed backwards and it is exeuted the UNDOEXECUTE routine. So, is there no way than put my "routine" in the UNDO ECUTE of the installer for the update?

                  RatzzR Offline
                  RatzzR Offline
                  Ratzz
                  wrote on last edited by Ratzz
                  #8

                  @Schenk
                  have you tried setStopProcessForUpdateRequest(string process, boolean requested) ?
                  https://doc.qt.io/qtinstallerframework/scripting-component.html#setStopProcessForUpdateRequest-method
                  Edit:
                  U can also try to popup an messagebox so that user stops process using stopProcessesForUpdates
                  https://doc.qt.io/qtinstallerframework/noninteractive.html#message-boxes

                  --Alles ist gut.

                  S 1 Reply Last reply
                  0
                  • RatzzR Ratzz

                    @Schenk
                    have you tried setStopProcessForUpdateRequest(string process, boolean requested) ?
                    https://doc.qt.io/qtinstallerframework/scripting-component.html#setStopProcessForUpdateRequest-method
                    Edit:
                    U can also try to popup an messagebox so that user stops process using stopProcessesForUpdates
                    https://doc.qt.io/qtinstallerframework/noninteractive.html#message-boxes

                    S Offline
                    S Offline
                    Schenk
                    wrote on last edited by
                    #9

                    @Ratzz Hi, ratzz,

                    it is a windows service. Apart from stopping the service, maybe i want to save some files before uninstall/updater. But the updater execute the createOperations backwards and then the other stuff. So i need a entry point in the code, that i am able to save my files BEFORE the uninstalling.

                    RatzzR 1 Reply Last reply
                    0
                    • S Schenk

                      @Ratzz Hi, ratzz,

                      it is a windows service. Apart from stopping the service, maybe i want to save some files before uninstall/updater. But the updater execute the createOperations backwards and then the other stuff. So i need a entry point in the code, that i am able to save my files BEFORE the uninstalling.

                      RatzzR Offline
                      RatzzR Offline
                      Ratzz
                      wrote on last edited by
                      #10

                      @Schenk said in QtIF: Extract Update sequence:

                      i want to save some files

                      What sort of file? Why you want to save? currently where you save?

                      --Alles ist gut.

                      S 1 Reply Last reply
                      0
                      • RatzzR Ratzz

                        @Schenk said in QtIF: Extract Update sequence:

                        i want to save some files

                        What sort of file? Why you want to save? currently where you save?

                        S Offline
                        S Offline
                        Schenk
                        wrote on last edited by
                        #11

                        @Ratzz Files like config-files. I want to save them, because the application should run like before with the same config-files etc.

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          Schenk
                          wrote on last edited by
                          #12

                          I tried to copy the files which i want to save before the uninstallation/update via UNDOEXECUTE, but there is no chance to save this files. They dissapear. Even if iy try the xcopy, xcopy etc., no file get saved.

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved