#!/bin/ksh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # bos720 src/bos/usr/lib/nim/methods/c_showplat.sh 1.2 # # Licensed Materials - Property of IBM # # Restricted Materials of IBM # # COPYRIGHT International Business Machines Corp. 1996,2003 # 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 # @(#)13 1.2 src/bos/usr/lib/nim/methods/c_showplat.sh, cmdnim, bos720 10/1/03 17:25:25 # # COMPONENT_NAME: CMDNIM # # FUNCTIONS: ./usr/lib/nim/methods/c_showplat.sh # # ORIGINS: 27 # # # (C) COPYRIGHT International Business Machines Corp. 1996 # All Rights Reserved # Licensed Materials - Property of IBM # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # include common NIM shell defines/functions NIMPATH=${0%/*} NIMPATH=${NIMPATH%/*} [[ ${NIMPATH} = ${0} ]] && NIMPATH=/usr/lpp/bos.sysmgt/nim NIM_METHODS="${NIMPATH}/methods" . ${NIM_METHODS}/c_sh_lib #---------------------------- module globals -------------------------------- REQUIRED_ATTRS="location language platform" OPTIONAL_ATTRS="" location="" platform="" language="" #---------------------------- c_showplat -------------------------------- # # NAME: c_showplat # # FUNCTION: # Prints out the platform and description for a given platform # in the format: = # # EXECUTION ENVIRONMENT: # # NOTES: # For 4.2+ SPOTs the platform descriptions are located in the PdAt # object class of the SPOT that supports the given platform. # This platform stanza contains the message catalog information # needed to obtain the platform description. If the ODM stanza # containing the platform message information is not in the ODM # database, just print out the platform with no description. # Do this because this method is being used to display cmd_to_list # output in SMIT, and warnings or errors wouldn't look nice. # # RECOVERY OPERATION: # # DATA STRUCTURES: # parameters: # global: # # RETURNS: (int) # # OUTPUT: #------------------------------------------------------------------------------- # signal processing trap cleanup 0 trap err_signal 1 2 11 15 # NIM initialization nim_init # set parameters from command line while getopts :a:qv c do case ${c} in a) # validate the attr ass parse_attr_ass "${OPTARG}" # include the assignment for use in this environment eval ${variable}=\"${value}\" ;; q) # show attr info cmd_what exit 0 ;; v) # verbose mode (for debugging) verbose=TRUE set -x for i in $(typeset +f) do typeset -ft $i done ;; \?) # unknown option error ${ERR_BAD_OPT} ${OPTARG} ;; esac done # check for missing attrs ck_attrs # get ODM stanza with platform catalog information # from the SPOT that supports this platform ODMDIR=${location}/lib/objrepos ${ODMGET} -q "attribute='platform_desc' \ and deflt='${platform}'" PdAt > ${TMPDIR}/plat_info # if ODM information about platform isn't there # just show platform without description if [[ ! -s ${TMPDIR}/plat_info ]] then echo "${platform} =" exit 0 fi # get catalog information values_line=`${CAT} ${TMPDIR}/plat_info | ${GREP} values` catalog=`echo ${values_line} | ${CUT} -d"," -f1 | ${CUT} -d'"' -f2` set=`echo ${values_line} | ${CUT} -d"," -f2` msgno=`echo ${values_line} | ${CUT} -d"," -f3` default=`echo ${values_line} | ${CUT} -d"," -f4 | ${CUT} -d'"' -f1` # get the platform description desc=`LANG=${language} ${DSPMSG} -s ${set} ${catalog} ${msgno} "${default}"` # print out platform and description echo "${platform} = ${desc}" ${RM} ${TMPDIR}/plat_info # all done exit 0