There was a question on the list back in January about how to locate the
Flash plug-in version, which is something I've wanted to do. The idea got
me thinking about not just Flash but also Silverlight, and really this could
apply to any plug-ins. So I embarked on writing some scripts and I wanted
to share them with you.
First Flash. It was suggested to parse the contents of a text file inside
the Flash Plug-in inside of /Library/Application Support/Adobe/Flash Player,
however I found that location did not always exist. So instead, I did it
with the plug-in inside /Library/Internet Plug-Ins. In here I used a bash
script to dump the contents of Info.plist inside the package and parse that
to find the version. The only hang up I had was comparing the version with
a known version using regular expressions and arithmetic operations. Tom
had suggested using this if statement:
if [[ $CurrentVersionFlash -gt 9 ]]
However, since the version number of Flash is always going to be a floating
point number, that won't work. Instead, you have to compare to a specific
number, which is a slight downside to the script that follows. You have to
update the version to check for each time Flash is updated by Adobe. You'll
notice I am only checking the revision number from the piece of the
Info.plist I am pulling out with awk.
The script checks the version, and if it is lower than the current version a
package receipt is dumped into /Library/Application Support/JAMF/Receipts
named FlashTooOld.pkg. A smart group is then scoped in JSS to look for that
package receipt, thus giving me a group to update. I have a policy scoped
against that group to run at login. The policy uses Growl Notify to notify
users that Flash is being updated and installs the Flash plug-in. I had to
put a sleep statement in my growl notify script to wait for the desktop to
come up fully before running.
Here is the Flash Version script:
#!/bin/bash
# get the current version of the flash player plug in
CurrentVersionFlash=`/bin/cat /Library/Internet Plug-Ins/Flash
Player.plugin/Contents/Info.plist | grep -m 1 10. | /usr/bin/awk '{ print $5
}'`
# now check to see if it is greater than version 9
echo $CurrentVersionFlash
if [[ "$CurrentVersionFlash" < r45 ]]
then
touch /Library/Application Support/JAMF/Receipts/FlashTooOld.pkg /usr/sbin/jamf recon
fi
exit 0
Now, the Silverlight check is done very similarly, so I will not bore you
with details. Here is the Silverlight script:
#!/bin/sh
# Name: silverlightversion.sh
# Date: 04 March 2009
# Author: Steve Wood (swood at integer.com)
# Purpose: to grab the version of Silverlight and place the version in the
Position tag in
# the location information of a machine.
# grab the version from the plug-in
version=`cat /Library/Internet
Plug-Ins/Silverlight.plugin/Contents/Info.plist | grep -m 1 3. | sed
's/[/]//' | sed 's/<string>//g'`
/usr/sbin/jamf recon -position $version
echo $version
if [[ "$version" < 3.0.50106.0 ]]
then
touch /Library/Application Support/JAMF/Receipts/SilverlightTooOld.pkg
/usr/sbin/jamf recon
fi
exit 0
Hope that helps someone. If any of you see something to do differently, let
me know.
Steve Wood
Director of IT
swood at integer.com
The Integer Group | 1999 Bryan St. | Ste. 1700 | Dallas, TX 75201
T 214.758.6813 | F 214.758.6901 | C 940.312.2475