10

我正在按照教程打包我的 Mac 应用程序。

包分两步生成:

  1. 首先,我使用pkgbuild. 它只包含二进制文件

    pkgbuild --root ${ROOT} --scripts ${SCRIPTS} --identifier myapp \
             --version ${VERSION} --install-location ${INSTALL_DIR} %PKG%
    

    %PKG%的临时包文件名在哪里Distribution.xml

  2. 然后我用以前的 tmp 包、a Distribution.xml、背景图像等生成一个包productbuild

    productbuild --distribution ${DIST_FILE} --package-path ${PKG_PATH} \
                 --resources ${RESOURCES} ~/myapp.pkg'
    

Distribution.xml看起来像这样:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<installer-gui-script minSpecVersion="1">
    <title>MyApp</title>
    <options hostArchitectures="x86_64"/>
    <options customize="never" rootVolumeOnly="true"/>
    <welcome file="Welcome.rtf"/>
    <license file="license.rtf"/>
    <background file="background.png" scaling="proportional" alignment="bottomleft"/>
    <os-version min="10.6.6"/>
    <options customize="never" require-scripts="false"/>
    <product id="myapp" version="%VERSION%" />
    <choices-outline>
        <line choice="default">
            <line choice="myapp"/>
        </line>
    </choices-outline>
    <choice id="default"/>
    <choice id="myapp" visible="false">
        <pkg-ref id="myapp"/>
    </choice>
    <pkg-ref id="myapp" version="%VERSION%" onConclusion="none">%PKG%</pkg-ref>
</installer-gui-script>

如果该软件包在与创建它的操作系统版本相同的机器上执行 - 在这种情况下为 Mountain Lion - 但它会在早期版本中引发“无法在这台计算机上安装”错误;日志显示“安装检查失败。” 信息。

但是,临时包安装在 Lion 和 Snow Leopard 上运行良好。不知何故productbuild限制了应用程序的安装位置。我试过设置,Distribution.xml但结果是一样的。

4

1 回答 1

6

<os-version>元素需要嵌套在<allowed-os-versions>

<allowed-os-versions>
    <os-version min="10.6.6" />
</allowed-os-versions>

您还应该设置minSpecVersion="2"<installer-gui-script>.

请参阅分发定义 XML 架构参考

于 2013-10-14T20:47:26.920 回答