#!/bin/ksh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# 61haes_r714 src/43haes/usr/sbin/cluster/cspoc/utilities/clIsInstalled.sh 1.4 
#  
# Licensed Materials - Property of IBM 
#  
# COPYRIGHT International Business Machines Corp. 2002,2007 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 
# @(#)60	1.4 src/43haes/usr/sbin/cluster/cspoc/utilities/clIsInstalled.sh, hacmp.cspoc, 61haes_r714 7/30/07 23:37:02
# $Id$
# @(#)59  1.0.0.0  src/43haes/usr/sbin/cluster/cspoc/utilities/clIsInstalled.sh, hacmp.cspoc, 51haes_r510 6/21/02 19:50:09
###############################################################################
#
# Name:
#       clIsInstalled
#
# Description:
#   The clIsInstalled verifies if the specified software is installed on the node
#   and returns it's fileset name and version. This script was written for
#   C-SPOC SDD and SDDPCM installation verification utility "cl_SDDinstalled"
#
#   Usage: clIsInstalled <Image_Name ...>
#
# Arguments:
#   The clIsInstalled command argument is a list of  software names that the 
#   utility will search for.
#
# Return Values:
#       0
#
# Suggested run example:
#       clIsInstalled "cluster.es.cspoc"
#
################################################################################

# Grep for the installed software

# Iterate thru the list of packages.  Once one is found, echo the version number and exit.
while [[ $# -gt 0 ]]
do
        VER=$(lslpp -l | grep $1 | sort | uniq)

        # If found, print out it's version
        if [ -n "$VER" ] ; then
	        echo $VER | awk '{print $2" "$1}'
                exit 0
        fi

        shift
done

exit 0
