#!/bin/bash ########################################################################## # Shellscript : Gracefully quit Microsoft Office # Autor : Jobst Heinermann, macenterprise gmbh # Copyright : macenterprise 2019 ########################################################################## # Anmerkung: # das komplette Paket kann hier (https://macadmins.software) geladen werden # mit der Datei "de.ing.office.choices.xml" werden bestimmte # Bestandteile bei der Installation ausgeschlossen # Dialog Update Office osascript -e 'display dialog "Office muss aktualisiert werden. Dazu werden alle Office Anwendungen beendet. Bitte sichere deine Arbeit. Das Update dauert 15 min. Office needs to be updated. For this purpose, all Office applications are terminated. Please secure your work. The update lasts 15 min. " buttons {"OK"} default button 1' # Gracefully quit Microsoft Office if run killOffice () { osascript </dev/null quit app "Microsoft Word" quit app "Microsoft Excel" quit app "Microsoft Outlook" quit app "Microsoft PowerPoint" EOF } while [ ! -z "$(pgrep -i "microsoft")" ] do killOffice if [[ -z "$(pgrep -i "microsoft")" ]]; then break fi done # Variabeln OFFICE=/Library/Application\ Support/JAMF/Waiting\ Room/Microsoft_Office_16.28.19081202_Installer.pkg LIC=/Library/Application\ Support/JAMF/Waiting\ Room/Microsoft_Office_2019_VL_Serializer.pkg XML=/Library/Application\ Support/JAMF/de.ing.office_choices.xml echo "" echo "Installation Microsoft Office gestartet ..." # Software installieren /usr/sbin/installer -pkg "$OFFICE" -applyChoiceChangesXML "$XML" -allowUntrusted -target / echo "" echo "Installation beendet" # Lizenz installieren /usr/sbin/installer -pkg "$LIC" -target / echo "" echo "Lizenz installiert" # "First Run" Nachrichten unterdrücken # Microsoft Word defaults delete com.microsoft.Word kSubUIAppCompletedFirstRunSetup1507 defaults write /Library/Preferences/com.microsoft.Word kSubUIAppCompletedFirstRunSetup1507 -bool true # Microsoft Excel defaults delete com.microsoft.Excel kSubUIAppCompletedFirstRunSetup1507 defaults write /Library/Preferences/com.microsoft.Excel kSubUIAppCompletedFirstRunSetup1507 -bool true # Microsoft PowerPoint defaults delete com.microsoft.PowerPoint kSubUIAppCompletedFirstRunSetup1507 defaults write /Library/Preferences/com.microsoft.PowerPoint kSubUIAppCompletedFirstRunSetup1507 -bool true # "Default Save & Open" auf lokale Festplatte /usr/bin/defaults write /Library/Preferences/com.microsoft.office DefaultsToLocalOpenSave -bool true # Nach der Installation, sollen die benötigten Pakete wieder gelöscht werden. rm -rf /Library/Application\ Support/JAMF/de.ing.office_choices.xml rm -rf /Library/Application\ Support/JAMF/Waiting\ Room/Microsoft_Office_16.28.19081202_Installer.pkg rm -rf /Library/Application\ Support/JAMF/Waiting\ Room/Microsoft_Office_2019_VL_Serializer.pkg