Using from Command Line | Qt Installer Framework Documentation 4.11.0

- Qt Installer Framework Documentation
- Using from Command Line
- Qt Installer Framework 4.11.0

Specifying Settings ◦ Tutorial: Creating an Installer

# Using from Command Line

Qt Installer Framework 4.0.0 introduces a new command line interface workflow. Most of the end user use cases can now be performed using a text based interface, either interactively, or unattended by specifying the desired options beforehand. This topic describes the basic use cases. For more information about the syntax and a description of all supported options, see Command Line Interface.

## Installing Components

Both the installer and the maintenance tool support installation of new components from command line. The following will install the components given as an argument and their respective dependencies:

     maintenancetool.exe install componentA componentB componentC

If no components are specified, the default set of components will be installed instead. This includes components with elements `<Default>` or `<ForcedInstallation>` set to `true`. The default installation can be only done with an installer binary. The `--root` option can be used to select an installation target directory:

     installer.exe --root "C:\Users\MyUser\MyInstallation" install

The install command can be also used for installing component aliases. If component aliases are specified, the aliased components are selected for installation:

     maintenancetool.exe install alias1 alias2

## Checking for Available Updates

To print information about available component updates, run the `check-updates` command with the maintenance tool:

     maintenancetool.exe check-updates

## Updating Components

Running `update` without arguments will update all components that have an update available. Essential and ForcedUpdate components are always updated first, same way as when launching the updater from GUI. After Essential and ForcedUpdate components are updated, the installer needs to be restarted for other updates. To update only a specific subset of installed components, they can be provided as an optional argument for `update`:

     maintenancetool.exe update componentA componentB

## Uninstalling Components

The `remove` command can be used to uninstall selected components. This will automatically uninstall their children and other components depending on the components about to be uninstalled:

     // This would also automatically uninstall componentC.subcomponent1, componentC.subcomponent2,...
     maintenancetool.exe remove componentC

## Listing Installed Components

To get a list and print additional information about currently installed components, run the `list` command with the maintenance tool. The command also accepts an optional regular expression argument to filter the shown component list.

     maintenancetool.exe list

## Searching for Available Components

The `search` command can be used to search components from available repositories, or from integrated binary content in case of an offline installer. It can be used with no arguments to list all available components or with a regular expression to get a list of only components matching the pattern.

The `--filter-packages` option can be used to specify additional filters for the search operation. For a list of usable information elements with the option, refer to Summary of Package Information File Elements.

When the value of the `--type` option is set to `package`, the search command will search for available components only:

     installer.exe --type package --filter-packages "DisplayName=MyComponent, Version=1.0" search "expression"

When the `--type` option is omitted, the search command will first search for matching component aliases, and if none are found, component names:

     installer.exe search "expression"

When the value of the `--type` option is set to `alias`, the search command will search for available component aliases only:

     installer.exe --type alias search "expression"

## Performing Full Uninstallation

To uninstall all components and remove the program directory, including maintenance tool, run `purge` command:

     maintenancetool.exe purge

## Creating Custom Offline Installers

To create a personal offline installer containing a selected set of components from online repositories, use the `create-offline` command. This is a useful feature for scenarios where the same installation content will be deployed multiple times or on several machines, as it saves time spent on downloading component archives and enables easily reproducible installations. The `--offline-installer-name` option can be used to set a desired name for the generated offline installer.

Note that you can create offline installers only from online installers with valid repositories enabled.

     installer.exe --root "C:\TargetFolder" --offline-installer-name "MyInstaller" create-offline componentA componentB

When installing with an offline installer, installer creates a maintenance tool to the root of the installation. With an offline installer, you can only uninstall with the generated maintenance tool. In case you want to be able to update the offline installation later on with the maintenance tool, use the option `--hybrid` when creating the offline installer. With the `--hybrid` option, maintenance tool has all the same repositories available as the online installer you used to create the offline installer.

     installer.exe --root "C:\TargetFolder" --offline-installer-name "MyInstaller" create-offline componentA componentB --hybrid

## Clearing the Local Cache

Online installers and maintenance tools created with the Qt Installer Framework cache the meta information downloaded from remote repositories to local disk. This improves loading times for subsequent metadata downloads.

The cache may grow in size over time. To clear the contents of the entire cache, use the `clear-cache` command:

     maintenancetool.exe clear-cache

## Unattended Usage

By default, the generated installers may ask for additional information during installation, which requires user attention. Unattended usage is possible by providing all information beforehand with appropriate options:

     installer.exe --root "C:\MyInstallation" --accept-licenses --default-answer --confirm-command install componentA

In this example, `--accept-licenses` is used to automatically accept all license agreements required by components to be installed. The `--default-answer` option is used to answer all message queries with their default answer. Alternatively, `--accept-messages` and `--reject-messages` can be used to accept or reject all message queries. To provide unique answers for individual queries, for example to confirm overwriting of an existing directory, you could use `--auto-answer OverwriteTargetDirectory=Yes`. Automatic answers are shown on the console output and installation log.

By default, the installer and maintenance tool will print a summary of components to be affected by the command and then ask for permission to continue performing the action, to prevent accidental changes. For unattended usage, this can be skipped by using the `--confirm-command` option.

Specifying Settings ◦ Tutorial: Creating an Installer