Script to run Adobe Reader update at startup

pawan_joshi
New Contributor II

Hi,

I'm new to Apple and JAMF and so seeking help from anyone who can. I have created policy for Adobe Reader 11.0.12. All I need is a script to add to it that will check the version at startup and install it if the current version is older than 11.0.12.

Thanks
PJ

1 REPLY 1

alexjdale
Valued Contributor III

What you will probably want to do is use two policies: one with a script that runs on startup and performs the version check, and a trigger policy that the script runs if it needs to install Adobe Reader.

Here is a snippet of how I do version checking for multi-decimal versions (Flash in this example):

#!/bin/bash

targetFlashVersion="18.0.0.232"

tar_ver_major=$(echo $targetFlashVersion | awk -F. '{print $1}')
tar_ver_minor=$(echo $targetFlashVersion | awk -F. '{print $2}')
tar_ver_sub1=$(echo $targetFlashVersion | awk -F. '{print $3}')
tar_ver_sub2=$(echo $targetFlashVersion | awk -F. '{print $4}')

flashPluginVersion=`/usr/bin/defaults read /Library/Internet Plug-Ins/Flash Player.plugin/Contents/Info CFBundleVersion`

if [ ! "$flashPluginVersion" ]; then
    echo "Flash plugin not installed.  Exiting."
    exit 0
fi

ver_major=$(echo $flashPluginVersion | awk -F. '{print $1}')
ver_minor=$(echo $flashPluginVersion | awk -F. '{print $2}')
ver_sub1=$(echo $flashPluginVersion | awk -F. '{print $3}')
ver_sub2=$(echo $flashPluginVersion | awk -F. '{print $4}')

if [ $ver_major -ge $tar_ver_major ]; then
    echo "Major version: OK"
    if [ $ver_minor -ge $tar_ver_minor ]; then
        echo "Minor version: OK"
        if [ $ver_sub1 -ge $tar_ver_sub1 ]; then
            echo "sub1 version: OK"
            if [ $ver_sub2 -ge $tar_ver_sub2 ]; then
                echo "sub2 version: OK"
                echo "Flash version $flashPluginVersion is equal to or better than $targetFlashVersion, not updating"
                exit 0
            fi
        fi
    fi
fi

echo "Flash version $flashPluginVersion is lower than $targetFlashVersion, updating"
jamf policy -trigger installFlash$targetFlashVersion