Adobe Acrobat Pro DC update script

deej
New Contributor III

Just wanted to share something I got working today in my Friday afternoon Google Time.
This is stolen "adapted" from Joe Farage's Reader updating script, but designed to update Acrobat Pro DC.

#!/bin/sh
#####################################################################################################
#
# ABOUT THIS PROGRAM
#
# NAME
#   AdobeAcrobatUpdate.sh -- Installs or updates Adobe Acrobat Pro DC
#
# SYNOPSIS
#   sudo AdobeAcrobatUpdate.sh
#
####################################################################################################
#
# HISTORY
#
#   Version: 1.2
#
#   - v.1.0 Joe Farage, 23.01.2015
#   - v.1.1 Joe Farage, 08.04.2015 : support for new Adobe Acrobat DC
#   - v.1.2 Deej, 10.11.2017: fork Reader script for Adobe Acrobat DC
#
####################################################################################################
# Script to download and install Adobe Acrobat Updates.
# Only works on Intel systems.

dmgfile="acrobat.dmg"
logfile="/Library/Logs/AdobeAcrobatDCUpdateScript.log"

# Are we running on Intel?
if [ '`/usr/bin/uname -p`'="i386" -o '`/usr/bin/uname -p`'="x86_64" ]; then
    ## Get OS version and adjust for use with the URL string
    OSvers_URL=$( sw_vers -productVersion | sed 's/[.]/_/g' )

    ## Set the User Agent string for use with curl
    userAgent="Mozilla/5.0 (Macintosh; Intel Mac OS X ${OSvers_URL}) AppleWebKit/535.6.2 (KHTML, like Gecko) Version/5.2 Safari/535.6.2"

    # Get the latest Update available from Adobe's Acrobat Support page.
    latestver=``
    while [ -z "$latestver" ]
    do
       latestver=`/usr/bin/curl -s -L -A "$userAgent" "http://supportdownloads.adobe.com/product.jsp?platform=macintosh&product=1" | grep '"data-sectionHead">Version' -m 1 | /usr/bin/sed -e 's/<[^>][^>]*>//g' | /usr/bin/awk '{print $2}'`
    done

    echo "Latest Version is: $latestver"
    latestvernorm=`echo ${latestver} | sed -e 's/20//'`
    # Get the version number of the currently-installed Adobe Acrobat, if any.
    if [ -e "/Applications/Adobe Acrobat DC/Adobe Acrobat.app" ]; then
        currentinstalledver=`/usr/bin/defaults read /Applications/Adobe Acrobat DC/Adobe Acrobat.app/Contents/Info CFBundleShortVersionString`
        echo "Current installed version is: $currentinstalledver"
        if [ ${latestvernorm} = ${currentinstalledver} ]; then
            echo "Adobe Acrobat DC is current. Exiting"
            exit 0
        fi
    else
        currentinstalledver="none"
        echo "Adobe Acrobat DC is not installed"
    fi


    ARCurrVersNormalized=$( echo $latestver | sed -e 's/[.]//g' -e 's/20//' )
    echo "ARCurrVersNormalized: $ARCurrVersNormalized"
    url=""
    url1="http://ardownload.adobe.com/pub/adobe/acrobat/mac/AcrobatDC/${ARCurrVersNormalized}/AcrobatDCUpd${ARCurrVersNormalized}.dmg"
    url2=""

    #Build URL  
    url=`echo "${url1}${url2}"`
    echo "Latest version of the URL is: $url"


    # Compare the two versions, if they are different or Adobe Acrobat is not present then download and install the new version.
    if [ "${currentinstalledver}" != "${latestvernorm}" ]; then
        /bin/echo "`date`: Current Acrobat DC version: ${currentinstalledver}" >> ${logfile}
        /bin/echo "`date`: Available Acrobat DC version: ${latestver} => ${latestvernorm}" >> ${logfile}
        /bin/echo "`date`: Downloading newer version." >> ${logfile}
        /usr/bin/curl -s -o /tmp/acrobat.dmg ${url}
        /bin/echo "`date`: Mounting installer disk image." >> ${logfile}
        /usr/bin/hdiutil attach /tmp/acrobat.dmg -nobrowse -quiet
        /bin/echo "`date`: Installing..." >> ${logfile}
        /usr/sbin/installer -pkg /Volumes/AcrobatDCUpd${ARCurrVersNormalized}/AcrobatDCUpd${ARCurrVersNormalized}.pkg -target / > /dev/null

        /bin/sleep 10
        /bin/echo "`date`: Unmounting installer disk image." >> ${logfile}
        /usr/bin/hdiutil detach /Volumes/AcrobatDCUpd${ARCurrVersNormalized} -quiet
        /bin/sleep 10
        /bin/echo "`date`: Deleting disk image." >> ${logfile}
        /bin/rm /tmp/${dmgfile}

        #double check to see if the new version got updated
        newlyinstalledver=`/usr/bin/defaults read /Applications/Adobe Acrobat DC/Adobe Acrobat.app/Contents/Info CFBundleShortVersionString`
        if [ "${latestvernorm}" = "${newlyinstalledver}" ]; then
            /bin/echo "`date`: SUCCESS: Adobe Acrobat has been updated to version ${newlyinstalledver}" >> ${logfile}
       # /Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType hud -title "Adobe Acrobat Updated" -description "Adobe Acrobat has been updated." &
        else
            /bin/echo "`date`: ERROR: Adobe Acrobat update unsuccessful, version remains at ${currentinstalledver}." >> ${logfile}
            /bin/echo "--" >> ${logfile}
            exit 1
        fi

    # If Adobe Acrobat is up to date already, just log it and exit.       
    else
        /bin/echo "`date`: Adobe Acrobat is already up to date, running ${currentinstalledver}." >> ${logfile}
        /bin/echo "--" >> ${logfile}
    fi  
else
    /bin/echo "`date`: ERROR: This script is for Intel Macs only." >> ${logfile}
fi

exit 0
20 REPLIES 20

mhasman
Valued Contributor

Any way to adopted it for Adobe CC apps updates?

Nix4Life
Valued Contributor

@mhasman here is Adobe's approved scripted method for CC that mosens/ccp autopkg recipe is based on

L

mhasman
Valued Contributor

@Nix4Life Thank you!

listec
New Contributor III

Hi everyone!

Not exactly a newb here, but I have a kind of a newb question... but first a little background.

We have extremely slow but expensive internet here in Angola, so I'm always looking for ways to conserve precious bandwidth. This script is great, but far from achieving my goals.

Is there a way for me to setup my JSS to automatically run (a modified version of) this script so it always has the latest? Then I can set up a policy to have the client machines install the DMG from the JSS over the LAN.

Thanks in advance!
Brian

DA001KL
New Contributor III

Does anyone still use this script ? I have been trying it and often see it returns alot of errors. Think the ver have changed or adobe pakge has changed. Just wondering if there is an updated ver

amartin253
New Contributor III

Since the source for the latest version has failed, I have modified this script slightly to manually override the latest version entry to allow the script to still work. Stay tuned for a future automated "set it and forget it" way. I have posted the script into the Scripts section of this product

tcandela
Valued Contributor

@amartin has this adobe acrobat reader dc updater script been fixed yet? I just grabbed it earlier today and it's nothing but spitting out error when trying to update to current version (see below taken from policy details of one computer that is currently running 20034).

90% of the time this script is causing an error, while 10% of the time it works

i added an additional echo so it also shows it in the policy details
in the 'else' section of the # double check to see if the new version got updated

Script result: Latest Version is: 2020.006.20042
Latest Version Norm is: 20.006.20042
Current installed version is: 20.006.20034
ARCurrVersNormalized: 2000620042
Latest version of the URL is: http://ardownload.adobe.com/pub/adobe/reader/mac/AcrobatDC/2000620042/AcroRdrDC_2000620042_MUI.dmg
Wed Mar 25 16:31:06 EDT 2020: ERROR: Adobe Reader update unsuccessful, version remains at 20.006.20034.

Jimbo
New Contributor III

@amartin253 & @tcandela

I'm having the same issue with your script. It's failing when trying to deploy. I manually entered the version number in the script as well. Here are the errors reported from Jamf:

Executing Policy Adobe Acrobat DC (Test)
Running script Adobe Acrobat DC...
Script exit code: 1
Script result: + dmgfile=acrobat.dmg
+ logfile=/Library/Logs/AdobeAcrobatDCUpdateScript.log
+ '[' '`/usr/bin/uname -p`=i386' -o '`/usr/bin/uname -p`=x86_64' ']'
++ sw_vers -productVersion
++ sed 's/[.]/_/g'
+ OSvers_URL=10_15_4
+ userAgent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/535.6.2 (KHTML, like Gecko) Version/5.2 Safari/535.6.2'
+ latestver=2020.006.20042
+ echo 'Latest Version is: 2020.006.20042'
Latest Version is: 2020.006.20042
++ echo 2020.006.20042
++ sed -e s/20//
+ latestvernorm=20.006.20042
+ '[' -e '/Applications/Adobe Acrobat DC/Adobe Acrobat.app' ']'
++ /usr/bin/defaults read '/Applications/Adobe Acrobat DC/Adobe Acrobat.app/Contents/Info' CFBundleShortVersionString
+ currentinstalledver=19.021.20061
+ echo 'Current installed version is: 19.021.20061'
Current installed version is: 19.021.20061
+ '[' 20.006.20042 = 19.021.20061 ']'
++ echo 2020.006.20042
++ sed -e 's/[.]//g' -e s/20//
+ ARCurrVersNormalized=2000620042
+ echo 'ARCurrVersNormalized: 2000620042'
ARCurrVersNormalized: 2000620042
+ url=
+ url1=http://ardownload.adobe.com/pub/adobe/acrobat/mac/AcrobatDC/2000620042/AcrobatDCUpd2000620042.dmg
+ url2=
++ echo http://ardownload.adobe.com/pub/adobe/acrobat/mac/AcrobatDC/2000620042/AcrobatDCUpd2000620042.dmg
+ url=http://ardownload.adobe.com/pub/adobe/acrobat/mac/AcrobatDC/2000620042/AcrobatDCUpd2000620042.dmg
+ echo 'Latest version of the URL is: http://ardownload.adobe.com/pub/adobe/acrobat/mac/AcrobatDC/2000620042/AcrobatDCUpd2000620042.dmg'
Latest version of the URL is: http://ardownload.adobe.com/pub/adobe/acrobat/mac/AcrobatDC/2000620042/AcrobatDCUpd2000620042.dmg
+ '[' 19.021.20061 '!=' 20.006.20042 ']'
++ date
+ /bin/echo 'Thu Apr 30 17:29:34 EDT 2020: Current Acrobat DC version: 19.021.20061'
++ date
+ /bin/echo 'Thu Apr 30 17:29:34 EDT 2020: Available Acrobat DC version: 2020.006.20042 => 20.006.20042'
++ date
+ /bin/echo 'Thu Apr 30 17:29:34 EDT 2020: Downloading newer version.'
+ /usr/bin/curl -s -o /tmp/acrobat.dmg http://ardownload.adobe.com/pub/adobe/acrobat/mac/AcrobatDC/2000620042/AcrobatDCUpd2000620042.dmg
++ date
+ /bin/echo 'Thu Apr 30 17:30:20 EDT 2020: Mounting installer disk image.'
+ /usr/bin/hdiutil attach /tmp/acrobat.dmg -nobrowse -quiet
++ date
+ /bin/echo 'Thu Apr 30 17:30:23 EDT 2020: Installing...'
+ /usr/sbin/installer -pkg /Volumes/AcrobatDCUpd2000620042/AcrobatDCUpd2000620042.pkg -target /
+ /bin/sleep 10
++ date
+ /bin/echo 'Thu Apr 30 17:30:39 EDT 2020: Unmounting installer disk image.'
+ /usr/bin/hdiutil detach /Volumes/AcrobatDCUpd2000620042 -quiet
+ /bin/sleep 10
++ date
+ /bin/echo 'Thu Apr 30 17:30:49 EDT 2020: Deleting disk image.'
+ /bin/rm /tmp/acrobat.dmg
++ /usr/bin/defaults read '/Applications/Adobe Acrobat DC/Adobe Acrobat.app/Contents/Info' CFBundleShortVersionString
+ newlyinstalledver=19.021.20061
+ '[' 20.006.20042 = 19.021.20061 ']'
++ date
+ /bin/echo 'Thu Apr 30 17:30:49 EDT 2020: ERROR: Adobe Acrobat update unsuccessful, version remains at 19.021.20061.'
+ /bin/echo --
+ exit 1
Error running script: return code was 1.

