-
Notifications
You must be signed in to change notification settings - Fork 2
/
jpiperberg-downloadLatestZoom
121 lines (94 loc) · 4.52 KB
/
jpiperberg-downloadLatestZoom
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/bash
# Intended to be run from Jamf, but can run locally
# Downloads and installs the latest ZoomITInstaller and dynamically writes a config profile
# Only downloads if the version on disk is more than 2 days from the release date in the RSS feed.
## JAMF default parameters
# $1 - Mount Point of target Drive
# $2 - Computer Name
# $3 - Username of account triggering the policy
pathToPackage=$1
targetLocation=$2
targetVolume=$3
####################################################################
### Specify the name and location of the vendor's installer file here ###
####################################################################
AppName="Zoom"
AppLocation="/Applications/zoom.us.app"
downloadURL="https://zoom.us/client/latest/ZoomInstallerIT.pkg"
Installer="/tmp/jamf/Zoom/ZoomInstallerIT.pkg"
configFile="us.zoom.config.plist"
configFileLocation="/tmp/jamf/Zoom/"
vendorUpdateURL="https://status.zoom.us/history.rss"
orgLoginURL="https://orgName.zoom.us"
if [ -e "$AppLocation" ] ;
then
# Check released version and creation date of application on disk to determine if we should continue.
# sed is removing tags, and removing all whitespace
latestReleaseDate=$(/usr/bin/curl $vendorUpdateURL | grep version -A1 | grep pubDate | sed -e 's/<pubDate>//' -e 's/<\/pubDate>//' -e 's/,//' -e 's/^ *//g')
if [ ! -z "$latestReleaseDate" ]; then
# If we have a release date we can compare to the version on disk to see if we need an update
# Convert release date to easier to read format
latestReleaseDateEpochTime=$(/bin/date -j -u -f "%a %d %b %Y %T %z" "$latestReleaseDate" "+%s")
# Get creation date of application (we don't care about time)
diskAppCreationDate=$(/usr/bin/stat -t "%b%d%Y" /Applications/zoom.us.app/Contents/Resources/Zoom-Info.plist | awk '{print $9}' | sed 's/\"//g')
diskAppCreationDateEpochTime=$(/bin/date -j -u -f "%b%d%Y" "$diskAppCreationDate" "+%s")
twoDaysAhead=$(($latestReleaseDateEpochTime + 172800))
twoDaysBehind=$(($latestReleaseDateEpochTime - 172800))
if [ $diskAppCreationDateEpochTime -le $twoDaysAhead ] && [ $diskAppCreationDateEpochTime -ge $twoDaysBehind ]; then
echo "date on disk within two days of release, skipping"
exit 0;
else
# Need to update
echo "version out of date"
fi
else
echo "no recent releases of this product, skipping"
exit 0;
# Stop here, nothing to do
else
echo "no app installed, proceeding"
fi
# Download Application
/usr/bin/curl -L $downloadURL -o "$Installer" --create-dirs
###################################################
# If present, Remove the earlier copies of the Application from /Applications
# Start a running count of old apps we find
###################################################
OldCopy=0
# Look for current name copy of Application
if [ -e "$AppLocation" ]
then
let "OldCopy=OldCopy+1"
echo "Removing original App"
sudo rm -Rf "$AppLocation"
sleep 3
fi
# Report what was found when looking for older copies
if [ Oldcopy != 0 ]
then
# Report older name versions found
echo "Found $OldCopy Older .app copies"
else
# Report no older copies found
echo "No older named .apps found"
fi
####################################################
# if installer requires a plist or choice changes file, retrieve or create it here
####################################################
# Create config plist in install folder
/usr/libexec/PlistBuddy -c "Add :nogoogle bool true" "$configFileLocation$configFile"
/usr/libexec/PlistBuddy -c "Add :nofacebook bool true" "$configFileLocation$configFile"
/usr/libexec/PlistBuddy -c "Add :setwebdomain string $orgLoginURL" "$configFileLocation$configFile"
/usr/libexec/PlistBuddy -c "Add :ZAutoSSOLogin bool true" "$configFileLocation$configFile"
/usr/libexec/PlistBuddy -c "Add :ZSSOHost string orgName.zoom.us" "$configFileLocation$configFile"
/usr/libexec/PlistBuddy -c "Add :ZRemoteControlAllApp bool true" "$configFileLocation$configFile"
####################################################
# Run Installer
####################################################
# Install with pre-configured settings
# https://support.zoom.us/hc/en-us/articles/115001799006-Mass-deploying-with-preconfigured-settings-for-macOS
installer -pkg /tmp/jamf/Zoom/ZoomInstallerIT.pkg -target /
# Remove install files
rm -rf /tmp/jamf/Zoom
echo "Finished! Check status messages above"
exit 0 ## Success