This repository has been archived by the owner on Oct 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flash_player_ppapi-munki.sh
132 lines (92 loc) · 5.01 KB
/
flash_player_ppapi-munki.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
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
122
123
124
125
126
127
128
129
130
131
132
#!/bin/bash
# This script downloads and installs the latest Flash player for compatible Macs
#munkirepo
munkirepo="/repos/munki/"
#Catalog
munki_cat="Catalog"
munki_cat2="testing"
#Set Proxy?
export http_proxy=http://10.0.0.1:800
export https_proxy=$http_proxy
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$http_proxy
# Determine OS version
osvers=$(sw_vers -productVersion | awk -F. '{print $2}')
# Determine current major version of Adobe Flash for use
# with the fileURL variable
flash_version=`/usr/bin/curl --silent http://fpdownload2.macromedia.com/get/flashplayer/update/current/xml/version_en_mac_pl.xml | sed -n 's/.*update version="\([^"]*\).*/\1/p' | sed 's/,/./g'`
# Specify the complete address of the Adobe Flash Player
# disk image
fileURL="https://fpdownload.adobe.com/get/flashplayer/pdc/"$flash_version"/install_flash_player_osx_ppapi.dmg"
# Specify name of downloaded disk image
flash_dmg="/tmp/flash_ppapi.dmg"
if [[ ${osvers} -lt 6 ]]; then
echo "Adobe Flash Player is not available for Mac OS X 10.5.8 or below."
fi
if [ -e /Library/Internet\ Plug-Ins/PepperFlashPlayer/PepperFlashPlayer.plugin/Contents/Info.plist ];then
currentinstalledPPAPI=`/usr/bin/defaults read /Library/Internet\ Plug-Ins/PepperFlashPlayer/PepperFlashPlayer.plugin/Contents/Info.plist CFBundleShortVersionString`
else
currentinstalledPPAPI="0"
fi
if [ "${currentinstalledPPAPI}" != "${flash_version}" ]; then
if [[ ${osvers} -ge 6 ]]; then
# Download the latest Adobe Flash Player software disk image
/usr/bin/curl --output "$flash_dmg" "$fileURL"
# Specify a /tmp/flashplayer.XXXX mountpoint for the disk image
TMPMOUNT=`/usr/bin/mktemp -d /tmp/flashplayer.XXXX`
TMPMOUNT2=`/usr/bin/mktemp -d /tmp/flashplayer.XXXX`
# Mount the latest Flash Player disk image to /tmp/flashplayer.XXXX mountpoint
hdiutil attach "$flash_dmg" -mountpoint "$TMPMOUNT" -nobrowse -noverify -noautoopen
# Install Adobe Flash Player using the installer package. This installer may
# be stored inside an install application on the disk image, or there may be
# an installer package available at the root of the mounted disk image.
if [[ -e "$(/usr/bin/find $TMPMOUNT -maxdepth 1 \( -iname \*Flash*\.pkg -o -iname \*Flash*\.mpkg \))" ]]; then
pkg_path="$(/usr/bin/find $TMPMOUNT -maxdepth 1 \( -iname \*Flash*\.pkg -o -iname \*Flash*\.mpkg \))"
elif [[ -e "$(/usr/bin/find $TMPMOUNT -maxdepth 1 \( -iname \*\.app \))" ]]; then
adobe_app=`(/usr/bin/find $TMPMOUNT -maxdepth 1 \( -iname \*\.app \))`
if [[ -e "$(/usr/bin/find "$adobe_app"/Contents/Resources -maxdepth 1 \( -iname \*Flash*\.pkg -o -iname \*Flash*\.mpkg \))" ]]; then
pkg_path="$(/usr/bin/find "$adobe_app"/Contents/Resources -maxdepth 1 \( -iname \*Flash*\.pkg -o -iname \*Flash*\.mpkg \))"
fi
fi
# Before installation on Mac OS X 10.7.x and later, the installer's
# developer certificate is checked to see if it has been signed by
# Adobe's developer certificate. Once the certificate check has been
# passed, the package is then installed.
if [[ ${pkg_path} != "" ]]; then
if [[ ${osvers} -ge 7 ]]; then
signature_check=`/usr/sbin/pkgutil --check-signature "$pkg_path" | awk /'Developer ID Installer/{ print $5 }'`
if [[ ${signature_check} = "Adobe" ]]; then
# Install Adobe Flash Player from the installer package stored inside the disk image
/usr/sbin/installer -dumplog -verbose -pkg "${pkg_path}" -target "/"
fi
fi
# On Mac OS X 10.6.x, the developer certificate check is not an
# available option, so the package is just installed.
if [[ ${osvers} -eq 6 ]]; then
# Install Adobe Flash Player from the installer package stored inside the disk image
/usr/sbin/installer -dumplog -verbose -pkg "${pkg_path}" -target "/"
fi
fi
# Munki Import
cp "$TMPMOUNT"/"Install Adobe Pepper Flash Player.app/Contents/Resources/Adobe Flash Player.pkg" "$TMPMOUNT2"/"Adobe Flash Player-PPAPI.pkg"
/usr/local/munki/munkiimport "$TMPMOUNT2"/"Adobe Flash Player-PPAPI.pkg" --name="Adobe Flash Player PPAPI" --update-for="Adobe Flash Player-PPAPI.pkg" --displayname="Adobe Flash Player PPAPI" --developer="Adobe" --description="Adobe Flash Player PPAPI" --pkgvers="${flash_version}" --unattended_install --unattended_uninstall --nointeractive --repo-path="${munkirepo}" -c "${munki_cat}" -c "${munki_cat2}"
# Clean-up
# Unmount the Flash Player disk image from /tmp/flashplayer.XXXX
/usr/bin/hdiutil detach "$TMPMOUNT"
# Remove the /tmp/flashplayer.XXXX mountpoint
/bin/rm -rf "$TMPMOUNT"
/bin/rm -rf "$TMPMOUNT2"
# Remove the downloaded disk image
/bin/rm -rf "$flash_dmg"
fi
newlyinstalledPPAPI=`/usr/bin/defaults read /Library/Internet\ Plug-Ins/PepperFlashPlayer/PepperFlashPlayer.plugin/Contents/Info.plist CFBundleShortVersionString`
if [ "${flash_version}" = "${newlyinstalledPPAPI}" ]; then
/bin/echo "`date`: SUCCESS: PPAPI Flash has been updated to version ${newlyinstalledPPAPI}"
else
/bin/echo "`date`: ERROR: PPAPI Flash update unsuccessful, version remains at ${currentinstalledPPAPI}."
fi
# If Flash is up to date already, just log it and exit.
else
/bin/echo "`date`: PPAPI Flash is already up to date, running ${currentinstalledPPAPI}."
fi
exit 0