disable "Change Install Location..." button in installer created using productbuild
Asked Answered
E

3

8

I want to disable "Change Install Location..." button (screenshot below) in installer. I am trying to create the installer using pkgbuild and productbuild on macOSX 10.8. First, I am creating two .pkg files using pkgbuild.

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

In the above plists, I am using BundleIsRelocatable as false.

And then I am using productbuild to create the final installer package.

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

In the dist.xml, I have tried all combinations with domains and also rootVolumeOnly but I am still not able to disable the "Change Install Location..." button.

Can somebody please help? Thanks a lot.

enter image description here

Eskisehir answered 9/5, 2013 at 9:34 Comment(3)
Do you mean the button on the "Installation Type" screen which brings you back to the "Destination Select" screen?Gusta
Yes, I don't want the destination select screen and I also don't want the change install location button as I only want to install in /Applications.Eskisehir
attached the screenshot now as well.Eskisehir
E
12

I had opened a radar bug for the same and got the answer - One needs to specify only the domain required and set the rootVolumeOnly to true.

So, in my case, the following worked:

<domains enable_localSystem="true"/>
<options rootVolumeOnly="true"/>
Eskisehir answered 20/6, 2013 at 5:26 Comment(1)
Even i have the same requirement, need to disable "change install location" button. Where we need to place these above line of code? Can you please help me to find distribution.xml in my project. I am creating pkg using PACKAGES tool.Huppah
G
3

Unfortunately the "Destination Select" and the "Installation Type" are always shown by the Installer. As is the "Change Install Location..." Button.

This doesn't allow the user to change the Install Location, but UI wise it is not optimal. I can only recommend to fill a bug report against it.

You maybe wanna look into: Known Issues and Workarounds - Destination Select Pane about the usage of domains vs rootVolumeOnly

Gusta answered 13/5, 2013 at 12:10 Comment(1)
Thanks catlan. Your post had got me started in the first place - Thanks a lot for the detailed post on that thread.Eskisehir
T
2

It is a quite old question, but as I just faced this problem and fixed it. None of the solution I found on the internet solved my problem, so I will post my answer for others that face this problem.

The solution is somehow weird but it works fine. All you need to do is to add an empty plugin to your installer. The following steps will guide you through:

  1. Create a folder named Plugins in your project, I assume the folder is beside your distribution.xml file.
  2. The structure of files inside Plugins folder should look like this:

enter image description here

as you see on top level of Plugins folder there is a folder named DisbableDestinationSelect.bundle and there is a file named InstallerSections.plist

  1. Under DisbableDestinationSelect.bundle you need the exact folder structure. DisbableDestinationSelect is an empty file that must be executable. Thus, if you create the file in the command line do not forget to run chmod +x DisbableDestinationSelect
  2. The InstallerSections.plist file should look like this:
<?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>

There you go! Now create your final product with a command like this:

productbuild --distribution distribution.xml --resources Resources/ --plugins Plugins/ --package-path ./ "$PRODUCT_NAME.pkg"

and the "Change Install Location..." button is gone forever

Tolson answered 23/3, 2016 at 14:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.