Archive

Archive for June 23, 2013

Casper Extension Attribute script to detect Java build 1.6.0_51-b11-456-10M4508

June 23, 2013 4 comments

To follow up on the re-release of Apple’s Java For Mac OSX 10.6 Update 16 and Java for OS X 2013-004 updates, which fixes a problem with the previous versions of the updates, there’s a need to identify which machines got the problematic version of Java. The problematic Java build is 1.6.0_51-b11-456-10M4508 and can be identified by running the following command:


/usr/libexec/java_home -v 1.6 -exec java -version

Update – June 24, 2013: On further examination, it looks like Apple used two different build numbers:

Mac OS X 10.6.x: 1.6.0_51-b11-456-10M4508
Mac OS X 10.7.x – 10.8.x: 1.6.0_51-b11-456-11M4508

To help Casper admins identify which Macs have 1.6.0_51-b11-456-10M4508 or  1.6.0_51-b11-456-11M4508 installed, I’ve posted the following Casper extension attribute to my GitHub repo:

#!/bin/sh
# Determines if either of the following
# Java builds are installed:
#
# 10.6.x: 1.6.0_51-b11-456-10M4508
# 10.7.x - 10.8.x: 1.6.0_51-b11-456-11M4508
#
# This builds were installed by the first versions of
# Java for OS X 2013-004 and Java for Mac OS X 10.6 Update 16
# and can cause problems for Java Swing applications
# like MATLAB and Papercut.
JAVA_BUILD_CHECK=`java -version 2>&1 | awk '/4508/{print $NF}' | sed '$s/.$//'`
FOUND=`echo "Installed"`
NOT_FOUND=`echo "Not Found"`
if [ "$JAVA_BUILD_CHECK" = "1.6.0_51-b11-456-10M4508" ]; then
result=$FOUND
elif [ "$JAVA_BUILD_CHECK" = "1.6.0_51-b11-456-11M4508" ]; then
result=$FOUND
elif [ "$JAVA_BUILD_CHECK" = "" ]; then
result=$NOT_FOUND
fi
# If either 1.6.0_51-b11-456-10M4508 or 1.6.0_51-b11-456-11M4508
# is installed, an "Installed" message is displayed.
#
# If neither 1.6.0_51-b11-456-10M4508 or 1.6.0_51-b11-456-11M4508
# is installed, a "Not Found" message is displayed.
echo "<result>$result</result>"
view raw gistfile1.txt hosted with ❤ by GitHub

This script uses the java -version command to check the Java build version. If Java builds 1.6.0_51-b11-456-10M4508 or 1.6.0_51-b11-456-11M4508 are detected, the script reports Installed. If neither 1.6.0_51-b11-456-10M4508 or 1.6.0_51-b11-456-11M4508 are installed on the Mac, the script reports Not Found.

For those interested, the script is available on my GitHub repo:

https://github.com/rtrouton/rtrouton_scripts/tree/master/rtrouton_scripts/Casper_Extension_Attributes/check_for_java_build_M4508