$ installer -pkg /Users/admin/Downloads/KSuite_Mac_Full/KeyingSuite-11.1.3\ Installer.app/Contents/Assets/KeyingSuite-11.1_b26.mpkg -showChoiceChangesXML -target / > ~/default_choices.plist
The resulting default_choices.plist is
here. The choices have three criteria per choice (an example choice is below):
<dict>
<key>attributeSetting</key>
<true/>
<key>choiceAttribute</key>
<string>visible</string>
<key>choiceIdentifier</key>
<string>com.redgiant.Keying.AE.CS5</string>
</dict>
<dict>
<key>attributeSetting</key>
<true/>
<key>choiceAttribute</key>
<string>enabled</string>
<key>choiceIdentifier</key>
<string>com.redgiant.Keying.AE.CS5</string>
</dict>
<dict>
<key>attributeSetting</key>
<integer>0</integer>
<key>choiceAttribute</key>
<string>selected</string>
<key>choiceIdentifier</key>
<string>com.redgiant.Keying.AE.CS5</string>
</dict>
Each of these entries has the following meaning:
- "visible": Whether or not the choice is visible (e.g. listed) in the GUI Installer.app
- "enabled": Whether or not the GUI Installer.app allows the state of the choice to be changed (i.e. unchecked if it's checked, checked if it's unchecked)
- "selected": Whether or not the choice will be installed
The first two entries are GUI window dressing for Installer.app, while the third ("selected") is the only one that really matters. However note it is important to stay within the intentions of the pkg developer--if the pkg developer hasn't made the choice "visible" or "enabled", it's highly unlikely you would want to change whether that choice was "selected". In this case, it appears:
- This pkg installs nothing by default
- Choices are generally named in the format "com.redgiant.<plugin_name>.<target_application>.<target_application_revision" (e.g. "com.redgiant.Keying.AE.CS5")
2) Pare down the list of choices
In my case I'm going to attempt to install software only for After Effects CC 2014. I'll need the choices specific to this software--while I can do this by hand, I'll collect them this way:
$installer -pkg /Users/admin/Downloads/KSuite_Mac_Full/KeyingSuite-11.1.3\ Installer.app/Contents/Assets/KeyingSuite-11.1_b26.mpkg -showChoiceChangesXML -target / | grep AE.CC14 | uniq
<string>com.redgiant.Keying.AE.CC14</string>
<string>com.redgiant.Keying.PrimatteKeyer.AE.CC14</string>
<string>com.redgiant.Keying.Warp.AE.CC14</string>
<string>com.redgiant.Keying.KeyCorrect.AE.CC14</string>
I'll take the earlier "default_choices.plist" and do the following:
- Find each of the keys above
- Delete the "visible" and "selected" dicts of those keys
- Change the "selected" dict to the that key to an "attributeSetting" of "1"
- Delete the other keys
My "redgiant_ae_cc14_choices.plist" is
here.
3) Test the choices
Test the choices by running the following command:
$installer -pkg /Users/admin/Downloads/KSuite_Mac_Full/KeyingSuite-11.1.3\ Installer.app/Contents/Assets/KeyingSuite-11.1_b26.mpkg -showChoicesAfterApplyingChangesXML /Users/admin/Desktop/redgiant_ae_cc14.plist -target / > ~/results_of_choices.plist
Which outputs the following results_of_choices.plist
here.
4) Verify the choices
Verify the choices have the intended effect with the following command:
$diff -C5 ~/default_choices.plist ~/results_of_choices.plist
Which outputs the following differences between the original and choice-applied pkgs listed
here, showing that the After Effects CC 2014 plugins
should be installed. Some additional reading and pointers regarding InstallerChoices are in the
Munki wiki, an earlier
Munki-dev post, and this
JAMFNation post.
5) Beyond the choices
I wrote all the above and then went to double-check the pkg installation worked. The pkg installation did not work--odd errors such as the following appeared in install.log:
Apr 13 21:42:37 Mac.local installd[954]: ./postflight: grep: /tmp/rgs.C867B87B_3A5F_42DF_A83E_089FEDA01D63_112: No such file or directory
This file appears to be some sort of custom construct from the installer (note that the "rg" in "rgs" likely stands for the author of the package, Red Giant). In search of this file, I checked the postflight scripts for the After Effects CC 2014 plugins (for example, the GlowAECC14.pkg listed in
Pacifist)--those scripts include the following:
productName="Warp"
productNumber="112"
installProductStr=`/usr/bin/grep -i "\<${productName}\>" "/tmp/rgs.C867B87B_3A5F_42DF_A83E_089FEDA01D63_${productNumber}"`
I also installed the pkg by right-click-and-opening KeyingSuite-11.1_b26.mpkg (since it isn't signed). /tmp/rgs.C867B87B_3A5F_42DF_A83E_089FEDA01D63_112 appeared with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>keycorrect</key>
<true/>
<key>primattekeyer</key>
<true/>
<key>warp</key>
<true/>
</dict>
</plist>
A GUI installation creates a file that a CLI installation does not, and that file appears to determine whether the plugins are installed. For anyone who has run through the GUI installer, these three installation options are the ones provided by the custom "Registration" Installer Section in the pkg. Let's try this:
###
#Write the keys of interest to the file
defaults write /tmp/rgs.C867B87B_3A5F_42DF_A83E_089FEDA01D63_112 keycorrect -bool true
defaults write /tmp/rgs.C867B87B_3A5F_42DF_A83E_089FEDA01D63_112 primattekeyer -bool true
defaults write /tmp/rgs.C867B87B_3A5F_42DF_A83E_089FEDA01D63_112 warp -bool true
#because the postflight is using grep instead of defaults to parse the file, we need to convert it to XML
plutil -convert xml1 /tmp/rgs.C867B87B_3A5F_42DF_A83E_089FEDA01D63_112.plist
#Rename the file so it is usable by the postflight script
mv /tmp/rgs.C867B87B_3A5F_42DF_A83E_089FEDA01D63_112.plist /tmp/rgs.C867B87B_3A5F_42DF_A83E_089FEDA01D63_112
#Install the pkg
sudo installer -pkg /Users/admin/Downloads/KSuite_Mac_Full/KeyingSuite-11.1.3\ Installer.app/Contents/Assets/KeyingSuite-11.1_b26.mpkg -target / -applyChoiceChangesXML ~/redgiant_ae_cc2014_choices.plist -verbose
###
Hooray--the plugins seem to be installed (and they are visible from within After Effects):
$ ls -l /Library/Application\ Support/Adobe/Common/Plug-ins/7.0/MediaCore
total 0
drwxr-xr-x 36 root admin 1224 Feb 13 16:11 Key Correct
drwxr-xr-x 3 root admin 102 Feb 13 10:20 Primatte Keyer
drwxr-xr-x 9 root admin 306 Feb 12 12:26 Red Giant Warp
You'd need to add the above commands (within the triple pound signs, except for the execution of "installer") to the pkginfo as a preinstall_script. If you're installing other Red Giant plugins, the special file name and keys will likely change for each pkg.
A few additional notes:
- Red Giant will need to assist with serializing the plugins if it's even possible via CLI. Poking at the pkg with Pacifist, the serialization binary isn't immediately obvious
- There is a "postflight.pkg" package that includes in part the following postflight script commands:
Note that Munki (or ARD, or any other pkg-installing mechanism) could potentially install this pkg when no user is logged in, so it is inappropriate to try to open a web browser if a user isn't logged in. If a user isn't logged in, a web browser might open under the Login Window. Also, when installing with Munki the user will be root, so the second line of this script may not have the intended effect. It likely will be necessary to remove the "open" line of the postflight and edit the "chown" line of the postflight. The issues with this postflight script should be brought to Red Giant's attention.
- The postflight script for Red Giant Link (RGLinkRGC.pkg) attempts to create a LaunchAgent (com.redgiantsoftware.updater.plist, which launches Red Giant Link, which requests an administrative password) to the home directory of the user who installed it. This LaunchAgent may need to be removed, or the postflight script that created it be edited. The issues with this postflight script should also be brought to Red Giant's attention.
- Patrick