PPAPI version check / update script?

RobertBasil
Contributor

Anyone know of a PPAPI check / update script? I've searched all over with no luck.

1 ACCEPTED SOLUTION

Wakko
Release Candidate Programs Tester

Robert,

Try this out, it's what I've been using on my JumpStarts. It's something we found JAMFNation and been updating as needed.

By default, it will not install flash on a machine that does not have it so you can scope to All if you wish without worrying installing on a system which Flash is purposely kept off. If you would like to override this behavior and install Flash as part of a thin-imaging policy, then edit the script and remove the ## on the following lines.

Line 93 ##
Update_Flash
Line 116 ##
Update_Flash

Also, Lines 119-161, will set System Preferences > Flash > Updates to “Never Check for Updates".

#!/bin/sh
## Created by Ariel Peralta - Carbon Technologies, 31-May-2016
## Original by Peter Loobuyck, 26-Jan-2016
## Inspired by https://jamfnation.jamfsoftware.com/discussion.html?id=7658
## Update 15-Jan-2017
## This scripts take into consideration new Adobe download URLs as per https://www.jamf.com/jamf-nation/discussions/7658/flash-update-script
## Removed old download URLs, shortver variable, and updated fileURL variables

## Name of the temporary dmg that will be created when Adobe Flash Installer is downloaded.  
## This file will be automatically created and deleted after installation
flash_dmg="/tmp/FlashInstaller.dmg"

# Specify a /tmp/flash_update.XXXX mountpoint for the disk image
TMPMOUNT=`/usr/bin/mktemp -d /tmp/flash_update.XXXX`

## This Function will take defined variables and install Flash
Update_Flash () {
    ## Compare the two versions, if they are different of Flash download and install the new version. 
    if [ "${currentinstalledver}" != "${latestver}" ]; then
        /bin/echo "`date`: Current Flash ${FlashType} version: ${currentinstalledver}"
        /bin/echo "`date`: Available Flash ${FlashType} version: ${latestver}"
        /bin/echo "`date`: Downloading newer ${FlashType} version."

        # Download and Mount Flash Plugin disk image to /tmp/flash_update.XXXX mountpoint
        /usr/bin/curl -S -# -o "$flash_dmg" "$fileURL"      
        /bin/echo "`date`: Mounting installer disk image." 
        hdiutil attach "$flash_dmg" -mountpoint "$TMPMOUNT" -nobrowse -noverify -noautoopen

        # Before installation, 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
            signature_check=`/usr/sbin/pkgutil --check-signature "$pkg_path" | awk /'Developer ID Installer/{ print $5 }'`
            if [[ ${signature_check} = "Adobe" ]]; then
                # Install Flash from the installer package stored inside the disk image
                /bin/echo "`date`: Installing..."
                /usr/sbin/installer -pkg "${pkg_path}" -target "/"
            fi
        fi

        # Clean-up

        # Unmount the Flash disk image from /tmp/flash_update.XXXX
            /bin/sleep 10
            /bin/echo "`date`: Unmounting installer disk image."
            /usr/bin/hdiutil detach -force "$TMPMOUNT"

        # Remove the /tmp/flash_update.XXXX mountpoint      
            /bin/sleep 10
            /bin/echo "`date`: Deleting disk image."
            /bin/rm -rf "$TMPMOUNT"

        # Remove the downloaded disk image
            /bin/rm -rf "$flash_dmg"

        # Check to see if update was successful         
            newlyinstalledver=`/usr/bin/defaults read "${plugincheck}" CFBundleShortVersionString`
            if [ "${latestver}" = "${newlyinstalledver}" ]; then
                    /bin/echo "`date`: SUCCESS: Flash ${FlashType} has been updated to version ${newlyinstalledver}"
            else
                /bin/echo "`date`: ERROR: Flash ${FlashType} update unsuccessful, version remains at ${currentinstalledver}."
                /bin/echo "--"
            fi

    ## If Flash is up to date already, just log it and exit.       
    else
        /bin/echo "`date`: Flash ${FlashType} Plug-in is already up to date, running ${currentinstalledver}."
        /bin/echo "--"
    fi
}

