Skip to content

Instantly share code, notes, and snippets.

@rtrouton
Last active August 29, 2015 14:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rtrouton/18231c5065bcd7f7e973 to your computer and use it in GitHub Desktop.
Save rtrouton/18231c5065bcd7f7e973 to your computer and use it in GitHub Desktop.
Office 2016 15.12.3 postinstall file
#!/bin/bash
# Determine working directory
install_dir=`dirname $0`
# Location of Microsoft Office 2016 Volume License file
office_license="$3/Library/Preferences/com.microsoft.office.licensingV2.plist"
# Backup location for Microsoft Office 2016 Volume License file
license_backup="$3/tmp/com.microsoft.office.licensingV2.plist"
/usr/sbin/installer -dumplog -verbose -pkg $install_dir/"Microsoft_Office_2016_15_11_2_Volume_Installer.pkg" -target "$3"
# Copy a backup of the Microsoft Office 2016 Volume License file to /tmp. If the license file is
# not available as /Library/Preferences/com.microsoft.office.licensingV2.plist, restore from the
# backup license file included with this installer.
if [[ -f "$office_license" ]]; then
cp "$office_license" "$license_backup"
fi
if [[ ! -f "$office_license" ]]; then
cp "$install_dir/com.microsoft.office.licensingV2.plist" "$license_backup"
fi
/usr/sbin/installer -dumplog -verbose -pkg $install_dir/"Microsoft_Excel_15.12.3_Updater.pkg" -target "$3"
/usr/sbin/installer -dumplog -verbose -pkg $install_dir/"Microsoft_OneNote_15.12.3_Updater.pkg" -target "$3"
/usr/sbin/installer -dumplog -verbose -pkg $install_dir/"Microsoft_Outlook_15.12.3_Updater.pkg" -target "$3"
/usr/sbin/installer -dumplog -verbose -pkg $install_dir/"Microsoft_PowerPoint_15.12.3_Updater.pkg" -target "$3"
/usr/sbin/installer -dumplog -verbose -pkg $install_dir/"Microsoft_Word_15.12.3_Updater.pkg" -target "$3"
# If the Microsoft Office 2016 Volume License file has been removed from its proper
# location, restore it using the backup file stored in /tmp and then set the correct
# permissions on the file.
if [[ ! -f "$office_license" ]] && [[ -f "$license_backup" ]]; then
cp "$license_backup" "$office_license"
chown root:wheel "$office_license"
fi
# Remove the backup file from /tmp
if [[ -f "$license_backup" ]]; then
rm "$license_backup"
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment