1 comment

  • Avatar

    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:

           <showQuestion default="yes" text="Would you like to check for updates?" variable="checkforupdates" />
                 <!-- Once we have unpacked the bundled autoupdate and update.ini to some folder, like /tmp/autoupdate -->    
                    <programArguments>--mode unattended</programArguments>
                 <showInfo text="An update is available!">
                       <isFalse value="${program_exit_code}" />
                 <showInfo text="Sorry, no update is available...">
                       <compareText text="${program_exit_code}" value="0" logic="does_not_equal" />
                 <compareText text="${checkforupdates}" value="yes" logic="equals" />

    You can find additional information about how to unpack files in this article

    * 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 a action.

    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 minimal or --unattendedmodeui minimalWithDialogs to 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

    Progress bar

Please sign in to leave a comment.