## Set NPAPI Variables
## Query Adobe Flash Updater XML page and return latest version in decimal form 
latestver=`/usr/bin/curl --silent http://fpdownload2.macromedia.com/get/flashplayer/update/current/xml/version_en_mac_pl.xml | awk -F " /"update version="/'{print $2}' | sed s/,/./g`
fileURL=https://fpdownload.adobe.com/get/flashplayer/pdc/"${latestver}"/install_flash_player_osx.dmg
plugincheck="/Library/Internet Plug-Ins/Flash Player.plugin/Contents/info"
pkg_path=$TMPMOUNT/Install Adobe Flash Player.app/Contents/Resources/Adobe Flash Player.pkg
FlashType=NPAPI

## Check and get the version number of the currently-installed Flash Player NPAPI Plugin, if any.
if
    [ -e "${plugincheck}.plist" ]; then
        currentinstalledver=`/usr/bin/defaults read "${plugincheck}" CFBundleShortVersionString`
        ## Calling function to update NPAPI plugin
        Update_Flash
else
    /bin/echo "`date`: No Flash NPAPI Plug-in Installed."
    /bin/echo "--"
    currentinstalledver=none
    ## Remove ## From Line below if you want to force Flash Install on new systems during thin-imaging
##  Update_Flash

fi          

## Set PPAPI Variables
latestver=`/usr/bin/curl --silent http://fpdownload2.macromedia.com/get/flashplayer/update/current/xml/version_en_mac_pep.xml | awk -F " /"update version="/'{print $2}' | sed s/,/./g`
fileURL=https://fpdownload.adobe.com/get/flashplayer/pdc/"${latestver}"/install_flash_player_osx_ppapi.dmg
plugincheck="/Library/Internet Plug-Ins/PepperFlashPlayer/PepperFlashPlayer.plugin/Contents/info"
pkg_path=$TMPMOUNT/Install Adobe Pepper Flash Player.app/Contents/Resources/Adobe Flash Player.pkg
FlashType=PPAPI

## Check and get the version number of the currently-installed Flash Player PPAPI (Pepper) Plugin, if any.
if
    [ -e "${plugincheck}.plist" ]; then
        currentinstalledver=`/usr/bin/defaults read "${plugincheck}" CFBundleShortVersionString`
        ## Find latest version of Flash
        ## Calling function to update PPAPI plugin
        Update_Flash
else
    /bin/echo "`date`: No Flash PPAPI Plug-in Installed."
    /bin/echo "--"
    currentinstalledver=none
    ## Remove ## From Line below if you want to force Flash Install on new systems during thin-imaging
##  Update_Flash    
fi

# Configure Adobe Flash to *not* update
# This will set the preference for both NPAPI and PPAPI
#
# Modified by Ariel Peralta, 31-May-2016
# Modified by Carlos Echevarria, 7-Apr-2016
# Modified by Chris Jackson, 3-Mar-2016
# Original by Dan K. Snelson, 7-Nov-2014
#
# Inspired by Lance Berrier
# https://jamfnation.jamfsoftware.com/viewProfile.html?userID=12774

directory="/Library/Application Support/Macromedia/"
file="/Library/Application Support/Macromedia/mms.cfg"

