【问题标题】:disable "Change Install Location..." button in installer created using productbuild在使用 productbuild 创建的安装程序中禁用“更改安装位置...”按钮
【发布时间】:2013-05-03 17:52:33
【问题描述】:

我想禁用安装程序中的“更改安装位置...”按钮(如下截图)。我正在尝试在 macOSX 10.8 上使用 pkgbuild 和 productbuild 创建安装程序。 首先,我正在使用 pkgbuild 创建两个 .pkg 文件。

pkgbuild --root myApp --component-plist myApp.plist --scripts appScripts --identifier com.myapp.coreapp --version 1.0.00 --install-location /Applications --ownership preserve
pkgbuild --root myBr --component-plist myBr.plist --scripts brScripts --identifier com.myapp.browser --version 1.0.00 --install-location /Library/Internet\ Plug-Ins --ownership preserve

在上述 plists 中,我使用 BundleIsRelocatable 作为 false

然后我正在使用 productbuild 创建最终的安装程序包。

productbuild --distribution dist.xml --resources res inst.pkg

在 dist.xml 中,我尝试了与 domainsrootVolumeOnly 的所有组合,但我仍然无法禁用 “更改安装位置...” 按钮。

有人可以帮忙吗?非常感谢。

【问题讨论】:

  • 您是指“安装类型”屏幕上的按钮,它让您返回“目标选择”屏幕?
  • 是的,我不想要目的地选择屏幕,也不想要更改安装位置按钮,因为我只想安装在 /Applications 中。
  • 现在也附上截图。

标签: macos productbuild pkgbuild


【解决方案1】:

不幸的是,“目标选择”和“安装类型”总是由安装程序显示。 “更改安装位置...”按钮也是如此。

这不允许用户更改安装位置,但在 UI 方面它不是最佳的。我只能建议针对它填写错误报告。

您可能想了解:Known Issues and Workarounds - Destination Select Pane 关于 domainsrootVolumeOnly 的用法

【讨论】:

  • 谢谢卡特兰。您的帖子首先让我开始了 - 非常感谢该线程上的详细帖子。
【解决方案2】:

我为此打开了一个雷达错误并得到了答案 - 只需指定所需的 domain 并将 rootVolumeOnly 设置为 true。

因此,就我而言,以下方法有效:

<domains enable_localSystem="true"/>
<options rootVolumeOnly="true"/>

【讨论】:

  • 即使我有相同的要求,也需要禁用“更改安装位置”按钮。我们需要将这些上面的代码行放在哪里?你能帮我在我的项目中找到distribution.xml吗?我正在使用 PACKAGES 工具创建 pkg。
【解决方案3】:

这是一个很老的问题,但我刚刚遇到这个问题并解决了它。我在互联网上找到的解决方案都没有解决我的问题,所以我会将我的答案发布给其他面临此问题的人。

解决方案有点奇怪,但效果很好。您需要做的就是在安装程序中添加一个空插件。以下步骤将指导您完成:

  1. 在您的项目中创建一个名为 Plugins 的文件夹,我假设该文件夹位于您的 distribution.xml 文件旁边。
  2. Plugins 文件夹内的文件结构应如下所示:

正如您在 Plugins 文件夹的顶层看到的,有一个名为 DisbableDestinationSelect.bundle 的文件夹,还有一个名为 InstallerSections.plist 的文件

  1. 在 DisbableDestinationSelect.bundle 下,您需要确切的文件夹结构。 DisbableDestinationSelect 是一个必须是可执行的空文件。因此,如果您在命令行中创建文件,请不要忘记运行 chmod +x DisbableDestinationSelect
  2. InstallerSections.plist 文件应如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>SectionOrder</key>
  <array>
      <string>DisbableDestinationSelect.bundle</string>
      <string>Introduction</string>
      <string>ReadMe</string>
      <string>Target</string>
      <string>PackageSelection</string>
      <string>Install</string>
  </array>
</dict>
</plist>

给你!现在使用如下命令创建您的最终产品:

productbuild --distribution distribution.xml --resources Resources/ --plugins Plugins/ --package-path ./ "$PRODUCT_NAME.pkg"

“更改安装位置...”按钮永远消失了

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-24
    • 1970-01-01
    • 2017-10-29
    相关资源
    最近更新 更多