简体   繁体   English

OSX .pkg删除其他开发版本

[英]OSX .pkg deletes other dev versions

We have created .pkg installer for our Java app and every time we run the the newest .pkg installer it delete previous dev versions of the app. 我们为Java应用程序创建了.pkg安装程序,每次运行最新的.pkg安装程序时,它都会删除应用程序的以前开发版本。 I noticed that this newest installer prints "Removing old files..." when it removes one of the old dev versions. 我注意到这个最新的安装程序在删除旧的dev版本时会打印“删除旧文件...”。 This is quite annoying for testers who often would like to keep multiple dev versions for comparison. 对于经常希望保留多个开发版本进行比较的测试人员来说,这非常烦人。

Is there a way to force the installer to not remove old files? 有没有办法强制安装程序不删除旧文件?

To create my final installer I first create a couple of sub .pkg's with calls to pkgbuild: 要创建我的最终安装程序,我首先使用pkgbuild调用创建几个sub .pkg:

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"

Then I create the final .pkg with productbuild: 然后我用productbuild创建最终的.pkg:

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

Here is my distribution.xml: 这是我的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>

pkgbuild does not support not overwriting the previous version at this time. pkgbuild 目前不支持不覆盖以前的版本。 However, you could use version control, such as git, to track the folder. 但是,您可以使用版本控制(例如git)来跟踪文件夹。 Better yet, Dropbox also keeps previous revisions of a file, up to 200. Plus, it's free. 更好的是,Dropbox还保留了以前的文件修订版,最高可达200​​个。此外,它还是免费的。 I recommend you try that out. 我建议你尝试一下。 Once dropbox is installed on your mac, copy the required build resources into the directory and run the command within the 'Dropbox' folder of your user home. 在mac上安装Dropbox后,将所需的构建资源复制到目录中,然后在用户主目录的“Dropbox”文件夹中运行该命令。

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

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