Skip to content

Instantly share code, notes, and snippets.

@opragel
Last active April 5, 2018 15:36
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save opragel/ee22cf3103f20ae2f45464d9e78688a8 to your computer and use it in GitHub Desktop.
Save opragel/ee22cf3103f20ae2f45464d9e78688a8 to your computer and use it in GitHub Desktop.
lazy_install_microsoft_office2016vl.sh
#!/bin/bash
CHOICES_XML_PATH="/tmp/office2016-choices.xml"
MSO2016_PKG_PATH="/tmp/microsoft_office2016_volumeinstaller.pkg"
MSO2016_SERIALIZER_PATH="/tmp/Microsoft_Office_2016_VL_Serializer.pkg"
INSTALLER_TARGET="/"
MAU_APP_PATH="/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app"
DOUBLE_SECRET_MAU_PATH="/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app/Contents/MacOS/Microsoft AU Daemon.app"
/usr/sbin/installer -applyChoiceChangesXML "$CHOICES_XML_PATH" -dumplog -verbose -pkg "$MSO2016_PKG_PATH" -target "$INSTALLER_TARGET"
/usr/sbin/installer -dumplog -verbose -pkg "$MSO2016_SERIALIZER_PATH" -target "$INSTALLER_TARGET"
defaults write /Library/Preferences/com.microsoft.Excel kSubUIAppCompletedFirstRunSetup1507 -bool true
defaults write /Library/Preferences/com.microsoft.onenote.mac kSubUIAppCompletedFirstRunSetup1507 -bool true
defaults write /Library/Preferences/com.microsoft.Outlook kSubUIAppCompletedFirstRunSetup1507 -bool true
defaults write /Library/Preferences/com.microsoft.Outlook FirstRunExperienceCompletedO15 -bool true
defaults write /Library/Preferences/com.microsoft.PowerPoint kSubUIAppCompletedFirstRunSetup1507 -bool true
defaults write /Library/Preferences/com.microsoft.Word kSubUIAppCompletedFirstRunSetup1507 -bool true
# Borrowed from https://gist.github.com/erikng/7cede5be1c0ae2f85435
if [ -e "$MAU_APP_PATH" ]; then
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -R -f -trusted "$MAU_APP_PATH"
if [ -e "$DOUBLE_SECRET_MAU_PATH" ]; then
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -R -f -trusted "$DOUBLE_SECRET_MAU_PATH"
fi
fi
rm -rf "$CHOICES_XML_PATH" "$MSO2016_PKG_PATH" "$MSO2016_SERIALIZER_PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment