Further slipstreaming of MS Office

By following the instruction from this post: Deploying MS Office 2011, we will have the MS Office installer pkg, and an prep-package that we created from the last post. Now there are two improvements we want to make.

  • The prep-package adds plists/files to the User Template, the next step would be to add the same files for existing users.
  • Merge the installer pkg and the prep package.

1. Adding ~/Library files for existing users

The prep package is in a .mpkg format and is comprised of a group of .pkg’s and a distribution file. In the PackageMaker project for the package, choose the last component and add a postflight script to it (we’ll look at the contents of this script later). Build the project and then open it in finder. You’ll find that each of the components is its own package. Find the package that contains the postflight file, in the Contents/Resources/ directory add all the ~/Library/ files you need to copy.
1. ~/Library/Preferences/com.microsoft.autoupdate2.plist
2. ~/Library/Preferences/com.microsoft.error_reporting.plist
3. ~/Library/Preferences/com.microsoft.Excel.plist
4. ~/Library/Preferences/com.microsoft.language_registration.plist
5. ~/Library/Preferences/com.microsoft.office.plist
6. ~/Library/Preferences/com.microsoft.outlook.database_daemon.plist
7. ~/Library/Preferences/com.microsoft.PowerPoint.plist
8. ~/Library/Preferences/com.microsoft.Word.plist
9. ~/Library/Preferences/Microsoft/
10. ~/Library/Application Support/Microsoft
Put ~/Library/Preferences/Microsoft in a folder named Library in the Contents/Resources/. Now for the postflight script. The basic jist is that the script has to copy the files from the Resources directory to the /Users/$user/Library/ for each user. The script looks like something like below, edit as needed: #!/bin/sh

# office-setup.sh
# Moves ~/Library/ files from pkg to user’s directory
# Created by LITO on 3/14/11.
# Copyright 2011 Columbia. All rights reserved.

