updateTool now working. Improved log for this, as well as creating a finishing function so that we can call this when updateTool was used.
This commit is contained in:
Søren Theilgaard
2021-04-12 20:16:47 +02:00
parent 5c6e37dd88
commit 4fe2c926f4
2 changed files with 30 additions and 20 deletions

View File

@@ -12,6 +12,7 @@
- If your MDM cannot call a script with parameters, the label can be set in the top of the script.
- If your MDM is not Jamf Pro, and you need the script to be installed locally on your managed machines, then take a look at [Theiles fork](https://github.com/Theile/Installomator/). This fork can be called from the MDM using a small script.
- Script `buildCaseStatement.sh` to help with creating labels have been improved.
- Fixed a bug in a variable name that prevented updateTool to be used
## v0.4 - 2020-10-19

View File

@@ -693,6 +693,7 @@ installAppInDmgInZip() {
}
runUpdateTool() {
printlog "Function called: runUpdateTool"
if [[ -x $updateTool ]]; then
printlog "running $updateTool $updateToolArguments"
if [[ -n $updateToolRunAsCurrentUser ]]; then
@@ -710,6 +711,25 @@ runUpdateTool() {
return 0
}
finishing() {
printlog "Finishing…"
sleep 10 # wait a moment to let spotlight catch up
getAppVersion
if [[ -z $appversion ]]; then
message="Installed $name"
else
message="Installed $name, version $appversion"
fi
printlog "$message"
if [[ $currentUser != "loginwindow" && ( $NOTIFY == "success" || $NOTIFY == "all" ) ]]; then
printlog "notifying"
displaynotification "$message" "$name update/installation complete!"
fi
}
# MARK: check minimal macOS requirement
autoload is-at-least
@@ -2932,8 +2952,8 @@ microsoftteams)
# Still using macadmin.software for version, as the path does not contain the version in a matching format. packageID can be used, but version is the same.
expectedTeamID="UBF8T346G9"
blockingProcesses=( Teams "Microsoft Teams Helper" )
#updateTool="/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app/Contents/MacOS/msupdate"
#updateToolArguments=( --install --apps TEAM01 )
updateTool="/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app/Contents/MacOS/msupdate"
updateToolArguments=( --install --apps TEAM01 )
;;
microsoftvisualstudiocode|\
visualstudiocode)
@@ -3117,11 +3137,14 @@ if ! cd "$tmpDir"; then
cleanupAndExit 1
fi
# MARK: check if this is an Update
# MARK: check if this is an Update and we can use updateTool
getAppVersion
if [[ -n $appVersion ]]; then
printlog "appversion: $appversion"
if [[ -n $appversion && -n "$updateTool" ]]; then
printlog "appversion & updateTool"
if [[ $DEBUG -eq 0 ]]; then
if runUpdateTool; then
finishing
cleanupAndExit 0
fi # otherwise continue
else
@@ -3223,22 +3246,8 @@ case $type in
;;
esac
# MARK: print installed application location and version
sleep 10 # wait a moment to let spotlight catch up
getAppVersion
if [[ -z $appversion ]]; then
message="Installed $name"
else
message="Installed $name, version $appversion"
fi
printlog "$message"
if [[ $currentUser != "loginwindow" && ( $NOTIFY == "success" || $NOTIFY == "all" ) ]]; then
printlog "notifying"
displaynotification "$message" "$name update/installation complete!"
fi
# MARK: Finishing — print installed application location and version
finishing
# all done!
cleanupAndExit 0