Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djdarien/693b642d2e58b50221b44ef7461d6621 to your computer and use it in GitHub Desktop.
Save djdarien/693b642d2e58b50221b44ef7461d6621 to your computer and use it in GitHub Desktop.
Forked - Added download progress , overall progress shown. Downloads and installs (365 Business Pro selected) latest available Microsoft product specified directly on the client.
#!/bin/zsh
# Written by:William Smith
# https://gist.github.com/talkingmoose/a16ca849416ce5ce89316bacd75fc91a
# FORKED BY by djdarien - Github on August 16 - 2021
# enter the Microsoft fwlink (permalink) product ID
# or leave blank if using a $4 script parameter with Jamf Pro
# linkID="" # e.g. "525133" for Office 2019
# 525133 - Office 2019 for Mac SKUless download (aka Office 365)
# 2009112 - Office 2019 for Mac BusinessPro SKUless download (aka Office 365 with Teams)
# 871743 - Office 2016 for Mac SKUless download
# 830196 - AutoUpdate download
# 2069148 - Edge (Consumer Stable)
# 2069439 - Edge (Consumer Beta)
# 2069340 - Edge (Consumer Dev)
# 2069147 - Edge (Consumer Canary)
# 2093438 - Edge (Enterprise Stable)
# 2093294 - Edge (Enterprise Beta)
# 2093292 - Edge (Enterprise Dev)
# 525135 - Excel 2019 SKUless download
# 871750 - Excel 2016 SKUless download
# 869655 - InTune Company Portal download
# 823060 - OneDrive download
# 820886 - OneNote download
# 525137 - Outlook 2019 SKUless download
# 871753 - Outlook 2016 SKUless download
# 525136 - PowerPoint 2019 SKUless download
# 871751 - PowerPoint 2016 SKUless download
# 868963 - Remote Desktop
# 800050 - SharePoint Plugin download
# 832978 - Skype for Business download
# 869428 - Teams
# 525134 - Word 2019 SKUless download
# 871748 - Word 2016 SKUless download
# enter the SHA 256 checksum for the download file
# download the package and run '/usr/bin/shasum -a 256 /path/to/file.pkg'
# this will change with each version
# leave blank to to skip the checksum verification (less secure) or if using a $5 script parameter with Jamf Pro
echo Auto Installing Office365
sha256Checksum="" # e.g. "67b1e8e036c575782b1c9188dd48fa94d9eabcb81947c8632fd4acac7b01644b"
if [ "2009112" != "" ] && [ "$linkID" = "" ]
then
linkID=2009112
fi
if [ "$5" != "" ] && [ "$sha256Checksum" = "" ]
then
sha256Checksum=
fi
# this is the full fwlink URL
url="https://go.microsoft.com/fwlink/?linkid=$linkID"
# create temporary working directory
echo "Creating working directory '$tempDirectory'"
workDirectory=$( /usr/bin/basename $0 )
tempDirectory=$( /usr/bin/mktemp -d "/private/tmp/$workDirectory.XXXXXX" )
# change directory to temporary working directory
echo "Changing directory to working directory '$tempDirectory'"
cd "$tempDirectory"
# download the installer package and name it for the linkID
echo "Downloading package $linkID.pkg"
/usr/bin/curl --location --silent "$url" -o "$linkID.pkg"
# needs a progress bar.. starting to implement that
echo .....
echo ........
echo ...........50%
echo almost done?
# checksum the download
downloadChecksum=$( /usr/bin/shasum -a 256 "$tempDirectory/$linkID.pkg" | /usr/bin/awk '{ print $1 }' )
echo "Checksum for downloaded package: $downloadChecksum"
# install the package if checksum validates
if [ "$sha256Checksum" = "$downloadChecksum" ] || [ "$sha256Checksum" = "" ]; then
echo "Checksum verified. Installing package $linkID.pkg"
/usr/sbin/installer -pkg "$linkID.pkg" -target /
exitCode=0
else
echo "Checksum failed. Recalculate the SHA 256 checksum and try again. Or download may not be valid."
exitCode=1
fi
# remove the temporary working directory when done
/bin/rm -Rf "$tempDirectory"
echo "Deleting working directory '$tempDirectory' and its contents"
exit $exitCode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment