-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcheckZoomAndUpdate.sh
35 lines (26 loc) · 1.02 KB
/
checkZoomAndUpdate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
if [ -e /Applications/zoom.us.app ]; then
zoomStatus=$(/usr/libexec/PlistBuddy -c "print ZITPackage" /Applications/zoom.us.app/Contents/Info.plist 2>/dev/null)
else echo "Zoom not installed"
exit 0
fi
if [[ $zoomStatus == true ]]; then
zoomAppType="zoomforIT"
echo "Zoom installed is already $zoomAppType"
exit 0
else zoomAppType="consumer"
fi
echo "Zoom installed is $zoomAppType"
assertedApps="$(/usr/bin/pmset -g assertions | /usr/bin/awk '/NoDisplaySleepAssertion | PreventUserIdleDisplaySleep/ && match($0,/\(.+\)/) && ! /coreaudiod/ {gsub(/^.*\(/,"",$0); gsub(/\).*$/,"",$0); print};')"
if [[ "${assertedApps}" =~ zoom.us ]]; then
echo "Zoom is running and in a video call."
echo exit 1
fi
echo "Safe to update Zoom now. Proceeding.."
/usr/local/Installomator/Installomator.sh zoom NOTIFY=silent BLOCKING_PROCESS_ACTION=ignore INSTALL=force
if pgrep -xq "zoom.us"; then
echo "Zoom is open, let's close and reopen it"
killall "zoom.us"
open -j -h "/Applications/zoom.us.app"
fi
exit 0