#!/bin/ksh93
#  ALTRAN_PROLOG_BEGIN_TAG                                                    
#  This is an automatically generated prolog.                                  
#                                                                              
#  Copyright (C) Altran ACT S.A.S. 2019,2021.  All rights reserved.  
#                                                                              
#  ALTRAN_PROLOG_END_TAG                                                      
#                                                                              
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# 61haes_r714 src/43haes/usr/sbin/cluster/sa/tsmclient/sbin/cl_tsmclientdiscovery.sh 1.4 
#  
# Licensed Materials - Property of IBM 
#  
# COPYRIGHT International Business Machines Corp. 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 
# @(#)  7d4c34b 43haes/usr/sbin/cluster/sa/tsmclient/sbin/cl_tsmclientdiscovery.sh, 726, 2147A_aha726, Feb 05 2021 09:50 PM

###############################################################################################
#
# NAME:
#      cl_tsmclientdiscovery
#
# PURPOSE:
#       Discovers TSM client configuration is installed or not it checks the fileset
#       tivoli.tsm.client is installed or not.
#
# ARGUMENTS:
#       n/a
#
# RETURNS
#  1 on success
#  0 on Failure
#
#################################################################################################

typeset version="1.0"
. /usr/es/sbin/cluster/sa/tsmclient/sbin/cl_tsmcliGlobals
[[ "$VERBOSE_LOGGING" == "high" ]] && set -x

function discover_tsm_client {

        [[ "$VERBOSE_LOGGING" == "high" ]] && set -x

        /usr/bin/lslpp -iq tivoli.tsm.client.ba.32bit.base >/dev/null 2>&1 && {
											/usr/bin/lslpp -iq tivoli.tsm.client.ba.32bit.common >/dev/null 2>&1
											[[ $? == 0 ]] && return 1
										   }

        /usr/bin/lslpp -iq tivoli.tsm.client.ba.64bit.base >/dev/null 2>&1 && {
                                                                                        /usr/bin/lslpp -iq tivoli.tsm.client.ba.64bit.common >/dev/null 2>&1
                                                                                        [[ $? == 0 ]] && return 1
                                                                                   }

        return 0

}

typeset result

discover_tsm_client
result=$?
echo "TSM client smart assist:TSM_CLIENT:TSM backup archive client:TSM_BACLIENT:$result"
exit 0
