Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 736
dDarkLORD Avatar asked May 09 '13 09:05

dDarkLORD


3 Answers

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"/>
like image 183
dDarkLORD Avatar answered Nov 19 '22 02:11

dDarkLORD


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

like image 23
catlan Avatar answered Nov 19 '22 01:11

catlan


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

like image 2
Ehsan Enayati Avatar answered Nov 19 '22 02:11

Ehsan Enayati