2

Faced with the recent Java kerfuffle imposed by Apple's silent updates I am looking for a solution to install .pkg files specific to the OS version.

Apple continues to provide Java updates for 10.6, but for 10.7+ we need to get the file from Oracle. Apple finally released the Java update for 10.6 on Friday, but the software was available before it was showing up as a Software Update through the OS's Software Update section.

For 10.6, we may just end up resorting to waiting for Apple to push it through their Software Updates and use ARD to run those Software Updates, but when pushing out Java updates through ARD using the .pkg file provided by Oracle, I'd like to ensure we are only attempting to install on machines which are 10.7+ and not on anything less than that.

Question: I was wondering if ARD Software Distribution has the capability of installing based on Client OS version, I don't want to attempt to install the Oracle Java intended for 10.7+ machines on any of our 10.6 clients. I can't seem to find any documentation or discussions online. Any/All help is appreciated.

Answer I formulated (great help from the answer below, just wanted to offer an end result for people who may still be scratching their heads):

#!/bin/bash
os_ver_maj=$(sw_vers -productVersion | cut -d . -f 2)
    if [ $os_ver_maj -ge 7 ]; then
        mkdir /Volumes/ARD && mount_afp afp://ardservername.localdomain/ARD_pkgs /Volumes/ARD && installer -pkg /Volumes/ARD/jre-7u13-macosx-x64.pkg -target /
    else
        mkdir /Volumes/ARD && mount_afp afp://ardservername.localdomain/ARD_pkgs /Volumes/ARD && installer -pkg /Volumes/ARD/Java6u12OSX10.6.pkg -target /
    fi
umount /Volumes/ARD

Explanation:

  • I chose to host the files right on the ARD server, downloading from Oracle is almost impossible and I'm sure it will change without warning.
  • I also opted to not use softwareupdate for 10.6, too many other problems arose, even when choosing the specific PackageName.
  • When new Java updates come out, we will download and extract the .pkg from the .dmg, place it on the ARD server in the ARD_pkgs directory and update the script to reflect the package version change.

I hope this helps others, thanks for the input and guidance.

TryTryAgain
  • 1,152
  • 5
  • 22
  • 41
  • I like your ultimate solution to self-host the files and install them over the wire. One minor improvement, you could do the `mkdir /Volumes/ARD && mount_afp afp://ardservername.localdomain/ARD_pkgs /Volumes/ARD` once before the OS check since it's required regardless of OS version (much like you did with the `unmount /Volumes/ARD`). – morgant Feb 05 '13 at 17:56

2 Answers2

4

Apple Remote Desktop's Copy Items & Install Packages features don't have the specific filtering ability to do that, but you can do it in two easy steps with a Smart List:

  1. Click the "+" button in the lower-left corner of the Remote Desktop window and select "New Smart List..."
  2. Name the new "Smart List" where "Mac OS Version" is "greater than" version "10.7" (you can add other filters if you'd like) and click OK.
  3. Select the new Smart List from the source list.
  4. Select all the computers in that list.
  5. Click the Install Packages button (or select Manage -> Install Packages...) to proceed to install the Oracle Java package to only those selected Macs.

Alternatively, if you want to either run Software Update or install the Oracle Java package on all machines at once, you could write a shell script to check the OS version. Here's an example in bash:

os_ver_maj=$(sw_vers -productVersion | cut -d . -f 2) # get the major OS version
if [ $os_ver_maj -ge 7 ]; then
    # download & install the Oracle Java package
else
    # run software update
fi

Once you've built a script that correctly does what you want, then you can select all the machines in ARD, then you can do Manage -> Run UNIX Command... (or click the Send UNIX Command button) & paste in the script.

morgant
  • 1,470
  • 6
  • 23
  • 33
3

I think what you're looking for is sw_vers. You can create a script that calls it and parses the output. If it matches (or doesn't match) then call the package installer.

Sample output:

Marks-MacBook-Pro:~ mark$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.8.2
BuildVersion:   12C60
MDMarra
  • 100,734
  • 32
  • 197
  • 329