This question is related to the question qt application with autoupdate feature. The answer is very helpful for using on Windows or Linux.

The problem starts when using the same customizing project for both Windows and OSx. I added 'if' - 'elseactionlist' with a platform checking test. This works fine; OSx gets its own update actions to perform.

The problem is that the OSx distributable is packaged in a tgz file or, if wanted, a dmg. Never the app itself. So, more actions must be performed. Unpacking the tgz or mounting the dmg and then executing the installer with the name …?

Any suggestions how to accomplish this?

asked 01 May '12, 10:25

Eelco-Peacs's gravatar image

Eelco-Peacs
1112
accept rate: 0%


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>
link

answered 04 May '12, 03:22

juanjo's gravatar image

juanjo ♦♦
5.8k413
accept rate: 23%

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>
link

answered 23 May '12, 09:48

Eelco-Peacs's gravatar image

Eelco-Peacs
1112
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×92
×52
×9

Asked: 01 May '12, 10:25

Seen: 2,464 times

Last updated: 23 May '12, 09:48