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

QtIFW - addOperations only for installation but not update



  • On my installer, when my program is installed it runs the custom configuration application that is installed. However, I only want this program to be run on installation and not during the update process. The update process will be silent, after all. How could this be done?

    Here is an example of what I mean:

    Component.prototype.createOperations = function() {
    	// Call up
    	component.createOperations();
    
    	//console.log( "YEP" );
    
    	if( systemInfo.productType=="windows" ) {
    		/**********
    		* This is the code that I only want to execute during installation and not updating.
    		**********/
    		component.addElevatedOperation( "Execute", "@TargetDir@/config.exe", installer.value( "key" ), installer.value( "hostname" ) );
    		
    		component.addElevatedOperation( "Execute", "@TargetDir@/service.exe", "-install", "UNDOEXECUTE", "@TargetDir@/service.exe", "-uninstall" );
    
    		component.addElevatedOperation( "Execute", "{0,2}", "net", "start", "My Service", "UNDOEXECUTE", "net", "stop", "My Service" );
    
    		// Shortcut to run the connect
    		component.addElevatedOperation( "CreateShortcut", "@TargetDir@/connect.exe", "@StartMenuDir@/My Connect.lnk",
    				"workingDirectory=@TargetDir@");
    
    		// Uninstaller
    		component.addElevatedOperation( "CreateShortcut", "@TargetDir@/maintenancetool.exe", "@StartMenuDir@/Uninstall.lnk",
    				"workingDirectory=@TargetDir@", "description=Uninstall My Connect");
    
    		// Startup
    		component.addElevatedOperation( "CreateShortcut", "@TargetDir@/connect.exe", "@AllUsersStartMenuProgramsPath@/Startup/My Connect.lnk",
    				"workingDirectory=@TargetDir@");
    	}
    	
    	//installer.setCancelled();
    }
    

    Thanks!


Log in to reply