if [ -f "$file" ] ; then

    # Flash Player is installed, has been launched and mms.cfg exists
    # let's configure it to not update

    grep -q -r "AutoUpdateDisable" "$file" && sed -i '' 's/AutoUpdateDisable=0|AutoUpdateDisable=1/AutoUpdateDisable=1/g' "$file" || echo "AutoUpdateDisable=1" >> "$file"
    grep -q -r "SilentAutoUpdateEnable" "$file" && sed -i '' 's/SilentAutoUpdateEnable=0|SilentAutoUpdateEnable=1/SilentAutoUpdateEnable=0/g' "$file" || echo "SilentAutoUpdateEnable=0" >> "$file"
    grep -q -r "DisableAnalytics" "$file" && sed -i '' 's/DisableAnalytics=0|DisableAnalytics=1/DisableAnalytics=1/g' "$file" || echo "DisableAnalytics=1" >> "$file"

    RESULT="Configured Adobe Flash Update Preferences to Never Check for Updates"

else
    ## Only create update override if flash is installed.  If no flash is installed by this point, then leave alone.
    if [ -e "${plugincheck}.plist" ] ; then
        # mms.cfg doesn't exsist, but flash is installed
        mkdir "${directory}"

        echo "AutoUpdateDisable=1" >> "$file"
        echo "SilentAutoUpdateEnable=0" >> "$file"
        echo "DisableAnalytics=1" >> "$file" 

        RESULT="Created and configured Adobe Flash Update Preferences to Never Check for Updates"

    else
        echo "No Plugin installed, no changes made to Adobe Flash Update Preferences"
    fi
fi

echo "$RESULT"

View solution in original post

9 REPLIES 9

Wakko
Release Candidate Programs Tester

Robert,

Try this out, it's what I've been using on my JumpStarts. It's something we found JAMFNation and been updating as needed.

By default, it will not install flash on a machine that does not have it so you can scope to All if you wish without worrying installing on a system which Flash is purposely kept off. If you would like to override this behavior and install Flash as part of a thin-imaging policy, then edit the script and remove the ## on the following lines.

Line 93 ##
Update_Flash
Line 116 ##
Update_Flash

Also, Lines 119-161, will set System Preferences > Flash > Updates to “Never Check for Updates".

#!/bin/sh
## Created by Ariel Peralta - Carbon Technologies, 31-May-2016
## Original by Peter Loobuyck, 26-Jan-2016
## Inspired by https://jamfnation.jamfsoftware.com/discussion.html?id=7658
## Update 15-Jan-2017
## This scripts take into consideration new Adobe download URLs as per https://www.jamf.com/jamf-nation/discussions/7658/flash-update-script
## Removed old download URLs, shortver variable, and updated fileURL variables

## Name of the temporary dmg that will be created when Adobe Flash Installer is downloaded.  
## This file will be automatically created and deleted after installation
flash_dmg="/tmp/FlashInstaller.dmg"

# Specify a /tmp/flash_update.XXXX mountpoint for the disk image
TMPMOUNT=`/usr/bin/mktemp -d /tmp/flash_update.XXXX`

