#!/usr/bin/perl -w #Author: Aaron Burgemeister #Version: 0.2.20080226193200 #Name: Multiple Version Reader # #This utility is made to find the version of multiple files with Sentinels' versionreader.sh script. #Currently the versionreader.sh script can only take one parameter at a time so this will iterate #through either the lib directory entirely (default, no arguments), the directory given to this #script, or thruogh multiple files fed to this command. The output will be sent to STDOUT by #default. #Define variables. my(@files) = (); my($output) = ''; my($key0) = ''; my($tempOutput) = ''; my($ESEC_HOME) = `echo \$ESEC_HOME`; my($versionReaderScript) = ''; chomp ($ESEC_HOME); #Check for request for help. if((scalar(@ARGV) > 0) && ($ARGV[0] =~ /^-+h/)){print 'Usage: ./mversionreader.pl [/path/to/directory | [/path/to/jar/file0.jar [/path/to/jar/file1.jar]...]' . "\n\n";exit;} #Set default $ESEC_HOME if one does not exist in *nix environment already. if(length($ESEC_HOME) == 0) { $ESEC_HOME = '/opt/novell/sentinel6'; }#End if #Setup variable for versionreader.sh $versionReaderScript = $ESEC_HOME . '/bin/versionreader.sh'; if(scalar(@ARGV) > 1) { @files = <@ARGV>; }#End if; elsif(scalar(@ARGV) == 1) { my($tempPath) = shift(@ARGV); if(-d $tempPath) { @files = <$tempPath/*.jar>; }#End if else { @files = $tempPath; }#End else }#End if else { @files = <$ESEC_HOME/lib/*.jar>; }#End else #Go through JAR files finding versions. foreach $key0 (@files) { $output .= 'Version information for: ' . $key0 . "\n"; $output .= `$versionReaderScript $key0 2>&1` . "\n\n"; }#End foreach print $output;