-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathcoreapp-flashplayer-install-or-update.sh
83 lines (63 loc) · 2.87 KB
/
coreapp-flashplayer-install-or-update.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
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
#!/bin/sh
###################################################################
#
# This script will check whether the currently installed version
# of Flash Player matches that available from Adobe's servers. If
# the versions differ, it will download the latest version and
# install it.
#
# Date: @@DATE
# Version: @@VERSION
# Origin: @@ORIGIN
# Released by JSS User: @@USER
#
##################################################################
install_flash() {
# Create a temporary directory in which to mount the .dmg
tmp_mount=`/usr/bin/mktemp -d /tmp/flashplayer.XXXX`
# Attach the install DMG directly from Adobe's servers (ensuring HTTPS)
hdiutil attach "$( eval echo "${DOWNLOAD_URL}" )" -nobrowse -quiet -mountpoint "${tmp_mount}"
# The package has used some slightly different naming schemes
pkg_path="$(/usr/bin/find ${tmp_mount} \( -iname \*Flash*\.pkg -o -iname \*Flash*\.mpkg \))"
# Install the package, logging as much as we can
/usr/sbin/installer -dumplog -verbose -pkg "${pkg_path}" -target "/"
# Let things settle down
sleep 1
# Detach the dmg and remove the temporary mountpoint
hdiutil detach "${tmp_mount}" && /bin/rm -rf "${tmp_mount}"
}
configure_flash() {
# Create mms.cfg file that sets the Flash Player preferences never to check for updates, since we use this script to.
# The /Library/Application\ Support/Macromedia folder it gets created in should already exist as this step is after the Flash install.
echo "****** Setting Flash Player to never check for updates ******"
cat <<EOF > /Library/Application\ Support/Macromedia/mms.cfg
AutoUpdateDisable=1
SilentAutoUpdateEnable=0
EOF
# Set file permissions
chown -R root:admin /Library/Application\ Support/Macromedia/mms.cfg
}
## URL pointing to a direct download of the Flash Player disk image
DOWNLOAD_URL=`curl http://get.adobe.com/flashplayer/webservices/json/ | python -m json.tool | grep osx.dmg | awk -F '"' '{sub(/^http:/, "https:", $4); print $4}'`
ME=$(basename "${0}")
installed_version="$(defaults read /Library/Internet\ Plug-Ins/Flash\ Player.plugin/Contents/version CFBundleShortVersionString)"
available_version="$(/usr/bin/curl --silent http://fpdownload2.macromedia.com/get/flashplayer/update/current/xml/version_en_mac_pl.xml |\
grep 'update version' | sed -E 's/.*update version="([0-9,]+)".*/\1/;s/,/./g')"
# If the version installed differs at all from the available version then we want to update
case "${installed_version}" in
"${available_version}")
echo "$ME: Flash version checked OK (${available_version})"
;;
*)
echo "$ME: Flash version differs - installed: ${installed_version} available ${available_version}"
install_flash
;;
esac
# Apply the Flash preferences config.
if [ -d /Library/Application\ Support/Macromedia ]; then
configure_flash
else
mkdir /Library/Application\ Support/Macromedia
configure_flash
fi
exit 0;