2013-11-14 42 views
1

我想從腳本構建一個mac包安裝程序,我想運行postinstall和postflight腳本。我爲建設包裝腳本是這樣的:在Mac上安裝包時運行postflight腳本

pkgbuild --root MyRoot/MyApp.app --identifier com.myapp.MyApp --scripts Scripts --install-location /Applications/MyApp.app MyApp.pkg 
productbuild --synthesize --package MyApp.pkg Distribution.xml 
productbuild --distribution Distribution.xml --resources Resources --package-path . CompleteInstaller.pkg 

我放在腳本安裝後腳本,它被成功執行。儘管運行postflight腳本,但我遇到了問題。它被放置在Resources目錄下,不會被執行。這不足以指定它的路徑嗎?我找不到這個問題的答案,如果我錯過了,我很抱歉。

PS:我的飛行後的劇本確實沒有什麼特別的 - 現在它試圖創建的主目錄的文件:爲什麼你有一個包都postinstallpostflight

#!/bin/sh 
touch ~/file 
exit 0 
+0

這怎麼可能與錯字「Scirpts」?? – dsjoerg

回答

4

我不知道。兩者都是必須在安裝的「複製文件」階段之後運行的相同腳本。 「postflight」名稱用於舊式包 - 捆綁包。 引入扁平封裝後,必須將相同的腳本命名爲「postinstall」。 在扁平軟件包中,僅當安裝程序的名稱爲「postinstall」,而不是「postflight」並且存在於「Scripts」目錄中而非「Resources」目錄中時,安裝程​​序纔會將該文件視爲後安裝腳本。 也許,這是你的腳本沒有被執行的原因。

您可以獲得更多關於here包中使用的腳本的信息。

+0

我一直在嘗試post_install就像它曾經是,近一個小時:)感謝很多:) –