Friday, March 28, 2008

NMI checking java pre-reqs for various platforms

If you want to check which version of java a given platform provides, use the following command:
nmi_list_prereqs --platform= java

Here's a handy PERL script that goes through a whole list of platforms and tells you if they support a specific java version. You can easily modify it to just display the platform version.

#!/usr/bin/perl

# Author: Rishi Verma

# PURPOSE:
# This script goes through a list of platforms, checks whether each platform suppports
# a specific version of JDK, and prints the result (yes, no) onto the screen.


$jdk_version = "java-1.5.0_08";
$counter = 1;

# array for all non-mac platforms
@non_mac_platforms = ("x86_64_fc_4", "x86_64_fc_5", "x86_64_rhap_5", "x86_64_rhas_3", "x86_64_rhas_4", "x86_64_sles_8", "x86_cent_4.2", "x86_deb_3.1", "x86_deb_4.0", "x86_fc_2", "x86_fc_3", "x86_fc_4", "x86_fc_5", "x86_rh_7.2", "x86_rh_8.0", "x86_rh_9", "x86_rhap_5", "x86_rhas_3", "x86_rhas_4", "x86_slc_3", "x86_sles_8", "x86_sles_9", "x86_slf_3", "x86_suse_10.0", "x86_suse_10.2", "x86_ubuntu_5.10");

# go through each platform, check if jdk_version exists for it, and print yes or no
foreach(@non_mac_platforms)
{
$output = `nmi_list_prereqs --platform=$_ java`;

if ($output =~ /$jdk_version/)
{ print "$counter) Platform: $_ supports $jdk_version ? => YES\n"; }
else
{ print "$counter) Platform: $_ supports $jdk_version ? => NO\n"; }

$counter++;
}

No comments: