Skip to main content
Question

Flash Update Script


Show first post

90 replies

mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • May 18, 2017

Any particular reason not to curl against the official Adobe FlashPlayer Mac version xml file instead of trying to scrape the page?

$ curl -sf http://fpdownload2.macromedia.com/get/flashplayer/update/current/xml/version_en_mac_pl.xml | xmllint --format - | awk -F'"' '/<update version/{print $2}' | sed 's/,/./g'
$ 25.0.0.171

Forum|alt.badge.img+16
  • Valued Contributor
  • 401 replies
  • May 18, 2017

Oh, the xml file is good to know. How's it updated though when the NPAPI and the PPAPI versions diverge (happened a couple of weeks ago)?


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • May 19, 2017

Hmm. That's a good question, which I don't know the answer to. As far as I can tell, that xml will always show the most current NPAPI version. I'm not sure how Adobe handles it for PPAPI though. I get the feeling that xml is only for NPAPI, and just by coincidence it often matches up with the PPAPI version, except for on occasion.


peterlbk
Forum|alt.badge.img+11
  • Jamf Heroes
  • 67 replies
  • May 19, 2017

Hi Guys, the latest curl line on here didn't work for me. I added one last awk request to it:

curl -s http://get.adobe.com/flashplayer/about/ | grep -A4 "Macintosh" | grep -A2 "Safari" | sed -e 's/<[^>][^>]>//g' -e '/^ $/d' | tail -n 1 | awk '{print $1}' | tr -d "
" | awk -F "<" '{print$1}'

As for why we don't use the xml, it's a fact that that source of version checking is not available.


Forum|alt.badge.img+7
  • Contributor
  • 19 replies
  • May 23, 2017

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.


Forum|alt.badge.img+17
  • Valued Contributor
  • 178 replies
  • May 23, 2017

Yep, our script stopped working too! If anybody figures out a way around this, do share! :)

Thanks,
Matt


Forum|alt.badge.img+8
  • Contributor
  • 118 replies
  • May 24, 2017

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..


Forum|alt.badge.img+7

Thanks rblaas. Adapted the original script accordingly. worked when I stepped through at the command line. will try it out with users tomorrow. woot


Forum|alt.badge.img+17
  • Valued Contributor
  • 178 replies
  • June 14, 2017

@rblaas

This worked fantastic! Thanks for sharing.


Forum|alt.badge.img+7
  • Contributor
  • 32 replies
  • June 22, 2017

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

Forum|alt.badge.img+5
  • Contributor
  • 39 replies
  • July 12, 2017

Script works great to update the NPAPI plugin. Is there a way to update the PPAPI plugin as well?


Forum|alt.badge.img+3
  • New Contributor
  • 5 replies
  • November 2, 2017

@agerson There's a good PPAPI script here: https://www.jamf.com/jamf-nation/discussions/23579/ppapi-version-check-update-script


Forum|alt.badge.img+5
  • Contributor
  • 26 replies
  • December 14, 2017

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

Forum|alt.badge.img+8
  • Valued Contributor
  • 79 replies
  • October 26, 2018

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?


dsavageED
Forum|alt.badge.img+8
  • New Contributor
  • 169 replies
  • October 29, 2018

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;

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings