I've created this script with some bits from other scripts I've seen here.
What I've tried to do is create one script that can use parameters for multiple apps.
Use cases are: installing a single app, installing multiple or all apps, installing autoupdate if the user installs an app.
What I'd like to do is pass in multiple parameters with all the desired apps and install Microsoft autoupdate if it's not already installed. At the moment I'm considering using a smart group to deploy autoupdate which can work too but I'm not sure that's the best approach since there's a gap between when the user installs the app, smart group updates, and when autoupdate is then pushed.
I'm still new to scripting so I'm sure there are things that can be improved here.
My plan for updates is to use the configuration profile for Microsoft AutoUpdate.
If you have any suggestions I would very much appreciate it.
#!/bin/sh
app="" # [ excel | outlook | powerpoint | word | rdp | autoupdate ]
exceldl="https://go.microsoft.com/fwlink/?linkid=525135"
outlookdl="https://go.microsoft.com/fwlink/?linkid=525137"
powerpointdl="https://go.microsoft.com/fwlink/?linkid=525136"
worddl="https://go.microsoft.com/fwlink/?linkid=525134"
rdpdl="https://go.microsoft.com/fwlink/?linkid=868963"
autoupdatedl="https://go.microsoft.com/fwlink/?linkid=830196"
[ "$4" != "" ] && [ "$app" == "" ] && app=$4
pkgfile="microsoft${app}.pkg"
logfile="/Library/Logs/microsoft${app}installscript.log"
url="${app}dl"
/bin/echo "--" >> ${logfile}
/bin/echo "`date`: Downloading latest version of ${app}." >> ${logfile}
/usr/bin/curl -L -s -o /private/var/tmp/${pkgfile} ${!url}
/bin/echo "`date`: Installing..." >> ${logfile}
/usr/sbin/installer -pkg /private/var/tmp/${pkgfile} -target /
/bin/sleep 10
/bin/echo "`date`: Deleting package file." >> ${logfile}
/bin/rm /private/var/tmp/"${pkgfile}"
exit 0