Qt Installer Framework创建在线安装程序

Creating Online Installers

创建在线安装程序

Online installers fetch the repository description (Updates.xml), in addition to the one stored inside of the binary. Create a repository and upload it to a web server. Then specify the location of the repository in the config.xml file that you use to create the installer.

除了存储在二进制文件中的描述外,在线安装程序还会获取存储库描述(Updates.xml)。创建一个存储库并将其上传到web服务器。然后在用于创建安装程序的config.xml文件中指定存储库的位置。

Creating Repositories

创建存储库

Use the repogen tool to create online repositories of all packages of one package directory:

使用repogen工具创建一个包目录中所有包的在线存储库:

repogen.exe -p <package_directory> <repository_directory>

For example, to create a repository that contains only org.qt-project.sdk.qt and org.qt-project.sdk.qtcreator, enter the following command:

例如,要创建仅包含org.qt-project.sdk.qt和org.qt-prject.sdk.qtcreator的存储库,请输入以下命令:

repogen.exe -p packages -i org.qt-project.sdk.qt,org.qt-project.sdk.qtcreator repository

When the repository has been created, upload it to a web server. You must specify the location of the repository in the installer configuration file.

创建存储库后,将其上传到web服务器。必须在安装程序配置文件中指定存储库的位置。

Configuring Repositories

配置存储库

The <RemoteRepositories> element in the installer configuration file (config.xml) can contain a list of several repositories. Each of them can have the following settings:

安装程序配置文件(config.xml)中的<RemoteRepositories>元素可以包含多个存储库的列表。它们中的每一个都可以有以下设置:

  • <Url>, which points to a list of available components.
  • <Url>,指向可用组件的列表。
  • <Enabled>, with 0 disabling this repository.
  • <Enabled>,0禁用此存储库。
  • <Username>, which is used as user on a protected repository.
  • <Username>,在受保护的存储库中用作用户。
  • <Password>, which sets the password to use on a protected repository.
  • <Password>,用于设置在受保护的存储库上使用的密码。
  • <DisplayName>, which optionally sets a string to display instead of the URL.
  • <DisplayName>,它可以选择设置要显示的字符串而不是URL。

The URL needs to point to the Updates.xml file that lists the available components. For example:

URL需要指向列出可用组件的Updates.xml文件。例如:

<RemoteRepositories>
     <Repository>
             <Url>http://www.example.com/packages</Url>
             <Enabled>1</Enabled>
             <Username>user</Username>
             <Password>password</Password>
             <DisplayName>Example repository</DisplayName>
     </Repository>
</RemoteRepositories>

The installer works only if it can access the repository. If the repository is accessed after the installation, the maintenance tool rejects installation. However, uninstallation is still possible. A repository can be enabled or disabled by default. For repositories requiring authentication, the details can also be set here, although entering a password here is usually not advisable as it is saved in plain text. Authentication details not set here will be gotten at runtime using a dialog. The user can work around these settings at runtime.

安装程序只有在可以访问存储库时才能工作。如果在安装后访问存储库,维护工具将拒绝安装。但是,卸载仍然是可能的。默认情况下,可以启用或禁用存储库。对于需要身份验证的存储库,也可以在此处设置详细信息,但通常不建议在此处输入密码,因为它以纯文本形式保存。此处未设置的身份验证详细信息将在运行时使用对话框获取。用户可以在运行时绕过这些设置。

Configuring Repository Categories

配置存储库类别

The <RepositoryCategory> element in the installer configuration file (config.xml) can contain a list of several <RemoteRepositories> elements. Each <RemoteRepositories> element within the <RepositoryCagetory> element is considered a category. Each catecory can have a <DisplayName>, a <Tooltip>, a <Preselected> element and several <Repository> elements. Repository categories are shown in the component selection page, on the left side of the component selection widget:

安装程序配置文件(config.xml)中的<RepositoryCode>元素可以包含几个<RemoteRepositories>元素的列表。<RepositoryCagetory>元素中的每个<RemoteRepositories>元素都被视为一个类别。每个类别可以有一个<DisplayName>、<Tooltip>、一个<Preselected>元素和几个<Repository>元素。存储库类别显示在组件选择页面的组件选择widget左侧:

By default, only repositories with no category are shown in the component selection widget. Checking one or several repositories and pressing Fetch will update the widget to show content also from the selected categorized repositories. Components in the repository categories are marked as unstable meaning that you can install other components although some components have missing dependencies, script errors and so on. For more information about unstable components, see Summary of Configuration File Elements.

​默认情况下,组件选择widget中只显示没有类别的存储库。检查一个或多个存储库并按Fetch将更新widget,以显示所选分类存储库中的内容。存储库类别中的组件标记为不稳定,这意味着可以安装其他组件,尽管某些组件缺少依赖关系、脚本错误等。有关不稳定组件的更多信息,请参阅配置文件元素摘要。

Example of creating a repository category:

创建存储库类别的示例:

<RepositoryCategories>
    <RemoteRepositories>
         <Displayname>Category 1</Displayname>
         <Preselected>true</Preselected>
         <Tooltip>Tooltip for category 1</Tooltip>
         <Repository>
                 <Url>http://www.example.com/packages</Url>
                 <Enabled>1</Enabled>
                 <Username>user</Username>
                 <Password>password</Password>
                 <DisplayName>Example repository</DisplayName>
         </Repository>
    </RemoteRepositories>
</RepositoryCategories>

Creating Installer Binaries

创建安装程序二进制文件

To create an online installer by using the binarycreator tool, enter the following command:

要使用binarycreator工具创建在线安装程序,请输入以下命令:

<location-of-ifw>\binarycreator.exe -t <location-of-ifw>\installerbase.exe -p <package_directory> -c <config_directory>\<config_file> -e <packages> <installer_name>

For example, enter the following command to create an installer binary called SDKInstaller.exe that will not contain data for org.qt-project.sdk.qt and org.qt-project.qtcreator, because those packages are downloaded from a remote repository:

例如,输入以下命令以创建名为SDKInstaller.exe的安装程序二进制文件,该文件不包含org.qt-project.sdk.qt和org.qt-prject.qtcreator的数据,因为这些包是从远程存储库下载的:

binarycreator.exe -p installer-packages -c installer-config\config.xml -e org.qt-project.sdk.qt,org.qt-project.qtcreator SDKInstaller.exe

Reducing Installer Size

减小安装程序大小

Even if the components are fetched from a web server, binarycreator adds them to the installer binary by default. However, when the installer checks the web server for updates, end users are spared a download if new versions are not available.

即使组件是从web服务器获取的,默认情况下binarycreator也会将它们添加到安装程序二进制文件中。但是,当安装程序检查web服务器是否有更新时,如果新版本不可用,最终用户可以免下载。

Alternatively, you can create online installers that do not contain any data and that fetch all the data from the web server. Use the -n parameter of the binarycreator tool and only add the root component to the installer. Usually the root component is empty and hence only adds the XML description of the root.

或者,可以创建不包含任何数据的在线安装程序,并从web服务器获取所有数据。使用binarycreator工具的-n参数,只将根组件添加到安装程序中。通常根组件是空的,因此只添加根的XML描述。

For more information about the options that you have, see Summary of binarycreator Parameters.​
有关拥有的选项的更多信息,请参阅binarycreator参数摘要

Creating Offline InstallersPromoting Updates

© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. The Qt Company, Qt and their respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值