for folder in /Users/*
/bin/cp $1/Contents/Resources/com.microsoft.autoupdate2.plist $folder/Library/Preferences/
/bin/cp $1/Contents/Resources/com.microsoft.error_reporting.plist $folder/Library/Preferences/
/bin/cp $1/Contents/Resources/com.microsoft.Excel.plist $folder/Library/Preferences/
/bin/cp $1/Contents/Resources/com.microsoft.language_register.plist $folder/Library/Preferences/
/bin/cp $1/Contents/Resources/com.microsoft.office.plist $folder/Library/Preferences/
/bin/cp $1/Contents/Resources/com.microsoft.outlook.database_daemon.plist $folder/Library/Preferences/
/bin/cp $1/Contents/Resources/com.microsoft.outlook.office_reminders.plist $folder/Library/Preferences/
/bin/cp $1/Contents/Resources/com.microsoft.Powerpoint.plist $folder/Library/Preferences/
/bin/cp $1/Contents/Resources/com.microsoft.Word.plist $folder/Library/Preferences/
if [ -d $folder/Library/Preferences/Microsoft ]
if [ -d “$folder/Library/Preferences/Microsoft/Office 2011” ]
/bin/cp $1/Contents/Resources/Library/Microsoft/Office*2011/* $folder/Library/Preferences/Microsoft/Office*2011/
/bin/chmod -R 775 $folder/Library/Preferences/
/bin/chown -R $USER $folder/Library/Preferences/

/bin/mkdir $folder/Library/Preferences/Microsoft
/bin/mkdir “$folder/Library/Preferences/Microsoft/Office 2011”
/bin/cp $1/Contents/Resources/Library/Microsoft/Office*2011/* $folder/Library/Preferences/Microsoft/Office*2011/
/bin/chmod -R 775 $folder/Library/Preferences/
/bin/chown -R $USER $folder/Library/Preferences/
if [ -d “$folder/Library/Application Support/Microsoft” ]
if [ -d “$folder/Library/Application Support/Microsoft/Office” ]
if [ -d “$folder/Library/Application Support/Microsoft/Office/User Templates” ]
/bin/cp $1/Contents/Resources/Microsoft/Office/User*Templates/* $folder/Library/Application*Support/Microsoft/Office/User*Templates/
/bin/chmod -R 775 $folder/Library/Application*Support/*
/bin/chown -R $USER $folder/Library/Application*Support/*
/bin/mkdir “$folder/Library/Application Support/Microsoft”
/bin/mkdir “$folder/Library/Application Support/Microsoft/Office”
/bin/mkdir “$folder/Library/Application Support/Microsoft/Office/User Templates”
/bin/cp $1/Contents/Resources/Microsoft/Office/User*Templates/* $folder/Library/Applications Support/Microsoft/Office/User*Templates/
/bin/chmod -R 775 $folder/Library/Application*Support/*
/bin/chown -R $USER $folder/Library/Application*Support/*


exit 0

note: It’s important to chmod 775 the folders otherwise the user will not have read rights and this will all be for naught.

2. Merging installer and prep packages

I used OfficeForMac’s help page on distribution.dist to execute my deployment. The first step was to open up the Office 2011 package and the prep package. move the packages from the prep package to the Office pkg (the directory in the package is /Contents/Packages). I would make a directory in Contents/Packages called user_lib and stash the prep packages there. Once the packages are in place, you want to edit Contents/distribution.dist
There are three types of edits, and it’s best to start from the bottom up. At the bottom you’ll find package references that tell you where to find the package, the size of the package, an user defined id (which is used in the next step), version and other actions. An example would be: <pkg-ref id="com.microsoft.office.en.commsms-1.pkg.14.0.0" version="14.0.2" installKBytes="123904" auth="Admin" onConclusion="None">file:./Contents/Packages/user_files/microsoft-1.pkg</pkg-ref>
Set the file’s path to the location of your package. Then set the installKBytes if you want, it’s not necessary. Set the pkg-ref id to something descriptive and brief, as it’ll be used in the next step. A package reference needs to be created for every package.
Next we have to add a choice to install our prep packages. Above the pkg-ref’s are the choices, add a choice like the one below:<choice id="user-lib" title="userlib-title" description="userlib-description" tooltip="userlib-tooltip" start_selected="true" start_enabled="true" start_visible="true">
<pkg-ref id="com.microsoft.office.en.commsau2.pkg.14.0.0"></pkg-ref>
<pkg-ref id="com.microsoft.office.en.commsrpt.pkg.14.0.0"></pkg-ref>
<pkg-ref id="com.microsoft.office.en.commsexcel.pkg.14.0.0"></pkg-ref>
<pkg-ref id="com.microsoft.office.en.commslang.pkg.14.0.0"></pkg-ref>
<pkg-ref id="com.microsoft.office.en.commsoff.pkg.14.0.0"></pkg-ref>
<pkg-ref id="com.microsoft.office.en.commsoutdb.pkg.14.0.0"></pkg-ref>
<pkg-ref id="com.microsoft.office.en.commsoutrem.pkg.14.0.0"></pkg-ref>
<pkg-ref id="com.microsoft.office.en.commspp.pkg.14.0.0"></pkg-ref>
<pkg-ref id="com.microsoft.office.en.commsword.pkg.14.0.0"></pkg-ref>
<pkg-ref id="com.microsoft.office.en.commsms.pkg.14.0.0"></pkg-ref>
<pkg-ref id="com.microsoft.office.en.commsms-1.pkg.14.0.0"></pkg-ref>

In this format, the first thing to do is set the choice id, title and description. It’s also advisable to set the start_visible to false. The choice id will be referenced above, so it should be something short but descriptive. Within the <choice> and </choice> we add the packages that will be installed for the choice, identified by their pkg-ref ids.
After that is done, we want to add a line choice for our new choice, this is done in the choices-outline section by adding a line like: <line choice="user-lib"></line>
Now our install package will install office and also install the ~/Library files for all users and the user’s template. This package is easy to push out through ARD or synctool via the installer command making it totally silent.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s