2013-05-09 69 views
7

我想在安裝程序中禁用「更改安裝位置...」按鈕(屏幕截圖如下)。我正嘗試在macOSX 10.8上使用pkgbuild和productbuild創建安裝程序。 首先,我使用pkgbuild創建兩個.pkg文件。在使用productbuild創建的安裝程序中禁用「更改安裝位置...」按鈕

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 

在上面的Plist,我使用BundleIsRelocatable作爲

然後我使用productbuild來創建最終的安裝程序包。

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

在dist.xml,我試圖與domainsrootVolumeOnly所有的組合,但我仍然不能夠禁用「更改安裝位置...」按鈕。

有人可以幫忙嗎?非常感謝。

enter image description here

+0

你的意思上,爲您帶來「安裝類型」屏幕按鈕回到「目的地選擇」屏幕? – catlan 2013-05-10 12:20:21

+0

是的,我不想要目標選擇屏幕,我也不想更改安裝位置按鈕,因爲我只想安裝在/ Applications中。 – dDarkLORD 2013-05-13 04:15:39

+0

現在也附加了截圖。 – dDarkLORD 2013-05-13 04:32:56

回答

10

我開過雷達錯誤的相同,並且得到了答案 - 一個只需要在要求,並設置爲指定rootVolumeOnly爲true。

所以,在我的情況下,以下工作:

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

不幸的是,「目的地選擇」和「安裝類型」始終由安裝程序中。正如「更改安裝位置...」按鈕一樣。

這不允許用戶更改安裝位置,但明智的是UI不是最佳選擇。我只能推薦填寫一份針對它的錯誤報告。

你也許想看看:Known Issues and Workarounds - Destination Select Pane關於domains使用VS rootVolumeOnly

+2

謝謝catlan。你的帖子讓我開始了第一個地方 - 非常感謝該主題的詳細帖子。 – dDarkLORD 2013-05-14 05:57:55

1

這是一個很古老的問題,但我只是面對這個問題,並固定它。我在互聯網上找到的解決方案都不能解決我的問題,所以我會針對面臨此問題的其他人發佈我的答案。

該解決方案有點奇怪,但它工作正常。您只需在您的安裝程序中添加一個空插件即可。以下步驟將引導您完成:

  1. 在您的項目中創建一個名爲Plugins的文件夾,我假定該文件夾位於您的distribution.xml文件旁邊。
  2. 文件的Plugins文件夾內的結構應該是這樣的:

enter image description here

,你在Plugins文件夾的頂層看到有一個名爲DisbableDestinationSelect.bundle文件夾,並有一個InstallerSections文件命名.plist

  1. 在DisbableDestinationSelect下。捆綁您需要確切的文件夾結構。 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" 

和「更改安裝位置...」按鈕已經一去不復返了

相關問題