Deploying Final Draft

Final Draft has recently updated its deployment options when installing/licensing client software. The old method had us manually going to each workstation and entering a key, visit a website to obtain a matching key, and entering said matching key back at the client end.

The updated deployment method now allows Final Draft to read a couple of keys and strings from a preference file instead. Specifically, it will read the following items from com.finaldraft.finaldraft.v10 inside the user home at first launch:

IT-Install (string)
IT-Install-NoPrompt (boolean)
SUEnableAutomaticChecks (boolean)

<dict>
<key>IT-Install</key>
<string>$LICENSE_KEY</string>
<key>IT-Install-NoPrompt</key>
<true/>
<key>SUEnableAutomaticChecks</key>
<false/>
</dict>

Breaking apart the official Final Draft installer package with pkgutil --expand reveals that it uses a preinstall script to set up the FLEXnet licensing service. We’ll go ahead and add our own postinstall script here since it’s not being used.

Modify the PackageInfo file inside the expanded pkg to include a postinstall script.
Drop the postinstall inside the Scripts folder in the expanded pkg directory.

Our postinstall script should include something to drop in the necessary keys for the user’s home. In this case, I’ll just scan for all available user homes and drop the keys in there.

#!/bin/bash

plist="Library/Preferences/com.finaldraft.finaldraft.v10.plist"

# loop for all user id's above 500
for i in $(dscl . -list /Users UniqueID | \
awk '$2 > 500 {print $2}'); do

# get the user name and home
user_name=$(id $i | \
awk '{print $1}' | \
sed 's/(/ /g' | \
sed 's/)/ /g' | \
awk '{print $2}')
user_home=$(dscl . -read /Users/$user_name NFSHomeDirectory | \
awk '{print $2}')

# write the plist
defaults write $user_home/$plist IT-Install \
"$LICENSE_KEY"
defaults write $user_home/$plist IT-Install-NoPrompt \
-bool true
defaults write $user_home/$plist SUEnableAutomaticChecks \
-bool false

# set ownership
chown $user_name $user_home/$plist
done

exit 0

Once all items are in place, we’ll use pkgutil --flatten to build our modified Final Draft installer. Once deployed, the app will be licensed automatically when the user launches it for the first time.

Final Draft first launch