How to execute custom actions after the update installer is downloaded

asked 14 Sep '11, 09:53

Jake's gravatar image

Jake ♦♦
796222226235
accept rate: 98%


The default behavior of the autoupdate is to launch the downloaded installer but sometimes it is needed to perform some validation over the downloaded files, for example to check the integrity of the downloaded data.

The above can be achieved using the <postUpdateDownloadActionList>:

<autoUpdateProject>
  <fullName>Example Project</fullName> 
  <shortName>example</shortName>
  <version>1.0</version> 
  <postUpdateDownloadActionList>
     <!-- Execute some validations here -->
     ...
     <!-- The path to the downloaded update will be stored in the ${downloadedFilePath} built-in variable -->
     <runProgram programArguments="${downloadedFilePath}" program="md5sum" />
     <!-- You can use any action like using httpGet to retrieve a valid value for the md5sum or directly send the md5 to the server to check it -->
     <compareText text="${program_stdout}" value="${someExpectedValue}" logic="equals" />
     ...
     <!-- Launch the installer -->
     <runProgram>
         <program>${downloadedFilePath}</program>
         <programArguments>--prefix /tmp/someDir --enable_component_a 1 --is_update 1 &amp;</programArguments>
     </runProgram>
 </postUpdateDownloadActionList>
</autoUpdateProject>

Please note the usage of the built-in "downloadedFilePath" variable to get the path of the update installer. This is necessary because although we define the update_download_location key in the update.ini file, if an older file with the same name is found there, a suffix if appended to the file name: sample-1.0-windows-installer.exe.1, sample-1.0-windows-installer.exe.2 ...

In addition, we have to manually launch the downloaded file because we have override the default behavior. This is specially useful to launch it in unattended mode or to pass some command line argument as in the example.

If you have installed the autoupdate as part of a regular installation and want the installation directory of the downloaded update to be automatically configured, you can access the current location of the Autoupdate through the built-in variable ${installer_directory}. For example, if you installed the Autoupdate under ${installdir}:

  <postUpdateDownloadActionList>
     <!-- Launch the installer -->
     <runProgram>
         <program>${downloadedFilePath}</program>
         <programArguments>--prefix "${installer_directory}/.."  &amp;</programArguments>
     </runProgram>
 </postUpdateDownloadActionList>
link

answered 14 Sep '11, 09:57

Jake's gravatar image

Jake ♦♦
796222226235
accept rate: 98%

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:

×31
×22
×19
×13

Asked: 14 Sep '11, 09:53

Seen: 1,563 times

Last updated: 14 Sep '11, 09:57