## This Function will take defined variables and install Flash
Update_Flash () {
    ## Compare the two versions, if they are different of Flash download and install the new version. 
    if [ "${currentinstalledver}" != "${latestver}" ]; then
        /bin/echo "`date`: Current Flash ${FlashType} version: ${currentinstalledver}"
        /bin/echo "`date`: Available Flash ${FlashType} version: ${latestver}"
        /bin/echo "`date`: Downloading newer ${FlashType} version."

        # Download and Mount Flash Plugin disk image to /tmp/flash_update.XXXX mountpoint
        /usr/bin/curl -S -# -o "$flash_dmg" "$fileURL"      
        /bin/echo "`date`: Mounting installer disk image." 
        hdiutil attach "$flash_dmg" -mountpoint "$TMPMOUNT" -nobrowse -noverify -noautoopen

        # Before installation, 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
            signature_check=`/usr/sbin/pkgutil --check-signature "$pkg_path" | awk /'Developer ID Installer/{ print $5 }'`
            if [[ ${signature_check} = "Adobe" ]]; then
                # Install Flash from the installer package stored inside the disk image
                /bin/echo "`date`: Installing..."
                /usr/sbin/installer -pkg "${pkg_path}" -target "/"
            fi
        fi

        # Clean-up

        # Unmount the Flash disk image from /tmp/flash_update.XXXX
            /bin/sleep 10
            /bin/echo "`date`: Unmounting installer disk image."
            /usr/bin/hdiutil detach -force "$TMPMOUNT"

        # Remove the /tmp/flash_update.XXXX mountpoint      
            /bin/sleep 10
            /bin/echo "`date`: Deleting disk image."
            /bin/rm -rf "$TMPMOUNT"

        # Remove the downloaded disk image
            /bin/rm -rf "$flash_dmg"

        # Check to see if update was successful         
            newlyinstalledver=`/usr/bin/defaults read "${plugincheck}" CFBundleShortVersionString`
            if [ "${latestver}" = "${newlyinstalledver}" ]; then
                    /bin/echo "`date`: SUCCESS: Flash ${FlashType} has been updated to version ${newlyinstalledver}"
            else
                /bin/echo "`date`: ERROR: Flash ${FlashType} update unsuccessful, version remains at ${currentinstalledver}."
                /bin/echo "--"
            fi

    ## If Flash is up to date already, just log it and exit.       
    else
        /bin/echo "`date`: Flash ${FlashType} Plug-in is already up to date, running ${currentinstalledver}."
        /bin/echo "--"
    fi
}

## Set NPAPI Variables
## Query Adobe Flash Updater XML page and return latest version in decimal form 
latestver=`/usr/bin/curl --silent http://fpdownload2.macromedia.com/get/flashplayer/update/current/xml/version_en_mac_pl.xml | awk -F " /"update version="/'{print $2}' | sed s/,/./g`
fileURL=https://fpdownload.adobe.com/get/flashplayer/pdc/"${latestver}"/install_flash_player_osx.dmg
plugincheck="/Library/Internet Plug-Ins/Flash Player.plugin/Contents/info"
pkg_path=$TMPMOUNT/Install Adobe Flash Player.app/Contents/Resources/Adobe Flash Player.pkg
FlashType=NPAPI

## Check and get the version number of the currently-installed Flash Player NPAPI Plugin, if any.
if
    [ -e "${plugincheck}.plist" ]; then
        currentinstalledver=`/usr/bin/defaults read "${plugincheck}" CFBundleShortVersionString`
        ## Calling function to update NPAPI plugin
        Update_Flash
else
    /bin/echo "`date`: No Flash NPAPI Plug-in Installed."
    /bin/echo "--"
    currentinstalledver=none
    ## Remove ## From Line below if you want to force Flash Install on new systems during thin-imaging
##  Update_Flash

fi          

## Set PPAPI Variables
latestver=`/usr/bin/curl --silent http://fpdownload2.macromedia.com/get/flashplayer/update/current/xml/version_en_mac_pep.xml | awk -F " /"update version="/'{print $2}' | sed s/,/./g`
fileURL=https://fpdownload.adobe.com/get/flashplayer/pdc/"${latestver}"/install_flash_player_osx_ppapi.dmg
plugincheck="/Library/Internet Plug-Ins/PepperFlashPlayer/PepperFlashPlayer.plugin/Contents/info"
pkg_path=$TMPMOUNT/Install Adobe Pepper Flash Player.app/Contents/Resources/Adobe Flash Player.pkg
FlashType=PPAPI

## Check and get the version number of the currently-installed Flash Player PPAPI (Pepper) Plugin, if any.
if
    [ -e "${plugincheck}.plist" ]; then
        currentinstalledver=`/usr/bin/defaults read "${plugincheck}" CFBundleShortVersionString`
        ## Find latest version of Flash
        ## Calling function to update PPAPI plugin
        Update_Flash
else
    /bin/echo "`date`: No Flash PPAPI Plug-in Installed."
    /bin/echo "--"
    currentinstalledver=none
    ## Remove ## From Line below if you want to force Flash Install on new systems during thin-imaging
