Tools
工具
The Qt Installer Framework contains the following tools:
Qt安装程序框架包含以下工具:
installerbase
The installerbase
tool describes the core installer itself. All data and meta information will be packed to this binary. For the installer creation process you will not need to call it directly.
installerbase工具描述了核心安装程序本身。所有数据和元信息都将打包到此二进制文件中。对于安装程序创建过程,不需要直接调用它。
binarycreator
Use the binarycreator
tool to create offline and online installers. Component information and data are appended to the offline installer binary, which enables the file extraction and post installation scripts to work without an Internet connection.
使用binarycreator工具创建离线和在线安装程序。组件信息和数据附加到脱机安装程序二进制文件中,这使得文件提取和安装后脚本能够在没有互联网连接的情况下工作。
Online installers store the location of the repository that contains the data. On startup, they load the component information, not the data.
在线安装程序存储包含数据的存储库的位置。启动时,它们加载组件信息,而不是数据。
You can also create hybrid installers that store some components locally and receive others via a network connection. For more information, see Reducing Installer Size.
还可以创建混合安装程序,在本地存储一些组件,并通过网络连接接收其他组件。有关更多信息,请参阅减小安装程序大小。
For information about how to implement data integration into the installer binary, see QInstaller::BinaryContent.
有关如何将数据集成到安装程序二进制文件中的信息,请参阅QInstaller::BinaryContent。
Note: If you change this configuration, you must recompile the
installerbase
tool.注意:如果更改此配置,则必须重新编译installerbase工具。
Using binarycreator
使用binarycreator
You can use the binarycreator
tool to create offline and online installers. Some options have default values, and therefore, you can omit them.
可以使用binarycreator工具创建离线和在线安装程序。某些选项具有默认值,因此可以省略它们。
To create an offline installer (in Windows), enter the following command:
要创建脱机安装程序(在Windows中),请输入以下命令:
- On Windows:
<location-of-ifw>\binarycreator.exe -t <location-of-ifw>\installerbase.exe -p <package_directory> -c <config_directory>\<config_file> <installer_name>
- On Linux and macOS
<location-of-ifw>/binarycreator -t <location-of-ifw>/installerbase -p <package_directory> -c <config_directory>/<config_file> <installer_name>
To create an online only installer, you can use the –online-only which defines all packages to install from an online repository on a web server:
要创建仅在线安装程序,您可以使用-online-only,它定义了从web服务器上的在线存储库安装的所有软件包:
- On Windows:
<location-of-ifw>\binarycreator.exe -t <location-of-ifw>\installerbase.exe -p <package_directory> -c <config_directory>\<config_file> -e <packages> <installer_name>
- On Linux and macOS
<location-of-ifw>/binarycreator -t <location-of-ifw>/installerbase -p <package_directory> -c <config_directory>/<config_file> -e <packages> <installer_name>
Summary of binarycreator Parameters
binarycreator参数摘要
The binarycreator
tool accepts the following parameters:
binarycreator工具接受以下参数:
Parameter | Use |
---|---|
-t or –template file | Use 将 |
-p or –packages directory | Use 使用directory作为包目录。默认为当前工作目录。 |
–repository directory | Use 使用directory作为存储库目录,其中包含要重新打包的包。此条目可以多次给出。 |
-n or –online-only | Compile without any component in the installer binary. 编译时安装程序二进制文件中没有任何组件。 |
-f or –offline-only | Create an offline installer that never accesses online repositories. 创建一个从不访问在线存储库的离线安装程序。 |
-c or –config file | Use 将 |
-e or –exclude p1,...,pn | Comma-separated list of packages to retrieve from an online repository. The packages are not included in the installer binary. 从在线存储库中检索的以逗号分隔的包列表。安装程序二进制文件中不包含这些包。 |
-i or –include p1,...,pn | Comma-separated list of packages to retrieve from the installer binary. You cannot combine or merge 从安装程序二进制文件中检索的以逗号分隔的包列表。不能组合或合并--include和--exclude。 |
-r or –resources | Comma-separated list of resources to include in the installer binary. 以逗号分隔的要包含在安装程序二进制文件中的资源列表。 |
–ignore-translations | Disable the use of translation files to make testing faster. 禁用翻译文件以加快测试速度。 |
–ignore-invalid-packages | Ignore component or package directories that do not have valid metadata information (package.xml) to make testing faster. 忽略没有有效元数据信息(package.xml)的组件或包目录,以加快测试速度。 |
–ignore-invalid-repositories | Ignore repository directories that do not have valid metadata information (Updates.xml) instead of aborting. 忽略没有有效元数据信息(Updates.xml)的存储库目录,而不是中止。 |
-v or –verbose | Display debug output. 显示调试输出。 |
-s or –sign identity | Only available on macOS. Allows specifying a code signing identity to be used for signing the generated app bundle. 仅在macOS上可用。允许指定用于对生成的应用程序包进行签名的代码签名标识。 |
–af or –archive-format 7z|zip|tar|tar.gz|tar.bz2|tar.xz | Set the format used when packaging new component data archives. If you omit this option, the 7z format will be used as a default. 设置打包新组件数据存档时使用的格式。如果省略此选项,则默认使用7z格式。
|
–ac or –compression <5> | Defaults to 5 (Normal compression). 默认值为5(正常压缩)。
|
These parameters are followed by the name of the target binary and a list of packages to be available for installation.
这些参数后面是目标二进制文件的名称和可用于安装的软件包列表。
Note: The listed packages are included in the installer, as well as all their dependencies and all packages that share the same prefix, unless you specify the
--nodeps
parameter.注意:除非指定--nodeps参数,否则所列的包以及它们的所有依赖项和共享相同前缀的所有包都包含在安装程序中。
In the optional resource files specified via the --resources
parameter, a special fonts/
path can be used to ship custom fonts. These fonts will be loaded automatically and thus become available in a stylesheet which can be specified via the StyleSheet
variable.
在通过--resources参数指定的可选资源文件中,可以使用特殊的fonts/
路径来发布自定义字体。这些字体将自动加载,从而在样式表中可用,样式表可以通过StyleSheet
变量指定。
On Windows, the name of the target binary is automatically extended with .exe, if you do not specify the extension. On Mac, the target is created as an application bundle with the extension .app, which is automatically added, if not supplied. Additionally, you can specify the .dmg extension, which creates a DMG disk image that contains an .app bundle.
在Windows上,如果不指定扩展名,目标二进制文件的名称将自动扩展为.exe。在Mac上,目标被创建为带有扩展名.app的应用程序包,如果没有提供,则会自动添加。此外,可以指定.dmg扩展名,这将创建一个包含.app捆绑包的dmg磁盘映像。
Using Icons
使用图标
On macOS, if the target binary is suffixed with .app, a macOS application bundle is created. The icon that you specify in config.xml is extended with .icns and used as the icon for the created bundle.
在macOS上,如果目标二进制文件后缀为.app,则会创建macOS应用程序包。在config.xml中指定的图标用.icon 扩展,并用作创建的包的图标。
On Windows, the icon that you specify in config.xml is extended with .ico and used as the application icon for the .exe file.
在Windows上,在config.xml中指定的图标用.ico扩展,并用作.exe文件的应用程序图标。
On Linux, the icon that you specify in config.xml is extended with .png and used as the window icon.
在Linux上,在config.xml中指定的图标用.png扩展并用作窗口图标。
repogen
Use the repogen
tool to generate online repositories.
使用repogen工具生成在线存储库。
The repogen
tool expects the following parameters in the following order:
repogen
工具需要以下参数,顺序如下:
repogen.exe -p <package_directory> <repository_directory>
When the repository has been created, you can upload it anywhere. You must specify the location in the installer configuration file when creating an installer for it.
创建存储库后,可以将其上传到任何地方。创建安装程序时,必须在安装程序配置文件中指定位置。
Repositories contain compressed metadata that can be packaged as a separate 7z archive for each component, or combined into a single 7z archive for the repository entirety. By default, repogen packages the metadata in both formats for backward compatibility with older installers not supporting the unified meta-format. This can be changed with the --unite-metadata
and --component-metadata
options.
存储库包含压缩的元数据,可以将每个组件打包为单独的7z存档,也可以将整个存储库合并为一个7z存档。默认情况下,repogen以两种格式打包元数据,以便与不支持统一元格式的旧安装程序向后兼容。这可以通过--unite-metadata
和--component-metadata
选项进行更改。
You can use an existing repository to repack packages to another repository or offline installer.
可以使用现有的存储库将包重新打包到另一个存储库或脱机安装程序。
Summary of repogen Parameters
repogen 参数汇总
Parameter | Use |
---|---|
-p or –packages directory | Use 使用directory作为包目录。这是强制性的。 |
–repository directory | Use 将 |
repository directory | Target directory for the repository. During an initial installation, the directory must not yet exist. When updating, the directory may exist and its contents may be overwritten or removed. This is mandatory. 存储库的目标目录。在初始安装期间,目录必须尚未存在。更新时,目录可能存在,其内容可能会被覆盖或删除。这是强制性的。 |
-e or –exclude p1,...,pn | Comma-separated list of packages to be ignored from the set of all packages in the packages directory. 从packages目录中的所有包集中忽略的以逗号分隔的包列表。 |
-i or –include p1,...,pn | Comma-separated list of packages to be used from the set of all packages in the packages directory. 从packages目录中的所有包集中使用逗号分隔的包列表。 |
–update | Update all packages in the packages directory. The list can be further filtered with the 更新packages目录中的所有包。可以使用-i、-e参数对列表进行进一步筛选。 |
–update-new-components | Update only components that are new or have a newer version. The list can be further filtered with the 仅更新新的或具有较新版本的组件。可以使用-i、-e参数对列表进行进一步筛选。 |
-r or –remove | Force removal of existing target directory before generating it again. 在再次生成之前,强制删除现有的目标目录。 |
-v or –verbose | Display debug output. 显示调试输出。 |
–unite-metadata | Combine all metadata into one 7z. This speeds up metadata download phase. 将所有元数据合并到一个7z中。这加快了元数据下载阶段。 |
–component-metadata | Creates one metadata 7z per component. 为每个组件创建一个7z元数据。 |
-s or –sha-update p1,...,pn | Comma-separated list of packages to be updated based on the component sha checksum instead of the version number. This parameter adds a new 基于组件sha校验和而不是版本号更新的以逗号分隔的包列表。此参数将一个新的<ContentSha1>节点添加到Updates.xml中。 |
–af or –archive-format 7z|zip|tar|tar.gz|tar.bz2|tar.xz | Set the format used when packaging new component data archives. If you omit this option, the 7z format will be used as a default. 设置打包新组件数据存档时使用的格式。如果省略此选项,则默认使用7z格式。
|
–ac, –compression <5> | Defaults to 5 (Normal compression). 默认值为5(正常压缩)。
|
Note: We recommend that you use the
--update-new-packages
parameter to update an existing repository, especially if you have a content delivery system. This helps you avoid updating components that have not changed and this makes it much easier for a content delivery system to distribute only new files, because only the updated components are assigned new SHA checksums.注意:我们建议使用
--update-new-packages
参数来更新现有的存储库,特别是如果有一个内容交付系统。这有助于避免更新未更改的组件,这使得内容交付系统更容易只分发新文件,因为只有更新的组件才会被分配新的SHA校验和。
archivegen
You can use archivegen
to package files and directories into archives.
可以使用archivegen将文件和目录打包到存档中。
The archivegen
tool expects the following parameters in the following order:
archivegen工具要求以下参数按以下顺序排列:
archivegen <archive_name> <data>
Where <archive_name> is the path and file name of the archive to create and <data> contains the paths and names of the files or directories to package into the archive, separated by spaces.
其中<archive_name>是要创建的存档的路径和文件名,<data>包含要打包到存档中的文件或目录的路径和名称,用空格分隔。
Summary of archivegen Parameters
archivegen参数汇总
Parameter | Use |
---|---|
-h, –help | Displays this help. 显示此帮助。 |
-v, –version | Displays version information. 显示版本信息。 |
-f, –format <format> | Format for the archive. Defaults to 7z. 存档的格式。默认为7z。
|
-c, –compression <5> | Defaults to 5 (Normal compression). 默认值为5(正常压缩)。
|
devtool
You can use devtool
to update an existing installer or maintenance tool with a new installer base, to dump binary content from an installer or maintenance tool to a target, and to execute operations. For a summary of available operations, see Operations.
可以使用devtool用新的安装程序库更新现有的安装程序或维护工具,将二进制内容从安装程序或维修工具转储到目标,并执行操作。有关可用操作的摘要,请参阅操作。
devtool
expects the following parameters in the following order:
devtool要求以下参数按以下顺序排列:
devtool [options] binary
Where binary is the path and name of an existing installer or maintenance tool.
其中binary是现有安装程序或维护工具的路径和名称。
Summary of devtool Parameters
devtool参数摘要
Parameter | Use |
---|---|
-?, -h, –help | Display help. 显示帮助。 |
-v, –version | Display version information. 显示版本信息。 |
–verbose | Display additional information. 显示附加信息。 |
update <binary> <installerbase> | Update an existing installer or maintenance tool with a new installer base. 使用新的安装程序库更新现有的安装程序或维护工具。 |
dump <binary> <folder> | Dump the binary content that belongs to an installer or maintenance tool into the target. 将属于安装程序或维护工具的二进制内容转储到目标中。 |
operation <mode,name,args,...> | Execute an operation with a list of arguments.
使用参数列表执行操作。 |
© 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.