sbeech
New Contributor II

I'm currently running this script and receiving the following error message:

Script result: Latest Version is: 2020.009.20063
Current installed version is: 20.009.20067
ARCurrVersNormalized: 2000920063
Latest version of the URL is: http://ardownload.adobe.com/pub/adobe/reader/mac/AcrobatDC/2000920063/AcroRdrDC_2000920063_MUI.dmg

Why is the version being pulled down from Adobe not correct?

Jimbo
New Contributor III

@sbeech It's because the script is pulling the latest version from this site:

http://supportdownloads.adobe.com/product.jsp?platform=macintosh&product=1

Which is showing "2020.009.20063" as the latest version, which is not entirely true. I modified my script to pull from this site instead:

ftp://ftp.adobe.com/pub/adobe/acrobat/mac/AcrobatDC/

I've noticed the site doesn't like to open in some browsers, however Chrome seems to work fine for me.

zoeleech
New Contributor II

It think the difference comes from difference in the type of release as listed on this page
https://helpx.adobe.com/uk/acrobat/release-note/release-notes-acrobat-reader.html

"2020.009.20063" is of type continuous whereas the "2020.009.20067" is and optional update

Equally if you go to https://get.adobe.com/uk/reader/ you get offered the first of these

tcandela
Valued Contributor

@zoeleech just like zoeleech said.
I looked into this yesterday with free adobe reader. Some users had 20063, 20065, 20067

20063 is the actual download application version, while 20065, 20067 are optional updates. So i just let the users update themselves when Adobe reader notifies them with a popup

sbeech
New Contributor II

@Jimbo, I've made the script change with the new website address and still waiting on some test results. I'll keep you all posted.

sbeech
New Contributor II

All, I've changed the web address associated with our current Adobe Acrobat Reader DC update script to - ftp://ftp.adobe.com/pub/adobe/acrobat/mac/AcrobatDC/ However, each time I attempt to run the script it stays in pending mode. I ran this script on another device through terminal and noticed that the script does not appear to end. Did I make an incorrect change to the script by just inserting the new web address into the following script line - latestver=/usr/bin/curl -s -L -A "$userAgent" "ftp://ftp.adobe.com/pub/adobe/acrobat/mac/AcrobatDC/" | grep '"data-sectionHead">Version' -m 1 | /usr/bin/sed -e 's/<[^>][^>]*>//g' | /usr/bin/awk '{print $2}'

Jimbo
New Contributor III

@sbeech, I am going to create a write up on how I have jamf setup to update Adobe Acrobat DC. Might take a few days, but I will share it here once I am done. Unfortunately, I can't really help you with portions of the script you are experiencing issues with since I heavily modified the script to better work for my process.

SamuelHarvey
New Contributor

@Jimbo How'd you go with editing the script? I have the same issue also - I want to grab the optional updates from the FTP to always be running the latest release.

Would you mind sharing your script?

Thanks

valentin_peralt
New Contributor III

I am having issues with this as well. I changed the URL to ftp://ftp.adobe.com/pub/adobe/acrobat/mac/AcrobatDC/ and it is also not finishing.
Has anybody else figured this out?

Jimbo
New Contributor III

@sbeech @SamuelHarvey @valentin.peralta

Here is my write-up on how I update Adobe. There's probably better solutions out there with cleaner code and whatnot, but if you're in this thread then you're probably in the same boat as me and couldn't really find a nice working solution. Therefore, I constructed my own solution using and editing the script from this post. It seems like a lot to set up, but once you get everything in place it's pretty straightforward. The best part is that this setup is automated and doesn't require any interaction from IT unless something breaks, which is mentioned in the write-up.

remus
New Contributor III

@Jimbo Thank you so much for your solution.
Is there a chance to make the script completely silent - without any windows popping up?

Jimbo
New Contributor III

@remus Sorry, just now seeing this. Yes, it can update silently. Just don't create or deploy the "Progress Bar App". However, if you install silently and a user opens Adobe while it's updating, that might cause issues.