简体   繁体   English

如何在 mac 上的 dmg/pkg 中包含安装程序依赖项

[英]How to include installer dependencies in dmg/pkg on mac

I have a mac application (Eg. Sample.pkg containing Sample.app) along with few pkg dependencies (Eg. A.pkg and B.pkg ).我有一个 mac 应用程序(例如包含 Sample.app 的 Sample.pkg)以及一些 pkg 依赖项(例如 A.pkg 和 B.pkg )。 Whenever the user runs the dmg/product archive bundled with these three packages, A.pkg and B.pkg has to be run first before Sample.pkg is installed.每当用户运行与这三个软件包捆绑在一起的dmg/product存档时,必须先运行A.pkgB.pkg ,然后再安装Sample.pkg

Is there a way where I can specify this dependency while packaging the mac application, without need the user to manually check and install them in the right order?有没有一种方法可以在打包 mac 应用程序时指定此依赖项,而无需用户以正确的顺序手动检查和安装它们?

Solution解决方案

There is a way.有一种方法。 You can add such entry to your distribution.xml您可以将此类条目添加到您的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>

This is documented here (required-bundles) .这在此处(required-bundles) 进行了记录

Some examples can be found on github .一些示例可以 在 github找到

Disadvantage坏处

There is some bug in Apple Installer, required-bundles description says: Apple Installer 中存在一些错误, required-bundles description说:

Attributes属性

|----------------|------------------|------------------------------------------------------------| | 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. | |----------------|------------------|------------------------------------------------------------|

So the message from description should be shown, but I can't see it anywhere, so user can be confused why he is unable to install application.所以应该显示来自description的消息,但我在任何地方都看不到它,所以用户可能会困惑为什么他无法安装应用程序。

It just warns: You can't install <your application> here, <your application> do not allow it.它只是警告: You can't install <your application> here, <your application> do not allow it. (sorry translation from my localization back to English). (对不起,从我的本地化翻译回英语)。

Alternative选择

I've seen some installation package which was running custom script form installation-check invoking it from installation JavaScript, using system.run('script_name') .我已经看到一些安装包运行自定义脚本表单安装检查从安装 JavaScript 调用它,使用system.run('script_name')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM