【问题标题】:OSX .pkg deletes other dev versionsOSX .pkg 删除其他开发版本
【发布时间】:2013-11-04 23:59:58
【问题描述】:

我们为我们的 Java 应用程序创建了 .pkg 安装程序,每次我们运行最新的 .pkg 安装程序时,它都会删除该应用程序以前的开发版本。我注意到这个最新的安装程序在删除其中一个旧的开发版本时会打印“删除旧文件...”。对于经常希望保留多个开发版本进行比较的测试人员来说,这非常烦人。

有没有办法强制安装程序不删除旧文件?

为了创建我的最终安装程序,我首先创建几个子 .pkg,并调用 pkgbuild:

pkgbuild --root "./Temp"  --identifier "com.agentsheets.agentsheets" --install-location "/Applications" --sign "Developer ID Installer: AgentSheets, Inc." "./build_dir/temp.pkg"
pkgbuild --root "$APP_FOLDER/AgentSheets.app"  --identifier "com.agentsheets.agentsheets.app" --install-location "/Applications/$APP_FOLDER_NAME/AgentSheets.app" --sign "Developer ID Installer: AgentSheets, Inc." "./build_dir/asj_app.pkg"
pkgbuild --root "./AgentSheetsCameraHelper.app"  --identifier "com.agentsheets.agentsheets.camera" --install-location "/Applications/$APP_FOLDER_NAME/Resources/AgentSheetsCameraHelper.app" --sign "Developer ID Installer: AgentSheets, Inc." "./build_dir/camera.pkg"

然后我使用 productbuild 创建最终的 .pkg:

productbuild  --package-path "./build_dir"  --distribution "./Distribution.xml"  --resources "./Resources" --sign "Developer ID Installer: AgentSheets, Inc."  "$FINAL_PKG"

这是我的 distribution.xml:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<installer-gui-script minSpecVersion="1">
    <title>AgentSheets</title>
    <background file="background.png" scaling="toFit"/>
    <options customize="never" require-scripts="false"/>
    <pkg-ref id="com.agentsheets.agentsheets"/>
    <pkg-ref id="com.agentsheets.agentsheets.app"/>
    <pkg-ref id="com.agentsheets.agentsheets.camera"/>
    <options customize="never" require-scripts="false"/>
    <choices-outline>
        <line choice="default">
            <line choice="com.agentsheets.agentsheets"/>
            <line choice="com.agentsheets.agentsheets.app"/>
            <line choice="com.agentsheets.agentsheets.camera"/>
        </line>
    </choices-outline>
    <choice id="default"/>
    <choice id="com.agentsheets.agentsheets" visible="false">
        <pkg-ref id="com.agentsheets.agentsheets"/>
    </choice>
    <pkg-ref id="com.agentsheets.agentsheets" version="0" onConclusion="none">temp.pkg</pkg-ref>
    <choice id="com.agentsheets.agentsheets.app" visible="false">
        <pkg-ref id="com.agentsheets.agentsheets.app"/>
    </choice>
    <pkg-ref id="com.agentsheets.agentsheets.app" version="0" onConclusion="none">asj_app.pkg</pkg-ref>
    <choice id="com.agentsheets.agentsheets.camera" visible="false">
        <pkg-ref id="com.agentsheets.agentsheets.camera"/>
    </choice>
    <pkg-ref id="com.agentsheets.agentsheets.camera" version="0" onConclusion="none">camera.pkg</pkg-ref>
</installer-gui-script>

【问题讨论】:

  • 您希望如何同时维护多个版本?通过改名? App.app App(1).app 等.. ?或者问题是首选项文件删除?

标签: macos installation productbuild pkgbuild


【解决方案1】:

pkgbuild 不支持此时不覆盖以前的版本。但是,您可以使用版本控制(例如 git)来跟踪文件夹。更好的是,Dropbox 还保留文件的先前版本,最多 200 个。此外,它是免费的。我建议你试试看。在您的 Mac 上安装 dropbox 后,将所需的构建资源复制到该目录并在您的用户主目录的“Dropbox”文件夹中运行命令。

【讨论】:

  • Dropbox 不是一个很好的源代码控制。不过,git 的建议是一个很好的建议。
  • @JohnAsmuth 这不适用于复杂的项目,但对于许多简单的项目来说可能有点过头了。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-05-22
  • 1970-01-01
  • 2012-03-10
  • 2021-08-25
  • 1970-01-01
  • 2016-05-10
相关资源
最近更新 更多