Autoupdate installers in unattended mode
| Author: BitRock Support Date: January 06, 2010 15:13 Tags: |
Upgrade Installers
|
Autoupdate installer can be executed in unattended mode as regular InstallBuilder installers does but depending on additional command line flags, it behavior varies:
- * Regular unattended mode:
autoupdate-linux.bin --mode unattended
In this mode, the autoupdate is executed as a checker. It will return a '0' exit code if it finds a new update and a positive integer otherwise. The snippet below shows how to use it from an InstallBuilder installer which bundled the autoupdate:
You can find additional information about how to unpack files in this article<project> ... <initializationActionList> <showQuestion default="yes" text="Would you like to check for updates?" variable="checkforupdates" /> <actionGroup> <actionList> <!-- Once we have unpacked the bundled autoupdate and update.ini to some folder, like /tmp/autoupdate --> <runProgram> <program>/tmp/autoupdate/autoupdate-linux.bin</program> <programArguments>--mode unattended</programArguments> </runProgram> <showInfo text="An update is available!"> <ruleList> <isFalse value="${program_exit_code}" /> </ruleList> </showInfo> <showInfo text="Sorry, no update is available..."> <ruleList> <compareText text="${program_exit_code}" value="0" logic="does_not_equal" /> </ruleList> </showInfo> </actionList> <ruleList> <compareText text="${checkforupdates}" value="yes" logic="equals" /> </ruleList> </actionGroup> </initializationActionList> ... </project>
- * Download unattended mode:
autoupdate-linux.bin --mode unattended --unattendedmodebehavior download
The default unattendedmodebehavior is "check" so it can be omitted. If instead of only check for updates you want to download and install the update, the unattendedmodebehavior has to be set to "download".
As we already mentioned, a '0' return code means "An update is available" and "No update available" otherwise but in some scenarios we need more information. To provide this information, the Autoupdate uses the below summarized return codes:
- * 0 : Successfully downloaded and executed the installer.
- * 1 : No updates available
- * 2 : Error connecting to remote server or invalid XML file
- * 3 : An error occurred downloading the file
- * 4 : An error occurred executing the downloaded update or evaluating its <postUpdateDownloadActionList>
- * 5 : Update check disabled through check_for_updates setting
Return codes 0, 1, 2 and 5 are common for both modes while 3-4 are exclusive to 'download' mode.
When launching the Autoupdate from a Windows cmd, as it is compiled as a GUI application, it will launch it in background, reporting 0 as the exit code if the file can be executed. To force the cmd to wait for the process to finalize and retrieve the correct code returned by the Autoupdate it should be launched as:
cmd /W /C autoupdate-windows.exe --mode unattended
This is not necessary if the Autoupdate is launched from a BitRock installer using aaction.
If no errors occurs in the process this will download and install the update. However, if the update is a big file you may want to show some feedback. To achieve it you can add--unattendedmodeui minimalor--unattendedmodeui minimalWithDialogsto the command line options. This will display a download progress bar as displayed in the image:
autoupdate-linux.bin --mode unattended --unattendedmodebehavior download --unattendedmodeui minimalWithDialogs
