2013-11-04 26 views
3

我們爲我們的Java應用程序創建了.pkg安裝程序,並且每次運行最新的.pkg安裝程序時,都會刪除此應用程序的以前的開發版本。我注意到,這個最新的安裝程序在刪除舊的開發版本時打印出「刪除舊文件...」。對於那些經常希望保留多個開發版本進行比較的測試人員來說,這非常煩人。OSX .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> 
+0

您想如何在同一時間維護多個版本?通過重命名? App.app應用程序(1).app等。?或者問題是首選項文件被刪除? – DNax

回答

1

pkgbuild不支持此時不覆蓋以前的版本。但是,您可以使用版本控制(如git)來跟蹤文件夾。更好的是,Dropbox還可以保留以前版本的文件,最高可達200​​.另外,它是免費的。我建議你嘗試一下。一旦您的mac上安裝了dropbox,將所需的構建資源複製到該目錄中並在用戶主目錄的「Dropbox」文件夾中運行該命令。

+0

Dropbox不是一個很好的源代碼控制。不過,git的建議很不錯。 –

+0

@JohnAsmuth它不適用於複雜的項目,但對許多簡單的項目可能會過度。 – William