qt application with autoupdate feature and OSx

Comments

2 comments

  • Avatar
    juanjo

    You could add some more code to differentiate the file type to uncompress by checking the extension using regular expressions and executing the appropriate command in each case but that will be tricky. The recommended approach is to create a tgz of a zip with the application bundle directly packed inside (without the dmg). Then you can place the below code to you <postupdatedownloadactionlist>:

     <postUpdateDownloadActionList>
         <!-- Create an unique directory to untar -->
         <createTimeStamp format="${update_download_location}/%s" variable="identifier"/>
         <setInstallerVariable name="temporaryDir" value="{update_download_location}/${identifier}"
         <createDirectory path="${temporaryDir}"/>
    
         <!-- Untar the OS X installer -->
         <runProgram>
            <program>tar</program>
            <programArguments>xvf ${downloadedFilePath} -C ${temporaryDir}</programArguments>
         </runProgram>
    
         <!-- assuming you know the name of your installer: autoupdate-osx.app -->
         <!-- Launch it in background and exit the autoupdate -->
         <runProgram>
            <program>${temporaryDir}/autoupdate-osx.app/Contents/MacOS/installbuilder.sh</program>
            <programArguments>&amp;</programArguments>
         </runProgram>
    
     </postUpdateDownloadActionList>
    
  • Avatar
    Eelco-Peacs

    The problem is that we have is that the version number is part of the installer application name (default behaviour) and we didn't see any reason to change that. I took your code above and tried to find the name of the installer app. The result works for us now.

    <postUpdateDownloadActionList>
        < !-- Launch the installer -- >
        < !-- On Windows Vista and later the UAC (User Account Control) may prevent execution of the installer
             without a good explenation. To overcome this problem we have create the autoupdate application with
             execution level set to 'asInvoker' and the installer with default (administrator) level and start
             the installer using the command prompt to let the system UAC check the needed rights -- >
        <if>
            <actionList>
                <runProgram>
                    <program>cmd</program>
                    <programArguments>/c start "${downloadedFilePath.dos}" &amp;</programArguments>
                </runProgram>
            </actionList>
            <conditionRuleList>
                <platformTest>
                    <type>windows</type>
                </platformTest>
            </conditionRuleList>
            <elseActionList>
                <!-- Create an unique directory to untar -->
                <createTimeStamp format="${update_download_location}/%s" variable="temporaryDir"/>
                <createDirectory path="${temporaryDir}"/>
                <runProgram>
                    <program>tar</program>
                    <programArguments>xvf "${downloadedFilePath}" -C "${temporaryDir}"</programArguments>
                    <onErrorActionList>
                        <showInfo>
                            <text>Error while unpacking the installer</text>
                        </showInfo>
                    </onErrorActionList>
                </runProgram>
                <findFile>
                    <baseDirectory>${temporaryDir}</baseDirectory>
                    <pattern>installbuilder.sh</pattern>
                    <variable>installer_app</variable>
                    <onErrorActionList>
                        <showInfo>
                            <text>Error retrieving the installer name</text>
                        </showInfo>
                    </onErrorActionList>
                </findFile>
                <runProgram>
                    <program>${installer_app}</program>
                    <programArguments>&</programArguments>
                    <onErrorActionList>
                        <showInfo>
                            <text>Error while running the installer</text>
                        </showInfo>
                    </onErrorActionList>
                </runProgram>
            </elseActionList>
        </if>
    </postUpdateDownloadActionList>
    

Please sign in to leave a comment.