##  Update_Flash    
fi

# Configure Adobe Flash to *not* update
# This will set the preference for both NPAPI and PPAPI
#
# Modified by Ariel Peralta, 31-May-2016
# Modified by Carlos Echevarria, 7-Apr-2016
# Modified by Chris Jackson, 3-Mar-2016
# Original by Dan K. Snelson, 7-Nov-2014
#
# Inspired by Lance Berrier
# https://jamfnation.jamfsoftware.com/viewProfile.html?userID=12774

directory="/Library/Application Support/Macromedia/"
file="/Library/Application Support/Macromedia/mms.cfg"

if [ -f "$file" ] ; then

    # Flash Player is installed, has been launched and mms.cfg exists
    # let's configure it to not update

    grep -q -r "AutoUpdateDisable" "$file" && sed -i '' 's/AutoUpdateDisable=0|AutoUpdateDisable=1/AutoUpdateDisable=1/g' "$file" || echo "AutoUpdateDisable=1" >> "$file"
    grep -q -r "SilentAutoUpdateEnable" "$file" && sed -i '' 's/SilentAutoUpdateEnable=0|SilentAutoUpdateEnable=1/SilentAutoUpdateEnable=0/g' "$file" || echo "SilentAutoUpdateEnable=0" >> "$file"
    grep -q -r "DisableAnalytics" "$file" && sed -i '' 's/DisableAnalytics=0|DisableAnalytics=1/DisableAnalytics=1/g' "$file" || echo "DisableAnalytics=1" >> "$file"

    RESULT="Configured Adobe Flash Update Preferences to Never Check for Updates"

else
    ## Only create update override if flash is installed.  If no flash is installed by this point, then leave alone.
    if [ -e "${plugincheck}.plist" ] ; then
        # mms.cfg doesn't exsist, but flash is installed
        mkdir "${directory}"

        echo "AutoUpdateDisable=1" >> "$file"
        echo "SilentAutoUpdateEnable=0" >> "$file"
        echo "DisableAnalytics=1" >> "$file" 

        RESULT="Created and configured Adobe Flash Update Preferences to Never Check for Updates"

    else
        echo "No Plugin installed, no changes made to Adobe Flash Update Preferences"
    fi
fi

echo "$RESULT"

KSchroeder
Contributor

Very nice!

Wakko
Release Candidate Programs Tester

@KSchroeder it originated from JAMFNation. We just updated and tweaked it bit.

RobertBasil
Contributor

@Echevarria

Great script, thanks for sharing!

nvandam
Contributor II

How do you all have this scoped?

hunter990
Contributor

Awesome script, thank you. I do have a question, as of version 25.0.0.173 I am finding it is not disabling the settings for auto update. I have tinkered with it some, but I am still learning at scripting, and not sure what I am missing. Is anyone else having this issue?

@nvandam I have this scoped with 2 versions of the script. One I use a smart group based off of Patch Management to update when a new version comes out.

I have another edit of the script that sits in Self Service for users to install.

daniel_ross
Contributor III

Just noticed the site is broken when it tries to go it fails to update.

Anyone know the new URL for downloads?

listec
New Contributor III
2017-12-14 08:31:14.725 defaults[11300:2614099] The domain/default pair of (/Library/Internet Plug-Ins/PepperFlashPlayer/PepperFlashPlayer.plugin/Contents/info, CFBundleShortVersionString) does not exist

eljefemiller
New Contributor II

RESULT="Not Installed"

if [ -f "/Library/Internet Plug-Ins/PepperFlashPlayer/PepperFlashPlayer.plugin/Contents/Info.plist" ] ; then RESULT=$( /usr/bin/defaults read "/Library/Internet Plug-Ins/PepperFlashPlayer/PepperFlashPlayer.plugin/Contents/Info.plist" CFBundleVersion )
fi

echo "<result>$RESULT</result>"