Posted on 07-01-2013 09:25 AM
Deleted old cringey script , the real one is below.
Posted on 05-23-2017 11:20 AM
We have been utilizing a script and Casper policy such as described here, to update Flash, and it has been working for 2+ years, except it broke last December 2016 and again some time around May 15, 2017.
I think what broke the script is a direct-download link to the installer is no longer available: Now the first page requires authentication with your AdobeID and is just a listing of all available installers (this is the link we are not allowed to post as per the Adobe distribution license agreement).
Anyone seeing the same in your environment? For now, I have gone back to a standard enterprise-style deployment, using the Flash PKG and a SmartGroup to determine scope.
Posted on 05-23-2017 01:44 PM
Yep, our script stopped working too! If anybody figures out a way around this, do share! :)
Thanks,
Matt
Posted on 05-24-2017 02:11 AM
We use this url for version checking: "http://fpdownload2.macromedia.com/get/flashplayer/update/current/xml/version_en_mac_pl.xml"
curl --connect-timeout 8 --max-time 8 -sf "http://fpdownload2.macromedia.com/get/flashplayer/update/current/xml/version_en_mac_pl.xml" 2>/dev/null | xmllint --format - 2>/dev/null | awk -F'"' '/<update version/{print $2}' | sed 's/,/./g'
and use this to download the latest version (where "$evalFunc" = the reported version number)
"https://fpdownload.adobe.com/get/flashplayer/pdc/"$evalFunc"/install_flash_player_osx.dmg"
This is still working today..
Posted on 06-14-2017 11:47 AM
Thanks rblaas. Adapted the original script accordingly. worked when I stepped through at the command line. will try it out with users tomorrow. woot
Posted on 06-14-2017 12:41 PM
This worked fantastic! Thanks for sharing.
Posted on 06-22-2017 09:17 AM
Just in case anyone else would like a copy of the updated script, I can confirm that the following is currently working for me:
#!/bin/sh -x
#####################################################################################################
#
# ABOUT THIS PROGRAM
#
# NAME
# UpdateFlash.sh -- Installs or updates Adobe Flash Player
#
#
####################################################################################################
#
# Peter Loobuyck grabbed bits from the net
#
####################################################################################################
dmgfile="flash.dmg"
volname="Flash"
logfile="/Library/Logs/jamf.log"
#
latestver=`/usr/bin/curl --connect-timeout 8 --max-time 8 -sf "http://fpdownload2.macromedia.com/get/flashplayer/update/current/xml/version_en_mac_pl.xml" 2>/dev/null | xmllint --format - 2>/dev/null | awk -F'"' '/<update version/{print $2}' | sed 's/,/./g'`
# Get the version number of the currently-installed Flash Player, if any.
shortver=${latestver:0:2}
url="https://fpdownload.adobe.com/get/flashplayer/pdc/"$latestver"/install_flash_player_osx.dmg"
currentinstalledver=`/usr/bin/defaults read "/Library/Internet Plug-Ins/Flash Player.plugin/Contents/version" CFBundleShortVersionString`
#else
# currentinstalledver="none"
#fi
# Compare the two versions, if they are different of Flash is not present then download and install the new version.
if [ "${currentinstalledver}" != "${latestver}" ]; then
/bin/echo "`date`: Current Flash version: ${currentinstalledver}" >> ${logfile}
/bin/echo "`date`: Available Flash version: ${latestver}" >> ${logfile}
/bin/echo "`date`: Downloading newer version." >> ${logfile}
/usr/bin/curl -s -o `/usr/bin/dirname $0`/flash.dmg $url
/bin/echo "`date`: Mounting installer disk image." >> ${logfile}
/usr/bin/hdiutil attach `dirname $0`/flash.dmg -nobrowse -quiet
/bin/echo "`date`: Installing..." >> ${logfile}
/usr/sbin/installer -pkg /Volumes/Flash Player/Install Adobe Flash Player.app/Contents/Resources/Adobe Flash Player.pkg -target / > /dev/null
/bin/sleep 10
/bin/echo "`date`: Unmounting installer disk image." >> ${logfile}
/usr/bin/hdiutil detach $(/bin/df | /usr/bin/grep ${volname} | awk '{print $1}') -quiet
/bin/sleep 10
/bin/echo "`date`: Deleting disk image." >> ${logfile}
/bin/rm `/usr/bin/dirname $0`/${dmgfile}
newlyinstalledver=`/usr/bin/defaults read "/Library/Internet Plug-Ins/Flash Player.plugin/Contents/version" CFBundleShortVersionString`
if [ "${latestver}" = "${newlyinstalledver}" ]; then
/bin/echo "`date`: SUCCESS: Flash has been updated to version ${newlyinstalledver}" >> ${logfile}
else
/bin/echo "`date`: ERROR: Flash update unsuccessful, version remains at ${currentinstalledver}." >> ${logfile}
/bin/echo "--" >> ${logfile}
fi
# If Flash is up to date already, just log it and exit.
else
/bin/echo "`date`: Flash is already up to date, running ${currentinstalledver}." >> ${logfile}
/bin/echo "--" >> ${logfile}
fi
Posted on 07-12-2017 09:54 AM
Script works great to update the NPAPI plugin. Is there a way to update the PPAPI plugin as well?
Posted on 11-02-2017 01:42 PM
@agerson There's a good PPAPI script here: https://www.jamf.com/jamf-nation/discussions/23579/ppapi-version-check-update-script
Posted on 12-14-2017 03:26 AM
Sorry to keep this going, but the latest script failed on a few of our machines because there was a space in the $0 path. The following update seems to resolve the issue...
#!/bin/sh -x
#####################################################################################################
#
# ABOUT THIS PROGRAM
#
# NAME
# UpdateFlash.sh -- Installs or updates Adobe Flash Player
#
#
####################################################################################################
#
# 14-Dec-2017 (bkp): Updated to support $0 with spaces in path
# Peter Loobuyck grabbed bits from the net
#
####################################################################################################
dmgfile="flash.dmg"
volname="Flash"
logfile="/Library/Logs/jamf.log"
srcPath=`/usr/bin/dirname "${0}"`
#
latestver=`/usr/bin/curl --connect-timeout 8 --max-time 8 -sf "http://fpdownload2.macromedia.com/get/flashplayer/update/current/xml/version_en_mac_pl.xml" 2>/dev/null | xmllint --format - 2>/dev/null | awk -F'"' '/<update version/{print $2}' | sed 's/,/./g'`
# Get the version number of the currently-installed Flash Player, if any.
shortver=${latestver:0:2}
url="https://fpdownload.adobe.com/get/flashplayer/pdc/"$latestver"/install_flash_player_osx.dmg"
currentinstalledver=`/usr/bin/defaults read "/Library/Internet Plug-Ins/Flash Player.plugin/Contents/version" CFBundleShortVersionString`
#else
# currentinstalledver="none"
#fi
# Compare the two versions, if they are different of Flash is not present then download and install the new version.
if [ "${currentinstalledver}" != "${latestver}" ]; then
/bin/echo "`date`: Current Flash version: ${currentinstalledver}" >> ${logfile}
/bin/echo "`date`: Available Flash version: ${latestver}" >> ${logfile}
/bin/echo "`date`: Downloading newer version." >> ${logfile}
/usr/bin/curl -s -o "${srcPath}/${dmgfile}" $url
/bin/echo "`date`: Mounting installer disk image." >> ${logfile}
/usr/bin/hdiutil attach "${srcPath}/${dmgfile}" -nobrowse -quiet
/bin/echo "`date`: Installing..." >> ${logfile}
/usr/sbin/installer -pkg /Volumes/Flash Player/Install Adobe Flash Player.app/Contents/Resources/Adobe Flash Player.pkg -target / > /dev/null
/bin/sleep 10
/bin/echo "`date`: Unmounting installer disk image." >> ${logfile}
/usr/bin/hdiutil detach $(/bin/df | /usr/bin/grep ${volname} | awk '{print $1}') -quiet
/bin/sleep 10
/bin/echo "`date`: Deleting disk image." >> ${logfile}
/bin/rm "${srcPath}/${dmgfile}"
newlyinstalledver=`/usr/bin/defaults read "/Library/Internet Plug-Ins/Flash Player.plugin/Contents/version" CFBundleShortVersionString`
if [ "${latestver}" = "${newlyinstalledver}" ]; then
/bin/echo "`date`: SUCCESS: Flash has been updated to version ${newlyinstalledver}" >> ${logfile}
else
/bin/echo "`date`: ERROR: Flash update unsuccessful, version remains at ${currentinstalledver}." >> ${logfile}
/bin/echo "--" >> ${logfile}
fi
# If Flash is up to date already, just log it and exit.
else
/bin/echo "`date`: Flash is already up to date, running ${currentinstalledver}." >> ${logfile}
/bin/echo "--" >> ${logfile}
fi
Posted on 10-26-2018 09:42 AM
I am trying to run this script on a test computer via a policy, and according to the jamf logs (in the jamf pro web portal) the policy ran successfully, but I do not see a jamf log at /Library/Logs. Does the log file have to pre-exist, or should the log file be created automatically?
Posted on 10-29-2018 05:01 AM
We use a similar but different script, this does seem to be working for patching flash on our Macs 79% are on the latest version.
#!/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.
#
##################################################################
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}"
}
## 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
exit 0;