9

我有一个 mac 应用程序(例如 Sample.pkg 包含 Sample.app)以及一些 pkg 依赖项(例如 A.pkg 和 B.pkg )。每当用户运行dmg/product与这三个软件包捆绑在一起的存档时,A.pkg必须在安装B.pkg之前先运行Sample.pkg

有没有一种方法可以在打包 mac 应用程序时指定此依赖项,而无需用户手动检查并以正确的顺序安装它们?

4

1 回答 1

0

解决方案

有一种方法。您可以将此类条目添加到您的distribution.xml

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<installer-gui-script minSpecVersion="1">
    <title>Application name</title>
    <organization>com.organization</organization>

    ....

    <volume-check>
        <required-bundles description="Some message which UI Installer doesn't show :(">

            <!-- bundle 1 -->
            <bundle id="com.organization.app1" path="Applications/App1.app" />

            <!-- bundle 2 -->
            <bundle id="com.organization.app2" path="Applications/App2.app" />
        </required-bundles>
    </volume-check>

    ....
</installer-gui-script>

这在此处记录(必需的捆绑包)

一些例子可以在 github上找到。

坏处

Apple Installer 中有一些错误,required-bundles description说:

属性

|----------------|------------------|------------------------------------------------------------|
| Attribute name |       Type       |                       Description                          |
|----------------|------------------|------------------------------------------------------------|
|                |                  | _Optional._ Values: `true` (default) to require all of     |
|     `all`      |     Boolean      | the specified bundles, or `false` to require at least one  |
|                |                  | of them.                                                   |
|----------------|------------------|------------------------------------------------------------|
|  `description` |   String,        | _Optional._ A description of the required bundles,         |
|                | localization key | displayed to the user if the requirement is not met.       |
|----------------|------------------|------------------------------------------------------------|

所以description应该显示来自的消息,但我在任何地方都看不到它,所以用户可能会感到困惑,为什么他无法安装应用程序。

它只是警告:(You can't install <your application> here, <your application> do not allow it.抱歉从我的本地化翻译回英文)。

选择

我已经看到一些安装包正在运行自定义脚本形式的安装检查,从安装 JavaScript 调用它,使用system.run('script_name').

于 2020-02-06T17:33:34.263 回答