#!/bin/ksh93 # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r714 src/43haes/lib/ksh93/ihs/KLIB_IHS_get_installations.sh 1.1 # # Licensed Materials - Property of IBM # # Restricted Materials of IBM # # COPYRIGHT International Business Machines Corp. 2009,2010 # 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 # @(#)05 1.1 src/43haes/lib/ksh93/ihs/KLIB_IHS_get_installations.sh, hacmp, 61haes_r714 11/28/11 15:19:20 # #=head1 NAME # # KLIB_IHS_get_installations - Obtain a list of all installed instances of a # fileset # #=head1 SYNOPSIS # # instances=$(KLIB_IHS_get_installations $fileset) # #=head1 DESCRIPTION # # Obtain a list of all of the installed instances of IBM Http Server # #=head1 ARGUMENTS # # 1: [scalar] fileset name # #=head1 RETURN # # echo to stdout the number of installed instances found followed by a # list of discovered fileset installations. Each item contains the version # and installation path. # #=head1 COPYRIGHT # #(C) COPYRIGHT International Business Machines Corp. 2005 #All Rights Reserved # #=cut # function KLIB_IHS_get_installations { . /usr/es/lib/ksh93/func_include name=$1 installs="" integer count=0 LC_ALL=C; lslpp -Lc "$name" 2>/dev/null | while IFS=: read image fileset version tmp tmp tmp tmp tmp install_dir tmp; do if [[ ${fileset/$name/found} == "found" ]]; then echo $version | IFS='.' read a b c d e if (( $count == 0 )); then installs="$a.$b:$install_dir" else installs="$installs:$a.$b:$install_dir" fi count=$count+1 fi done echo "$count:$installs" return 0 }