#! /bin/sh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # # # Licensed Materials - Property of IBM # # Restricted Materials of IBM # # (C) COPYRIGHT International Business Machines Corp. 2005,2008 # 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 # %Z%%M% %I% %W% %G% %U% # # Licensed Materials - Property of IBM #========================================================================= # Use this script to check prerequisites for installation of SAMP # # Syntax: # ./prereqSAM [options: see SAMP base reference] # Output: # - return code 0 if all prerequisites are met, other return codes indicate # that prerequisites failed or could not be checked. # - detailed log of prereq checks in /tmp/prereqSAM.<#>.log. # # All prerequsites are kept in a list near the top of this script. # This list must be maintaned with every new version of SAM. # Change Activity: # 20051128 ws Initial version made from installSAM 2.1.1.0 # 20051212 ws Add -d option (packages directory) # 20060113 ws Fix SuSE package detection. # 20060201 ws Fix PR1P0004UMu - OS detection on s390x. # 20060208 ws Fix PR1P0238WBl - Distribution check. # 20060209 ws Fix PR1P0243WBl - check pdksh on any distro. # 20060209 ws Fix PR1P0244WBl - check perl on any distro. # 20060223 ws Fix PR1P0266WBl - SuSE 8.1 with SP3 not recognized. # 20060328 ws Fix PR1P0037MNa - checking for ksh package to specific. # 20060508 ws Fix PR1P0105KKo - no checking for min SUSE 9.1. # PR1P0116UMu - no checking for min SUSE 10.0 # PR1P0112WBl - no checking for min RH 4.0 # 20060519 ws Fix false -d detection # 20060818 ws fix to stringent checking for Red Hat (AS vs ES) # 20060906 ws Adapt prereqs to 2.2.0.0 # 20061026 ws Adapt prereqs to 2.2.1.0 lift RSCT for AIX to 2.3.10/2.4.6 (c003) # 20061113 ws Fix RSCT version problem (more than 1 digit version) reported by Frank Ning. # 20070116 ws Fix RH new version format: 'Red Hat Enterprise Linux Server release 4.92 (Tikanga)' # and expand level to 4 digits in order to handle level in # e.g. 4.5(req) > 4.123(given) correctly (level 5000 > 1230) # 20070222 ws Check upgrade path 21xx -> 2202 not allowed (c004) # 20070223 ws RedHat 5.0 support RSCT for AIX to 2.3.11/2.4.7 # 20070314 ws consume --noliccheck option from installSAM for conditional upgrade check # 20070327 ws Adapt prereqs for libpam.so (reported by Frank Ning) # 20070411 ws Added db2 AIX prereq lines for storagerm. # 20070420 ws allow upgrade to GA 2300 from 1.2 # 20070509 ws min prereq SUSE 10.1 # 20070519 ws fix P2300594RBa AIX prereq confusing messages # 20070518 ws AIX61 support (for F.Ning DB2) # 20070604 ws Fix P2300610RKa Paused in Russian locale. # 20070613 ws Extend prereqs from RH4 to RH5 remove cfgsamadapter prereqs (c005) # 20070702 ws RSCT prereqs AIX 2.3.11.3/2.4.7.3 # 20070816 ws version 3.1.0.0 - fix too low min RH version 4.0, must be 4.5 # 20070924 ws Fix PTM P23S0057MAf installSAM can't detect RH 4.5 properly # 20070930 ws AIX6 # 20071018 ws switch to RSCT rene 2.4.8.0, 2.5.0.0 # 20071023 ws drop AIX 5.2 support # 20071119 ws fix checkSAMPkg() PMR 20501,057,649 APAR IZ09311 # 20080109 ws Add prereq checking for SunOS # 20080125 ws Change libpam prereq to /lib/libpam to catch 64 bit version # 20080131 ws AIX 5.3 RSCT 2.4.9.0, AIX 6.1 RSCT 2.5.1.0 # 20080209 ws DCR11 install RSCT for AIX # 20080402 ws Added libstdc++ 64bit for RH # 20080407 ws Fixed P3101473ASc: SUN prereq packages # 20080521 rb Implemented simple rsct.basic.rte upgrade test # 20080526 rb Fixed getRSCTVersionFromOSVersion() and rsct.basic.rte upgrade test # 20080916 rb Added check for pam 32-bit on all RHEL # 20090122 rb Added SLES 11.0 as supported version # 20090122 rb Changed perl check pkg name to perl-base for SLES 11.0 # 20090220 rb Changed pam check pkg name to pam-32-bit for SLES 11.0 #========================================================================= # TODO: Consolidate all functions common in installSAM, prereSAM, and uninstallSAM in one utility # TODO: Attempt simple space check based on sample installation size # (e.g. new installation and upgrade cases). # TODO: Line 1865: error message for rsct.basic.rte must be translated for 3.2 or 3.1.0.1! # ####################################################################################################### # Prereqisites definitions # Three kinds of entries: # 'OS Versions' # 'List of Packages' # 'Prereq package specs' #---------------------------------- #----------------------------------------------------------------------------------------------------- # 'OS Versions' #----------------------------------------------------------------------------------------------------- # Definition of prereq OS versions keyword=value pairs: # ___VERSIONS="" # where : { AIX | Linux } # : { i386 | i386x | ppc | s390 | s390x } # e.g. i386x == x86_64 (64 bit), s390x == s390 64 bit # : { IBM | RH | SUSE } # are OS specific version levels # Examples: AIX_ppc_IBM_VERSIONS="5200-00 5300-00" # Linux_s390_SUSE="8.3 9.0" # Rule: 1. After composing "___VERSIONS" a keyword defined below must be found. E.g. # after detecting: # OS = Linux, arch = ppc, distro = SUSE, # a keyword Linux_ppc_SUSE_VERSIONS must be found in the OS versions below. # 2. The detected version of operating system information must match any of the . # E.g. if on AIX detection using 'oslevel -r' returned 5300-00, then the version '5300' # matched the second version value in AIX_ppc_IBM_VERSIONS="5200-00 5300-00" # Each value in is of the form: # - for AIX and # . for Linux # 3. in is the minimum level. # The prereq check is successful if the is equal # or higher within the . E.g. Detecting 8.4 on SUSE s390 Linux has a match in: # Linux_s390_SUSE="8.3 9.0". #------------------ # OS Versions AIX #AIX_ppc_IBM_VERSIONS="5200-00 5300-00 6100-00" until 2.3.0.x AIX_ppc_IBM_VERSIONS="5300-00 6100-00" # since 3.1.0.0 #------------------ # OS Versions SUSE #Linux_i386_SUSE_VERSIONS="8.3 9.0" until 2.1.1.0 #Linux_i386x_SUSE_VERSIONS="9.0" until 2.1.1.0 #Linux_ppc_SUSE_VERSIONS="8.4 9.0" until 2.1.1.0 #Linux_s390_SUSE_VERSIONS="8.3 9.1" until 2.1.1.0 #Linux_s390x_SUSE_VERSIONS="8.3 9.1" until 2.1.1.0 # 2.2.0.0 # 2.2.0.1 # 2.2.0.2 Linux_i386_SUSE_VERSIONS="9.0 10.1 11.0" Linux_i386x_SUSE_VERSIONS="9.0 10.1 11.0" Linux_ppc_SUSE_VERSIONS="9.0 10.1 11.0" Linux_s390_SUSE_VERSIONS="9.1 10.1 11.0" Linux_s390x_SUSE_VERSIONS="9.1 10.1 11.0" #------------------ # OS Versions RedHat #Linux_i386_RH_VERSIONS="3.0 4.0" until 2.1.1.0 #Linux_i386x_RH_VERSIONS="3.2 4.0" until 2.1.1.0 #Linux_ppc_RH_VERSIONS="3.0 4.0" until 2.1.1.0 #Linux_s390x_RH_VERSIONS="3.5 4.0" until 2.1.1.0 # 2.2.0.0 # 2.2.0.1 # 2.2.0.2 #Linux_i386_RH_VERSIONS="4.0" # unitl 2.2.0.2 #Linux_i386x_RH_VERSIONS="4.0" # unitl 2.2.0.2 #Linux_ppc_RH_VERSIONS="4.0" # unitl 2.2.0.2 #Linux_s390x_RH_VERSIONS="4.0" # unitl 2.2.0.2 # 2.2.0.3/2.3.0.0 #Linux_i386_RH_VERSIONS="4.0 5.0" # 2.3.0.0 #Linux_i386x_RH_VERSIONS="4.0 5.0" # 2.3.0.0 #Linux_ppc_RH_VERSIONS="4.0 5.0" # 2.3.0.0 #Linux_s390x_RH_VERSIONS="4.0 5.0" # 2.3.0.0 # 3.1.0.0 Linux_i386_RH_VERSIONS="4.6 5.0" # 3.1.0.0 Linux_i386x_RH_VERSIONS="4.6 5.0" # 3.1.0.0 Linux_ppc_RH_VERSIONS="4.6 5.0" # 3.1.0.0 Linux_s390x_RH_VERSIONS="4.6 5.0" # 3.1.0.0 #---------------------------- # OS versions SunOS (Solaris) SunOS_sparc_SUN_VERSIONS="10.0" #----------------------------------------------------------------------------------------------------- # 'List of packages' #----------------------------------------------------------------------------------------------------- # Specifies the suffixes of keywords in 'prereq package specs'. # Definition of list of packages keyword=value pairs: # _PKGS=" # # Definition prereq packages spec keyword=value pairs: # _____PKG_="" # where : { AIX | Linux | SunOS } # : { i386 | i386x | ppc | s390 | s390x | aaa } 'aaa' means any architecture # : { IBM | RH | SUSE | SUN | ddd } 'ddd' means any distro # _: If '_' is 'v_l' it is applicable to any version of AIX or Linux # : One of the suffixes in the Suffix list. #----------------------------------------------------------------------------------------------------- # List of packages or other prereqs for AIX AIX_PKGS="CPPRUNTIME JAVA RSCTCORE RSCTBASIC WPAR" #AIX_PKGS="CPPRUNTIME JAVA RSCTCORE RSCTBASIC WPAR RSCTSTORAGERM" # db2-prereqs # AIX prereq package specs: # # CCPRUNTIME values of the form " " # e.g. "xlC.aix50.rte 7.0.0.1" # Checked by default prereq check function: checkAIXPrereqs AIX_ppc_IBM_5300_00_PKG_CPPRUNTIME="xlC.aix50.rte 7.0.0.1" # JAVA version value of the form "" # Checked by default prereq check function: checkAIXJAVA # e.g. "142" # Rule: Equal of higher version of Java is allowed. AIX_ppc_IBM_v_l_PKG_JAVA="142" # RSCTCORE/RSCTBASIC values of the form " " # e.g. "rsct.core.rte 2.4.3.1" # Checked by default prereq check function: checkAIXPrereqs # AIX 5.2 dropped with 3.1 #RSCT_VERSION_52="2.3.9.4" until 2.2.0.0 #RSCT_VERSION_52="2.3.10.2" until 2.2.0.1 #RSCT_VERSION_52="2.3.10.3" until 2.2.0.2 #RSCT_VERSION_52="2.3.11.1" until 2.2.0.3, 2.3.0.1 #RSCT_VERSION_52="2.3.12.0" until 2.2.0.3, 2.3.0.1 #AIX_ppc_IBM_5200_00_PKG_RSCTCORE="rsct.core.rmc $RSCT_VERSION_52" #AIX_ppc_IBM_5200_00_PKG_RSCTBASIC="rsct.basic.rte $RSCT_VERSION_52" # AIX 5.3 #RSCT_VERSION_53="2.4.5.4" until 2.2.0.0 #RSCT_VERSION_53="2.4.6.2" until 2.2.0.1 #RSCT_VERSION_53="2.4.6.3" until 2.2.0.2 #RSCT_VERSION_53="2.4.7.1" until 2.2.0.3, 2.3.0.1 #RSCT_VERSION_53="2.4.7.5" until 2.2.0.4, 2.3.0.1 #RSCT_VERSION_53="2.4.8.2" # rsct rene for test upgrade #RSCT_VERSION_53="2.4.9.2" until 3.1.0.0 RSCT_VERSION_53="2.4.9.4" # rsct faure, this version number is not a prereq anymore but # rather states our pkg level including ptfs which we ship AIX_ppc_IBM_5300_00_PKG_RSCTCORE="rsct.core.rmc $RSCT_VERSION_53" AIX_ppc_IBM_5300_00_PKG_RSCTBASIC="rsct.basic.rte $RSCT_VERSION_53" AIX_ppc_IBM_5300_00_PKG_RSCTSTORAGERM="rsct.opt.storagerm $RSCT_VERSION_53" # AIX 6.1 since 2.2.0.5 and 2.3.0.2 RSCT_VERSION_61="2.5.1.2" # rsct faure, this version number is not a prereq anymore but # rather states our pkg level including ptfs which we ship AIX_ppc_IBM_6100_00_PKG_RSCTCORE="rsct.core.rmc $RSCT_VERSION_61" AIX_ppc_IBM_6100_00_PKG_RSCTBASIC="rsct.basic.rte $RSCT_VERSION_61" AIX_ppc_IBM_6100_00_PKG_RSCTSTORAGERM="rsct.opt.storagerm $RSCT_VERSION_61" AIX_ppc_IBM_6100_00_PKG_WPAR="/usr /opt" #----------------------------------------------------------------------------------------------------- # List of packages(rpms) for Linux: Linux_PKGS="KSH PERL LIBSTD LIBSTD64 PAM" # ALL checked by default prereq check function: checkLinuxPrereqs # e.g. values "perl /perl$" will cause the following check rpm -ql perl | grep -E "/perl$" # Make sure to escape + in the name, like: "compat-libstdc++-33-3.2.3 ^/usr/lib/libstdc\+\+.so.5$" # _____ # any architecture: _aaa_ # any distro: _ddd_ # any version_level: _v_l_ # For all Linux arch. all distro, any version_level Linux_aaa_ddd_v_l_PKG_KSH="ksh" #Linux_aaa_ddd_v_l_PKG_PERL="perl /perl$" Linux_aaa_SUSE_11_l_PKG_PERL="perl-base /perl$" Linux_aaa_SUSE_10_l_PKG_PERL="perl /perl$" Linux_aaa_SUSE_9_l_PKG_PERL="perl /perl$" Linux_aaa_RH_v_l_PKG_PERL="perl /perl$" Linux_i386_SUSE_v_l_PKG_PAM="pam ^/lib/libpam.so" Linux_ppc_SUSE_11_l_PKG_PAM="pam-32-bit ^/lib/libpam.so" Linux_ppc_SUSE_10_l_PKG_PAM="pam ^/lib/libpam.so" Linux_ppc_SUSE_9_l_PKG_PAM="pam ^/lib/libpam.so" #Linux_ppc_SUSE_v_l_PKG_PAM="pam ^/lib/libpam.so" Linux_s390_SUSE_v_l_PKG_PAM="pam ^/lib/libpam.so" Linux_s390x_SUSE_v_l_PKG_PAM="pam-32bit ^/lib/libpam.so" # for all Linux arch. RH all v_l Linux_aaa_RH_v_l_PKG_LIBSTD="compat-libstdc++-33-3.2.3 ^/usr/lib/libstdc\+\+.so.5$" Linux_aaa_RH_v_l_PKG_PAM="pam ^/lib/libpam.so.0" # 64 bit versions Linux_ppc_RH_v_l_PKG_LIBSTD64="compat-libstdc++-33-3.2.3 ^/usr/lib64/libstdc\+\+.so.5$" Linux_i386x_RH_v_l_PKG_LIBSTD64="compat-libstdc++-33-3.2.3 ^/usr/lib64/libstdc\+\+.so.5$" Linux_s390x_RH_v_l_PKG_LIBSTD64="compat-libstdc++-33-3.2.3 ^/usr/lib64/libstdc\+\+.so.5$" # for cfgsamadapter (document only) c005 #Linux_aaa_RH_4_0_PKG_X11DEPR="xorg-x11-deprecated-libs /usr/X11R6/lib/libXp.so.6" #Linux_aaa_RH_5_0_PKG_X11DEPR="libXp-1.0.0-8 /usr/lib/libXp.so.6" #----------------------------------------------------------------------------------------------------- # List of packages for SunOS SUN_PKGS="SUNWCSU SUNWXCU4 SUNWLIBC SUNWCSL \ SUNWCSLR SUNWSCPU SUNWLIBMSR SUNWLIBMS \ SUNWESU SUNWLOC SUNWGZIP SUNWCSR \ SUNWXWRTL SUNWPERL" # Value represents a SunOS package that can be queried with pkginfo -q SunOS_sparc_SUN_v_l_PKG_SUNWCSU="SUNWcsu" SunOS_sparc_SUN_v_l_PKG_SUNWXCU4="SUNWxcu4" SunOS_sparc_SUN_v_l_PKG_SUNWLIBC="SUNWlibC" SunOS_sparc_SUN_v_l_PKG_SUNWCSL="SUNWcsl" SunOS_sparc_SUN_v_l_PKG_SUNWCSLR="SUNWcslr" SunOS_sparc_SUN_v_l_PKG_SUNWSCPU="SUNWscpu" SunOS_sparc_SUN_v_l_PKG_SUNWLIBMSR="SUNWlibmsr" SunOS_sparc_SUN_v_l_PKG_SUNWLIBMS="SUNWlibms" SunOS_sparc_SUN_v_l_PKG_SUNWESU="SUNWesu" SunOS_sparc_SUN_v_l_PKG_SUNWLOC="SUNWloc" SunOS_sparc_SUN_v_l_PKG_SUNWGZIP="SUNWgzip" SunOS_sparc_SUN_v_l_PKG_SUNWCSR="SUNWcsr" SunOS_sparc_SUN_v_l_PKG_SUNWXWRTL="SUNWxwrtl" SunOS_sparc_SUN_v_l_PKG_SUNWPERL="SUNWperl.*core" #c004 # Minimum sam package version for upgrade if exists REQ_SAM_UPGRADE_VERSION="1.2.0.0" # End of prereq package specifications ####################################################################################################### PN=`basename $0` # strip program name from call arg[0] DIR=`dirname $0` # strip directory from call arg[0] SCRIPT=$PN': ' MSG_NAME=installSAM # messages are in installSAM.*.msg files # version of rsct getRSCTVersionFromOSVersion RSCT_VSN= OS=`uname -s` # distinguish "Linux" "AIX" before trying to determine platform DATE=`date` HOST_NAME=`hostname` ARCH='' ARCH_64=0 # indicate if this is a 64 bit architecture PLATFORM='' # English only messages: ENMSG_NOARCH="${SCRIPT}Cannot determine architecture -exit." ENMSG_NOLANG="${SCRIPT}Cannot determine language - will use English." ENMSG_NOLIC="${SCRIPT}Cannot find license files - will show English license." ENMSG_NONLS="${SCRIPT}The language currently set is not supported :" ENMSG_LANGINST="${SCRIPT}If you want to cancel $SCRIPT to set a supported language, type 'y':" ENMSG_NODEFLANG="${SCRIPT}Default language not found -exit." ENMSG_CONTEN="${SCRIPT}Will continue in English." ENMSG_LOG_STARTED="${SCRIPT}>>> Prerequisite on $HOST_NAME check - log started :" ENMSG_LOG_ENDED="${SCRIPT}<<< Prerequisite on $HOST_NAME check - log ended :" ENMSG_NOT_PERFORMED="${SCRIPT}Prerequisite checking was not performed." ENMSG_NO_DIR="${SCRIPT}Directory specified with option -d does not exist:" ENMSG_NO_PKGDIR="${SCRIPT}Directory specified with option -d does not contain required files:" ENMSG_NO_LOGDIR="${SCRIPT}Unable to create log file. Maybe the path does not exist:" USAGE1="Usage:" USAGE2=" prereqSAM [-d inst_pkg_dir] [-l log_file]" # Return codes from prereqSAM script RC_OK=0 RC_PREREQ_VERSION=20 RC_PREREQ_NOT_INST=21 RC_PREREQ_OSVERSION=22 RC_PREREQ_UNABLE=23 RC_PREREQ_NOTRW=24 # allows to add options: OPTIONS=$* OPT_SILENT=0 OPT_NOLICCHECK=0 OPT_NOAIXRSCT=0 OPT_DIR='' OPT_LOG_FILE='' #---------------------------------- # functions #---------------------------------- # function logit # log and conditionally echo message # parameters: # $1 message # Side effects: # if OPT_SILENT==1 do not echo message # log message in file prereqSAM.PID.log # logit () { echo "$1" >> $INST_LOG if [ $OPT_SILENT -eq 0 ] ; then echo "$1" fi } # function makeLog # paramters: # $1 prefix of log file # Make log file of the form: /tmp/$1.#.log # where # is a number that does not exist yet in # existing log files. # returns log file name. makeLog () { NUM=`ls /tmp/$1.*.log 2>/dev/null | sed s/"\/tmp\/$1\."//g | sed s/"\.log"//g | sort -nr |head -1` if [ -n "$NUM" ] ; then NUM=`expr $NUM + 1` else NUM=1 fi INST_LOG=/tmp/$1.$NUM.log echo $INST_LOG } # function instexit. # exit installation with return code. # parameters: # $1 RC # $2 if exists then skip processing acc. to flag # "NONE" no output # "NONLS" no NLS related text # Side effects: # exits script after logging. # instexit () { if [ -z "$2" ] || [ "$2" = "0" ] ; then if [ $1 -eq 0 ] ; then case "$OS" in AIX) logit "$I60 $OS $IS_VERSION" ;; Linux|SunOS) logit "$I60" logit "$IS_VERSION" ;; esac else case "$OS" in AIX) logit "$I61 ${OS} $IS_VERSION" ;; Linux|SunOS) logit "$I61 ${OS} ${ARCH} ${DISTRO}" logit "$IS_VERSION" ;; esac logit "$I62 $1" case "$1" in $RC_PREREQ_VERSION) logit "$I64" ;; $RC_PREREQ_NOT_INST) logit "$I65" ;; $RC_PREREQ_OSVERSION) logit "$I66" ;; $RC_PREREQ_UNABLE) logit "$I67" ;; esac #echo "$I63" >> $INST_LOG #echo " - $RC_PREREQ_VERSION - $I64" >> $INST_LOG #echo " - $RC_PREREQ_NOT_INST - $I65" >> $INST_LOG #echo " - $RC_PREREQ_OSVERSION - $I66" >> $INST_LOG #echo " - $RC_PREREQ_UNABLE - $I67" >> $INST_LOG if [ $OPT_SILENT -eq 0 ] ; then echo "$I68 $INST_LOG" fi fi fi if [ -z "$2" ] || [ "$2" = "0" ] || [ "$2" = "NONLS" ] ; then if [ -z "$OPT_LOG_FILE" ] ; then DATE=`date` echo "$ENMSG_LOG_ENDED $DATE" >> $INST_LOG fi fi exit $1 } # function getASCII # get the ASCII NLS string from $NLS_FILE # if string is not available get from prereqSAM.en_US.msg - English # parameters: # $1 ASCII key to search for NLS string # $2 == 1, if removal of trailing CR(13) is required # return: # ASCII NLS string with $SCRIPT prefix # getASCII () { # find NLS text for pattern xxx= R=${SCRIPT}`cat $NLS_FILE | $GREP $1= | sed s/$1=//` #echo "R='$R'" if [ "$R" = "$SCRIPT" ] ; then # assume: not yet available as translated text, use English R=${SCRIPT}`cat "$MSG_DIR/$MSG_NAME.en_US.msg" | $GREP $1= | sed s/$1=//` fi if [ "$R" != "$SCRIPT" ] && [ $2 -eq 1 ] ; then # remove CR #R=`echo $R |$AWK 'BEGIN {RS="\x0D\x0A"} {gsub("\x0D\x0A","\x0A"); print; exit;}'` # TODO: Only remove if CRLF detected. Otherwise message will be truncated. RCNT=`echo $R | wc -c` RCNT=`expr $RCNT - 2` R=`echo $R | cut -b1-$RCNT` fi echo $R } # function mapLanguage # get similar language: e.g. # if $1 is en_US.iso885915 then map to en_US # parameters: # $1 language currently set # mapLanguage () { MAPPED_LANG=$NLS_LANG # try map utf8 -> UTF-8 IS_UTF8=`echo $1 | $GREP -c utf8` if [ $IS_UTF8 -ne 0 ] && [ "$OS" = "Linux" ] ; then MAPPED_LANG=`echo $1 | sed s/'.utf8'/'.UTF-8'/` else # not UTF-8 # extract first part like 'en_' from 'en_UK' LANG_PREFIX=`echo $1 | sed s/_.*/_/` case "$LANG_PREFIX" in en_) MAPPED_LANG=$LANG_PREFIX"US" ;; de_) MAPPED_LANG=$LANG_PREFIX"DE" ;; es_) MAPPED_LANG=$LANG_PREFIX"ES" ;; fr_) MAPPED_LANG=$LANG_PREFIX"FR" ;; it_) MAPPED_LANG=$LANG_PREFIX"IT" ;; pt_) MAPPED_LANG=$LANG_PREFIX"BR" ;; ja_) IS_EUC=`echo $1 | $GREP -ic eucjp` if [ $IS_EUC -ne 0 ] ; then if [ "$OS" = "Linux" ] ; then MAPPED_LANG=$LANG_PREFIX"JP.eucJP" else MAPPED_LANG=$LANG_PREFIX"JP" fi else MAPPED_LANG=$LANG_PREFIX"JP" fi ;; ko_) IS_EUC=`echo $1 | $GREP -ic euckr` if [ $IS_EUC -ne 0 ] ; then if [ "$OS" = "Linux" ] ; then MAPPED_LANG=$LANG_PREFIX"KR.eucKR" else MAPPED_LANG=$LANG_PREFIX"KR" fi else MAPPED_LANG=$LANG_PREFIX"KR" fi ;; zh_) IS_GBK=`echo $1 | $GREP -ic gbk` if [ $IS_GBK -ne 0 ] ; then if [ "$OS" = "Linux" ] ; then MAPPED_LANG=$LANG_PREFIX"CN.GBK" else MAPPED_LANG=$LANG_PREFIX"CN" fi break fi IS_GB18=`echo $1 | $GREP -ic gb18030` if [ $IS_GB18 -ne 0 ] ; then if [ "$OS" = "Linux" ] ; then MAPPED_LANG=$LANG_PREFIX"CN.GB18030" else MAPPED_LANG="Zh_CN" fi break fi IS_GB23=`echo $1 | $GREP -ic gb2312` if [ $IS_GB23 -ne 0 ] ; then if [ "$OS" = "Linux" ] ; then MAPPED_LANG=$LANG_PREFIX"CN.GB2312" else MAPPED_LANG=$LANG_PREFIX"CN" fi break fi IS_TWEUC=`echo $1 | $GREP -ic euctw` if [ $IS_TWEUC -ne 0 ] ; then if [ "$OS" = "Linux" ] ; then MAPPED_LANG=$LANG_PREFIX"TW.eucTW" else MAPPED_LANG=$LANG_PREFIX"TW" fi break fi IS_TWBIG5=`echo $1 | $GREP -ic big5` if [ $IS_TWBIG5 -ne 0 ] ; then if [ "$OS" = "Linux" ] ; then MAPPED_LANG=$LANG_PREFIX"TW.Big5" else MAPPED_LANG="Zh_TW" fi break fi IS_TW=`echo $1 | $GREP -ic tw` if [ $IS_TW -ne 0 ] ; then MAPPED_LANG=$LANG_PREFIX"TW" else MAPPED_LANG=$LANG_PREFIX"CN" fi ;; esac fi #echo "mapped to: "$MAPPED_LANG NLS_LANG=$MAPPED_LANG } # function compVersion # compare versions from $1 and $2 # parameters: # $1 prereq pkg version # $2 installed pkg version # return RC_PREREQ_VERSION if version of $1(prereq) > $2(installed) # return 0 if version of $1 <= $2 # return RC_PREREQ_UNABLE if versions could not be compared # # compVersion () { CMPRC=$RC_PREREQ_UNABLE # delimit the version x.x.x.x-yydddd with #x.x.x.x-yydddd#, then cut the # version field and remove the . (3x) and the - to get the version as a number # There may be versions like x.x.x.x-0 or x.x.x.x-yyddd, where yy is the last 2 digits of the year and # ddd is the day in the year. Versions like x.x.x.x-0 must be extended to x.x.x.x-00000 for # successful comparison VT1=`extend0 $1` VT2=`extend0 $2` V1=`echo $VT1 | sed 's/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}-[0-9]\{5\}/#&#/g' | cut -s -d '#' -f2 | sed 's/\.//g' | sed 's/-//g'` V2=`echo $VT2 | sed 's/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}-[0-9]\{5\}/#&#/g' | cut -s -d '#' -f2 | sed 's/\.//g' | sed 's/-//g'` if [ -n "$V1" ] && [ -n "$V2" ] ; then if [ $V1 -gt $V2 ] ; then CMPRC=$RC_PREREQ_VERSION else CMPRC=0 # OK fi fi echo $CMPRC } # function extend0 # check if version from $1 has only -0 appended, if yes extend by -00000 # parameters: # $1 Name 1 with a version # # return changed version x.x.x.x-00000 if version was x.x.x.x-0 # extend0 () { # There may be versions like x.x.x.x-0 or x.x.x.x-yyddd where yy is the last 2 digits of the year and # ddd is the day in the year. VOUT="" COUNT1=`echo $1 | $GREP -Ec "\-0$"` # detect x.x.x.x-0 COUNT2=`echo $1 | $GREP -Ec "\-0\."` # detect x.x.x.x-0..rpm COUNT3=`echo $1 | $GREP -Ec "\-[0-9]\{5\}\."` # detect x.x.x.x-yyddd..rpm if [ $COUNT3 -eq 1 ] ; then # detect x.x.x.x-yyddd..rpm - leave as is VOUT=$1 elif [ $COUNT2 -eq 1 ] ; then # detect x.x.x.x-0..rpm # chop off appendix -0..rpm to append -00000 VOUT=`echo $1 | sed 's/\-0\..*\.rpm//'` VOUT=$VOUT"-00000" elif [ $COUNT1 -eq 1 ] ; then # detect x.x.x.x-0 VOUT=$1"0000" else # x.x.x.x VOUT=$1"-00000" fi echo $VOUT } # function expand0s # Expand an integer for a number of zeros. # parameters: # $1 integer to expand # $2 number of digits to expand # return expanded integer # Examples: # expand 9 3 returns 900 # expand 921 3 returns 921 # expand0s () { RET=$1 if [ $RET -ne 0 ] ; then WC=`echo $1 | wc -m` WC=`expr ${WC} - 1` # wc always return 1 more than actual count ZEROS=`expr $2 - $WC` # number of zeros left to expand while [ "$ZEROS" -gt 0 ] do RET=${RET}0 ZEROS=`expr ${ZEROS} - 1` done fi echo $RET } # function extractInstVersion # Extract version from installed package # parameters: # $1 name of package # return package version: any of the form x.x.x.x # extractInstVersion () { VERSION="" case "$OS" in AIX) INST=`lslpp -l $1 2>/dev/null | $GREP -E $1 | head -1` if [ -n "$INST" ] ; then VERSION=`echo $INST | sed 's/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/#&#/g' | cut -s -d "#" -f2` fi ;; Linux) INST=`rpm -q $1 2>/dev/null` RC=$? if [ $RC -eq 0 ] && [ -n "$INST" ] ; then VERSION=`echo $INST | sed s/"$1\-"// ` fi ;; SunOS) INST=`pkginfo -x $1 2>/dev/null` if [ $RC -eq 0 ] && [ -n "$INST" ] ; then # extract version among line with name and revision VERSION=`echo $INST | sed s/.*\)// | sed s/,.*// | tail -1` fi ;; esac echo $VERSION } ############################## version detection functions ##################################### # AIX Check if version matches any of the required versions # $1 required versions, e.g. "5200-00 5300-00" # $2 existing version of the form: 5x00-xx # return matching version from $1, e.g. "5300_00" , otherwise '' checkVersionAIX () { VSN_OK='' DETECTED_VERSION=$2 # strip existing version and level: VSN_IS=`echo $2 | cut -f1 -d-` LVL_IS=`echo $2 | cut -f2 -d-` for VSN in $1 do # split required - RQV=`echo $VSN | cut -f1 -d-` RQL=`echo $VSN | cut -f2 -d-` if [ $RQV -eq $VSN_IS ] ; then if [ $RQL -eq 0 ] ; then VSN_OK="${RQV}_${RQL}" break # version is OK, real level may be > 0 - is acceptable elif [ -n "$LVL_IS" ] ; then # There is a level and required level - do compare # Rule is required level <= is level if [ $RQL -le $LVL_IS ] ; then VSN_OK="${RQV}_${RQL}" break # OK - required level <= is level fi fi fi done echo $VSN_OK } # SUSE i386,ppc,s390 - check if version matches any of the required versions # $1 required versions, e.g. "8.3 9.0" # $2 existing version of the flavors: # # flavor 1: # SuSE SLES-8 (i386) --> 8.1 # VERSION = 8.1 # # Special processing for SUSE Version 8 Patchlevel 3/4 , where patchlevel is not indicated (stays 8.1). # remove it part once we are beyond 8.x as minimum version # s390/s390x/i386 8.3 is kernel level 2.4.21 or higher! # ppc 8.4 is kernel level 2.4.21 or higher! # # flavor 2: # SUSE LINUX Enterprise Server 9 (aaa) ---> 9.2 # VERSION = 9 # PATCHLEVEL = 2 # # flavor 3: # SUSE SLES 9.2 (x586) --> 9.2 # VERSION = 9.2 # return matching version from $1, with the dot replaced by _, e.g. "9_0", # otherwise '' checkVersionaaaSUSE () { VSN_OK='' # strip existing version (flavor 1 and 2): VSN_IS=`echo $2 | $GREP VERSION | sed s/".*VERSION = "// | sed s/" PATCHLEVEL.*"//` # try get patchlevel LVLP_IS=`echo $2 | $GREP PATCHLEVEL | sed s/".*PATCHLEVEL = "//` LVL_IS='' # Check for flavor 1 and 3 HAS_V_L=`echo $VSN_IS | $GREP -Ec "\."` if [ $HAS_V_L -eq 0 ] ; then # flavor 2 consider patchlevel if [ -z "$LVLP_IS" ] ; then # no patch level, assume 0 LVL_IS=0 else LVL_IS=$LVLP_IS fi else # flavor 1 # split . (keep statements in this order!) LVL_IS=`echo $VSN_IS | cut -f2 -d.` VSN_IS=`echo $VSN_IS | cut -f1 -d.` # Have a patchlevel #echo "LVL_IS: $LVL_IS" >> $INST_LOG #echo "LVLP_IS: $LVLP_IS" >> $INST_LOG if [ -n "$LVLP_IS" ] ; then # Some have version.level AND patchlevel e.g. VERSION = 8.1 ...PATCHLEVEL = 3 # In that case take the PATCHLEVEL if higher. if [ $LVLP_IS -gt $LVL_IS ] ; then # patchlevel is higher LVL_IS=$LVLP fi fi fi # expand level to 4 digits in order to handle level in e.g. 4.5(req) > 4.123(given) correctly (5000 > 1230) LVL_IS=`expand0s $LVL_IS 4` # expand to 4 digits for VSN in $1 do # split required . RQV=`echo $VSN | cut -f1 -d.` RQL=`echo $VSN | cut -f2 -d.` XPRQL=`expand0s $RQL 4` # expand to 4 digits if [ $RQV -eq $VSN_IS ] ; then if [ $RQL -eq 0 ] ; then VSN_OK="${RQV}_${RQL}" break # version is OK, real level may be > 0 - is acceptable elif [ -n "$LVL_IS" ] ; then # There is a level and required level - do compare # Rule is required level <= is level if [ $XPRQL -le $LVL_IS ] ; then VSN_OK="${RQV}_${RQL}" break # OK - required level <= is level fi fi fi done echo $VSN_OK } # RH i386,ppc,s390 - check if version matches any of the required versions # $1 required versions, e.g. "3.5 4.0" # $2 existing version of the form: # flavor 1: # Red Hat Enterprise Linux AS release 4 (Nahant Update 1) --> 4.1 # Red Hat Enterprise Linux ES release 4 (Nahant Update 1) --> 4.1 # or: # Red Hat Enterprise Linux AS release 3 (Taroon Update 2) --> 3.2 # # flavor 2: # Red Hat Enterprise Linux Server release 4.92 (Tikanga) # # return matching version from $1, with the dot replaced by _, e.g. "4_0", # otherwise '' checkVersionaaaRH () { VSN_OK='' # strip existing version and level: VSN_IS=`echo $2 | $GREP release | sed s/".*release "// | sed s/" (.*"//` # split existing . try flavor 2 LVL_IS=`echo $VSN_IS | cut -s -f2 -d.` VSN_IS=`echo $VSN_IS | cut -f1 -d.` if [ -z "$LVL_IS" ] ; then # is flavor 1 LVL_IS=`echo $2 | $GREP Update | sed s/".*Update "// | sed s/").*"//` fi if [ -n "$LVL_IS" ] ; then # expand level to 4 digits in order to handle level in e.g. 4.5(req) > 4.123(given) correctly (5000 > 1230) LVL_IS=`expand0s $LVL_IS 4` # expand to 4 digits fi for VSN in $1 do # split required . RQV=`echo $VSN | cut -s -f1 -d.` RQL=`echo $VSN | cut -s -f2 -d.` XPRQL=`expand0s $RQL 4` # expand to 4 digits if [ $RQV -eq $VSN_IS ] ; then if [ $RQL -eq 0 ] ; then VSN_OK="${RQV}_${RQL}" break # version is OK, real level may be > 0 - is acceptable elif [ -n "$LVL_IS" ] ; then # There is a level and required level - do compare # Rule is required level <= is level if [ $XPRQL -le $LVL_IS ] ; then VSN_OK="${RQV}_${RQL}" break # OK - required level <= is level fi fi fi done echo $VSN_OK } # SUN sparc - check if version matches any of the required versions # $1 required versions, e.g. "10.0" # $2 existing version of the flavors: # flavor 1: # Solaris 10 1/06 s10s_u1wos_19a SPARC # Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. # Use is subject to license terms. # Assembled 07 December 2005 # # No other flavors seen yet. # return matching version from $1, with the dot replaced by _, e.g. "9_0", # otherwise '' checkVersionSUN () { VSN_OK='' # strip existing version (flavor 1 and 2): VSN_IS=`echo $2 | $GREP Solaris | sed s/".*Solaris "// | sed s/" .*SPARC.*"//` # detection of level not supported yet for VSN in $1 do # split required . RQV=`echo $VSN | cut -f1 -d.` RQL=`echo $VSN | cut -f2 -d.` if [ $RQV -eq $VSN_IS ] ; then VSN_OK="${RQV}_${RQL}" break # version is OK, real level may be > 0 - is acceptable fi done echo $VSN_OK } ############################## prereq package checking functions ##################################### # AIX Check prereqs for several categoires # $1 matching required version, e.g. "5300" # return 0 if all prereqs met. checkAIXPrereqs () { RET_PREREQ_RC=0 if [ -z "$1" ] ; then RET_PREREQ_RC=$RC_PREREQ_OSVERSION else for PKG in $AIX_PKGS do # form name for package and check if a value # for it exists #echo "test Checking for package: ${OS}_${ARCH}_${DISTRO}_$1_PKG_$PKG" >> $INST_LOG #PKG_PREREQ=$(eval "echo \$${OS}_${ARCH}_${DISTRO}_$1_PKG_$PKG") PKG_PREREQ=`eval echo \`eval "echo \$\{${OS}_${ARCH}_${DISTRO}_$1_PKG_$PKG\}"\`` #echo "test After 1. check found package: '$PKG_PREREQ'" >> $INST_LOG if [ -z "$PKG_PREREQ" ] ; then # check if any version(pattern: 'v_l') package exists #echo "test Checking for package: ${OS}_${ARCH}_${DISTRO}_v_l_PKG_$PKG" >> $INST_LOG #PKG_PREREQ=$(eval "echo \$${OS}_${ARCH}_${DISTRO}_v_l_PKG_$PKG") PKG_PREREQ=`eval echo \`eval "echo \$\{${OS}_${ARCH}_${DISTRO}_v_l_PKG_$PKG\}"\`` fi #echo "test After all checks found package: '$PKG_PREREQ'" >> $INST_LOG if [ -z "$PKG_PREREQ" ] ; then # no value to check for with this package #echo "test No values specified for package? : ' '${OS}_${ARCH}_${DISTRO}_$1_PKG_$PKG'" >> $INST_LOG continue else PREREQ_RC=0 # have a value for that package case "$PKG" in JAVA) PREREQ_RC=`checkAIXJAVA "$PKG_PREREQ"` ;; WPAR) PREREQ_RC=`checkAIXWPAR "$PKG_PREREQ"` ;; *) echo "$I69 $PKG_PREREQ" >> $INST_LOG PREREQ_RC=`checkAIXInstPkg "$PKG_PREREQ"` ;; esac #echo "test: After checking package: $PREREQ_RC: '$PREREQ_RC'" >> $INST_LOG # set worst RC if [ $RET_PREREQ_RC -lt $PREREQ_RC ] ; then RET_PREREQ_RC=$PREREQ_RC fi #echo "test: After checking package: $PKG new RC: '$RET_PREREQ_RC'" >> $INST_LOG fi done fi echo $RET_PREREQ_RC } # AIX Check prereqs for several categories # # $1 Prereq package name and runtime version, # e.g. "xlC.aix50.rte 7.0.0.1" # return 0 if all prereqs met. # 1 if prereq version > installed version # 2 if comparison failed checkAIXInstPkg () { PIRC=$RC_PREREQ_UNABLE PKGN=`echo $1 | cut -d' ' -f1` PKGVERSION=`echo $1 | cut -d' ' -f2` echo "$I70 '$PKGN' '$PKGVERSION'" >> $INST_LOG INSTVERSION=`extractInstVersion $PKGN` IS_RSCT=`echo $PKGN | grep -c "^rsct."` if [ -n "$INSTVERSION" ] ; then echo "$I71 '$PKGN' '$INSTVERSION'" >> $INST_LOG PIRC=`compVersion $PKGVERSION $INSTVERSION` if [ $PIRC -eq $RC_PREREQ_VERSION ] ; then # check if rsct and change RC, because it will be installed if [ $IS_RSCT -ne 0 ] && [ $OPT_NOAIXRSCT -eq 0 ] ; then # rsct must be installed or upgraded by installSAM PIRC=0 # to avoid failure of installSAM echo "$I117 $PKGVERSION" >> $INST_LOG else echo "$I72 $PKGN" >> $INST_LOG fi elif [ $PIRC -eq 0 ] ; then echo "$I73 $PKGN" >> $INST_LOG else echo "$I74 $PKGN" >> $INST_LOG fi else if [ $IS_RSCT -ne 0 ] && [ $OPT_NOAIXRSCT -eq 0 ] ; then # rsct must be installed or upgraded by installSAM PIRC=0 # to avoid failure of installSAM echo "$I117 $PKGVERSION" >> $INST_LOG else PIRC=$RC_PREREQ_NOT_INST echo "$I75 $PKGN" >> $INST_LOG fi fi echo $PIRC } # AIX Check prereqs for Java # # $1 Version of Java. e.g. "142" # return 0 if all prereqs met. # 1 if prereq version > installed version # 2 if comparison failed checkAIXJAVA () { PIRC=$RC_PREREQ_UNABLE EXJPKGS=`lslpp -l Java* | $GREP -E "ava.*.(rte|sdk)" | $GREP -Ev ".*64.*"` ISJVERSION="0" AIX_REQ_JAVA_VERSION=$1 EXJPKG="" if [ -n "$EXJPKGS" ] ; then for EXJPKG in $EXJPKGS do # take only first 3 digits ISJV=`echo $EXJPKG | sed 's/[1-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/#&#/g' | cut -s -d "#" -f2 | sed 's/\.//g'` if [ "$ISJVERSION" -lt "$ISJV" ] ; then ISJVERSION=$ISJV ISJPKG=$EXJPKG fi done fi #echo "Test - EXJPKG: $ISJPKG" #echo "Test - architecture: $ARCH" #echo "Test - is java version : $ISJVERSION" #echo "Test - required java version: $AIX_REQ_JAVA_VERSION" if [ "$ISJVERSION" = "0" ] ; then # no java exists PIRC=$RC_PREREQ_NOT_INST echo "$I37 $AIX_REQ_JAVA_VERSION" >> $INST_LOG elif [ "$ISJVERSION" -lt "$AIX_REQ_JAVA_VERSION" ] ; then # version too low PIRC=$RC_PREREQ_VERSION echo "$I36 $ISJPKG" >> $INST_LOG echo "$I37 $AIX_REQ_JAVA_VERSION" >> $INST_LOG else echo "$I73 Java $ISJVERSION" >> $INST_LOG PIRC=0 fi echo $PIRC } # AIX Check WPAR # # $1 pathes that should be writable # return 0 if all prereqs met. # RC_PREREQ_NOTRW if a path is not # RC_PREREQ_UNABLE if test failed checkAIXWPAR () { PIRC=$RC_PREREQ_UNABLE AIX_RW_PATHES=$1 RO_PATHES="" if [ -n "$AIX_RW_PATHES" ] ; then for RWPATH in $AIX_RW_PATHES do if [ ! -w "$RWPATH" ] ; then RO_PATHES="$RO_PATHES $RWPATH" fi done fi if [ -n "$RO_PATHES" ] ; then # check if any pathes are not R/W # Any pathes are not rw PIRC=$RC_PREREQ_NOTRW ROMSG="$I105" IS_WPAR=`uname -W` 2>/dev/null if [ $? -eq 0 ] && [ $IS_WPAR -ne 0 ] ; then # Read only is due to WPAR ROMSG="$I106" fi echo "$ROMSG $RO_PATHES" >> $INST_LOG else # all pathes are R/W PIRC=0 fi echo $PIRC } # Get RSCT version from AIX version # # $1 AIX version # Returns nothing. sets RSCT_VSN. getRSCTVersionFromOSVersion () { AIX_VR=`echo $1 | cut -c1,2` case $AIX_VR in 53) RSCT_VSN=$RSCT_VERSION_53 ;; 61) RSCT_VSN=$RSCT_VERSION_61 ;; esac } # Linux Check prereqs for several categories # $1 matching required version, e.g. "3_5" # return 0 if all prereqs met. checkLinuxPrereqs () { RET_PREREQ_RC=0 if [ -z "$1" ] ; then RET_PREREQ_RC=$RC_PREREQ_OSVERSION else for PKG in $Linux_PKGS do # form name for package and check if a value if it exists # check if exists in any architecture (pattern: 'aaa') # any distro (pattern: 'ddd') # any version (pattern: 'v_l') #echo "Checking for package: ${OS}_aaa_ddd_v_l_PKG_$PKG" >> $INST_LOG #PKG_PREREQ=$(eval "echo \$${OS}_aaa_ddd_v_l_PKG_$PKG") PKG_PREREQ=`eval echo \`eval "echo \$\{${OS}_aaa_ddd_v_l_PKG_$PKG\}"\`` if [ -z "$PKG_PREREQ" ] ; then # check if exists in any architecture (pattern: 'aaa') # any distro (pattern: 'ddd') # specific version #echo "Checking for package: ${OS}_aaa_ddd_$1_PKG_$PKG" >> $INST_LOG #PKG_PREREQ=$(eval "echo \$${OS}_aaa_ddd_$1_PKG_$PKG") PKG_PREREQ=`eval echo \`eval "echo \$\{${OS}_aaa_ddd_$1_PKG_$PKG\}"\`` #echo "After aaa only check found package: '$PKG_PREREQ'" >> $INST_LOG fi if [ -z "$PKG_PREREQ" ] ; then # check if exists in specific architecture # any distro (pattern: 'ddd') # any version (pattern: 'v_l') #echo "Checking for package: ${OS}_${ARCH}_ddd_v_l_PKG_$PKG" >> $INST_LOG #PKG_PREREQ=$(eval "echo \$${OS}_${ARCH}_ddd_v_l_PKG_$PKG") PKG_PREREQ=`eval echo \`eval "echo \$\{${OS}_${ARCH}_ddd_v_l_PKG_$PKG\}"\`` #echo "After v_l only check found package: '$PKG_PREREQ'" >> $INST_LOG fi if [ -z "$PKG_PREREQ" ] ; then # check if exists in specific architecture # any distro (pattern: 'ddd') # specific version #echo "Checking for package: ${OS}_${ARCH}_ddd_$1_PKG_$PKG" >> $INST_LOG #PKG_PREREQ=$(eval "echo \$${OS}_${ARCH}_ddd_$1_PKG_$PKG") PKG_PREREQ=`eval echo \`eval "echo \$\{${OS}_${ARCH}_ddd_$1_PKG_$PKG\}"\`` #echo "After 1. check found package: '$PKG_PREREQ'" >> $INST_LOG fi if [ -z "$PKG_PREREQ" ] ; then # check if exists in any architecture (pattern: 'aaa') # specific distro # any version (pattern: 'v_l') # check if any architecture (pattern: 'aaa') && version(pattern: 'vrmf') package exists #echo "Checking for package: ${OS}_aaa_${DISTRO}_v_l_PKG_$PKG" >> $INST_LOG #PKG_PREREQ=$(eval "echo \$${OS}_aaa_${DISTRO}_v_l_PKG_$PKG") PKG_PREREQ=`eval echo \`eval "echo \$\{${OS}_aaa_${DISTRO}_v_l_PKG_$PKG\}"\`` fi if [ -z "$PKG_PREREQ" ] ; then # check if exists in any architecture (pattern: 'aaa') # specific distro # specific version #echo "Checking for package: ${OS}_aaa_${DISTRO}_$1_PKG_$PKG" >> $INST_LOG #PKG_PREREQ=$(eval "echo \$${OS}_aaa_${DISTRO}_$1_PKG_$PKG") PKG_PREREQ=`eval echo \`eval "echo \$\{${OS}_aaa_${DISTRO}_$1_PKG_$PKG\}"\`` #echo "After aaa only check found package: '$PKG_PREREQ'" >> $INST_LOG fi if [ -z "$PKG_PREREQ" ] ; then # check if exists in specific architecture # specific distro # any version (pattern: 'v_l') #echo "Checking for package: ${OS}_${ARCH}_${DISTRO}_v_l_PKG_$PKG" >> $INST_LOG #PKG_PREREQ=$(eval "echo \$${OS}_${ARCH}_${DISTRO}_v_l_PKG_$PKG") PKG_PREREQ=`eval echo \`eval "echo \$\{${OS}_${ARCH}_${DISTRO}_v_l_PKG_$PKG\}"\`` #echo "After v_l only check found package: '$PKG_PREREQ'" >> $INST_LOG fi if [ -z "$PKG_PREREQ" ] ; then # check if exists in specific architecture # specific distro # specific version #echo "Checking for package: ${OS}_${ARCH}_${DISTRO}_$1_PKG_$PKG" >> $INST_LOG #PKG_PREREQ=$(eval "echo \$${OS}_${ARCH}_${DISTRO}_$1_PKG_$PKG") PKG_PREREQ=`eval echo \`eval "echo \$\{${OS}_${ARCH}_${DISTRO}_$1_PKG_$PKG\}"\`` #echo "After 1. check found package: '$PKG_PREREQ'" >> $INST_LOG fi #echo "After all checks found package: '$PKG_PREREQ'" >> $INST_LOG if [ -z "$PKG_PREREQ" ] ; then # no value to check for with this package #echo "No values specified for package? : '${OS}_${ARCH}_${DISTRO}_$1_PKG_$PKG'" >> $INST_LOG continue else PREREQ_RC=0 # have a value for that package case "$PKG" in KSH) PREREQ_RC=`checkPartExists "$PKG_PREREQ"` ;; *) PREREQ_RC=`checkLinuxInstPkg "$PKG_PREREQ"` ;; esac #echo "After checking package: $PKG RC: '$PREREQ_RC'" >> $INST_LOG # set worst RC if [ $RET_PREREQ_RC -lt $PREREQ_RC ] ; then RET_PREREQ_RC=$PREREQ_RC fi #echo "Test: After checking package: $PKG new RC: '$RET_PREREQ_RC'" >> $INST_LOG fi done fi echo $RET_PREREQ_RC } # Linux check prereqs for several categories # # $1 Prereq rpm name and part to look for, e.g. "compat-libstdc++-33-3.2.3 ^/usr/lib/libstdc\+\+.so.5$" # The second part is a regular expression to make the filter to the part location as narrow as possible # return 0 if all prereqs met. # RC_PREREQ_VERSION if prereq version > installed version # RC_PREREQ_NOT_INST if package is not installed # RC_PREREQ_UNABLE if comparison failed checkLinuxInstPkg () { PIRC=$RC_PREREQ_UNABLE RPM=`echo $1 | cut -d' ' -f1` echo "$I76 '$RPM'" >> $INST_LOG CHKPART=`echo $1 | cut -d' ' -f2` # try to find out if required RPM has a version RPM_WO_VSN=`echo $RPM | sed s/'\-[0-9].*'//` IS_INST=0 IS_INST_ANY=0 if [ -n "$RPM_WO_VERSION" ] && [ "$RPM" != "$RPM_WO_VERSION" ] ; then # rpm package has version, so can check if exists in any version INSTPKG_ANY=`rpm -q $RPM_WO_VSN 2>/dev/null` if [ $? -eq 0 ] && [ -n "$INSTPKG_ANY" ] ; then IS_INST_ANY=1 fi fi INSTPKG=`rpm -q $RPM 2>/dev/null` if [ $? -eq 0 ] && [ -n "$INSTPKG" ] ; then PARTS=`rpm -ql $RPM 2>/dev/null` if [ $? -eq 0 ] && [ -n "$PARTS" ] ; then #echo "test: find in '$RPM' '$CHKPART'" >> $INST_LOG PART=`echo "$PARTS" | $GREP -E "$CHKPART"` # strip reg ex to make it look better in the log CHKPART=`echo $CHKPART | sed 's/^\^//' | sed 's/$\$//' | sed 's/\\\+/\+/g'` if [ -n "$PART" ] ; then PIRC=0 echo "$I78 '$INSTPKG' '$CHKPART'" >> $INST_LOG else # the part required for that version does not exist maybe 64/32 bits echo "$I79 '$INSTPKG' '$CHKPART'" >> $INST_LOG PIRC=$RC_PREREQ_VERSION fi else # should not happen package installed but cannot list parts echo "$I80 $INSTPKG" >> $INST_LOG fi else if [ $IS_INST_ANY -eq 1 ] ; then # exists at different level PIRC=$RC_PREREQ_VERSION echo "$I81 $INSTPKG_ANY" >> $INST_LOG else # rpm is not installed at any level PIRC=$RC_PREREQ_NOT_INST echo "$I82 $RPM" >> $INST_LOG fi fi echo $PIRC } # SUN Check prereqs for several categories # $1 matching required version, e.g. "10" # return 0 if all prereqs met. checkSUNPrereqs () { RET_PREREQ_RC=0 if [ -z "$1" ] ; then RET_PREREQ_RC=$RC_PREREQ_OSVERSION else for PKG in $SUN_PKGS do # form name for package and check if a value for it exists #echo "test Checking for package: ${OS}_${ARCH}_${DISTRO}_$1_PKG_$PKG" >> $INST_LOG #PKG_PREREQ=$(eval "echo \$${OS}_${ARCH}_${DISTRO}_$1_PKG_$PKG") PKG_PREREQ=`eval echo \`eval "echo \$\{${OS}_${ARCH}_${DISTRO}_$1_PKG_$PKG\}"\`` #echo "test After 1. check found package: '$PKG_PREREQ'" >> $INST_LOG if [ -z "$PKG_PREREQ" ] ; then # check if any version(pattern: 'v_l') package exists #echo "test Checking for package: ${OS}_${ARCH}_${DISTRO}_v_l_PKG_$PKG" >> $INST_LOG #PKG_PREREQ=$(eval "echo \$${OS}_${ARCH}_${DISTRO}_v_l_PKG_$PKG") PKG_PREREQ=`eval echo \`eval "echo \$\{${OS}_${ARCH}_${DISTRO}_v_l_PKG_$PKG\}"\`` fi #echo "test After all checks found package: '$PKG_PREREQ'" >> $INST_LOG if [ -z "$PKG_PREREQ" ] ; then # no value to check for with this package #echo "test No values specified for package? : ' '${OS}_${ARCH}_${DISTRO}_$1_PKG_$PKG'" >> $INST_LOG continue else PREREQ_RC=0 # have a value for that package case "$PKG" in SUNWPERL) PREREQ_RC=`checkSUNInstPkgRegEx "$PKG_PREREQ"` ;; *) PREREQ_RC=`checkSUNInstPkg "$PKG_PREREQ"` ;; esac #echo "test: After checking package: PREREQ_RC: '$PREREQ_RC'" >> $INST_LOG # set worst RC if [ $RET_PREREQ_RC -lt $PREREQ_RC ] ; then RET_PREREQ_RC=$PREREQ_RC fi #echo "test: After checking package: $PKG new RC: '$RET_PREREQ_RC'" >> $INST_LOG fi done fi echo $RET_PREREQ_RC } # SUN check prereqs for several categories # # $1 Prereq pkg name and part to look for, e.g. "SUNWcsu" # return 0 if all prereqs met. # RC_PREREQ_VERSION if prereq version > installed version # RC_PREREQ_NOT_INST if package is not installed # RC_PREREQ_UNABLE if comparison failed checkSUNInstPkg () { PIRC=$RC_PREREQ_UNABLE pkginfo -q "$1" if [ $? -eq 0 ] ; then PIRC=0 echo "$I124 '$1'" >> $INST_LOG else PIRC=$RC_PREREQ_NOT_INST echo "$I123 '$1'" >> $INST_LOG fi echo $PIRC } # SUN check prereqs for several categories with regular expressions # # $1 Prereq pkg name and part to look for, e.g. "SUNWperl.*core" # return 0 if all prereqs met. # RC_PREREQ_VERSION if prereq version > installed version # RC_PREREQ_NOT_INST if package is not installed # RC_PREREQ_UNABLE if comparison failed checkSUNInstPkgRegEx () { PIRC=$RC_PREREQ_UNABLE pkginfo -q "$1" pkginfo -x | /usr/xpg4/bin/grep -E "$1 " > /dev/null 2>&1 if [ $? -eq 0 ] ; then PIRC=0 echo "$I124 '$1'" >> $INST_LOG else PIRC=$RC_PREREQ_NOT_INST echo "$I123 '$1'" >> $INST_LOG fi echo $PIRC } # Check if a part exists # # $1 part name to look for, e.g. "ksh" # return 0 if exists, based on checking with 'which'. # RC_PREREQ_NOT_INST if part does not exist checkPartExists () { PIRC=$RC_PREREQ_NOT_INST which "$1" >/dev/null if [ $? -eq 0 ] ; then PIRC=0 echo "$I78 '$1'" >> $INST_LOG else PIRC=$RC_PREREQ_NOT_INST echo "$I82 '$1'" >> $INST_LOG fi echo $PIRC } # c004 # Check SAM package installed version is >= $1 # $1 prereq-version, e.g. "2.2.0.0" # Returns RC: # Rules: # - If sam package is not installed, ignore check and return RC=0 # - If sam package installed version >= $1-prereq-version, then return RC=0 # - If sam package installed version < $1-prereq-version, # AND no full license is supplied, then return RC_PREREQ_VERSION. # checkSAMPkg () { PIRC=$RC_PREREQ_UNABLE SAMNAME="" case "$OS" in AIX) SAMNAME=sam.core.rte ;; Linux|SunOS) SAMNAME=sam ;; esac # get installed version INSTVERSION=`extractInstVersion $SAMNAME` if [ $? -eq 0 ] && [ -n "$INSTVERSION" ] ; then # compare min-prereq-version with installed version # return RC_PREREQ_VERSION if version of $1(min-prereq-version) > $INSTVERSION # and no full license is supplied (Error). # return 0 if version of $1(min-prereq-version) <= $INSTVERSION (OK) # return RC_PREREQ_UNABLE if versions could not be compared (Error). PIRC=`compVersion $1 $INSTVERSION` if [ $PIRC -eq 0 ] ; then # OK echo "$I103 $INSTVERSION" >> $INST_LOG elif [ $PIRC -eq $RC_PREREQ_VERSION ] ; then # if a license is supplied in PKG then it does # not matter if installed version is too low. # Check LUM license supplied in package: LUM_FILE=`ls ${DIR}/license/*.lic 2>/dev/null` if [ -r "$LUM_FILE" ] ; then # LUM file supplied. See if try&bye license TB_LIC_PKG=`cat $LUM_FILE | $GREP -Ec "TryAndBuy\=Yes"` if [ $TB_LIC_PKG -eq 0 ] ; then # not a try&buy license - but full license # therefore allow lower installed version PIRC=0 echo "$I103 $INSTVERSION" >> $INST_LOG else # Cannot overwrite permanent with try&buy license echo "$I110 $INSTVERSION" >> $INST_LOG fi else # Current version is too low for upgrade with service package echo "$I111" >> $INST_LOG # Show Minimum installed version for upgrade with service package: echo "$I107 $1" >> $INST_LOG # Show Currently installed version: echo "$I108 $INSTVERSION" >> $INST_LOG fi else echo "$I67 $INSTVERSION ? $1" >> $INST_LOG fi else # sam is not installed yet PIRC=0 fi echo $PIRC } # Check if any help option is in options # $1 options # # Rules: # - If any help like option is detected, display usage and exit. # checkHelp () { IS_HELP=`echo $1 | $GREP -Ec "\-h|\-help|\-\-help|\-\?|\?"` if [ $IS_HELP -ne 0 ] ; then echo "$USAGE1" echo "$USAGE2" exit 1 fi } ############################## Begin installation processing ################################### INST_LOG='' GREP=grep case "$OS" in AIX) PLATFORM=$OS ;; Linux) PLATFORM=`arch` # platform of target Linux machine ;; SunOS) PLATFORM=`mach` # platform of target SunOS machine GREP=/usr/xpg4/bin/grep ;; *) logit "$ENMSG_NOARCH" instexit $RC_PREREQ_UNABLE "NONLS" ;; esac # filter options if [ -n "$OPTIONS" ] ; then checkHelp "$OPTIONS" # -l option #OPT_LOG_FILE=`echo $OPTIONS | $GREP "\-l" | sed s/".*\-l "// | sed s/" --.*"//` Fix false -d detection OPT_LOG_FILE=`echo " $OPTIONS" | $GREP " \-l " | sed s/".* \-l "// | sed s/" -.*"//` # --silent OPT_SILENT=`echo $OPTIONS | $GREP -c "\-\-silent"` # --noliccheck OPT_NOLICCHECK=`echo $OPTIONS | $GREP -c "\-\-noliccheck"` # internal --noaixrsct OPT_NOAIXRSCT=`echo $OPTIONS | grep -c "\-\-noaixrsct"` fi # create new prereq log unless a logfile is passed if [ -n "$OPT_LOG_FILE" ] ; then INST_LOG=$OPT_LOG_FILE else INST_LOG=`makeLog $PN` echo "$ENMSG_LOG_STARTED $DATE" > $INST_LOG fi touch $INST_LOG >/dev/null if [ $? -ne 0 ] ; then if [ $OPT_SILENT -eq 0 ] ; then echo "$ENMSG_NO_LOGDIR $INST_LOG" fi instexit $RC_PREREQ_UNABLE "NONE" fi if [ -z "$OPT_LOG_FILE" ] ; then echo "$ENMSG_LOG_STARTED $DATE" > $INST_LOG fi # set other options if [ -n "$OPTIONS" ] ; then # -d option OPT_DIR=`echo " $OPTIONS" | $GREP " \-d " | sed s/".* \-d "// | sed s/" -.*"//` if [ -n "$OPT_DIR" ] ; then if [ ! -d "$OPT_DIR" ] ; then logit "$ENMSG_NO_DIR $OPT_DIR" instexit $RC_PREREQ_UNABLE "NONLS" fi fi fi echo "$SCRIPT OPTIONS = '$OPTIONS'" >> $INST_LOG echo "$SCRIPT OPT_SILENT = $OPT_SILENT" >> $INST_LOG echo "$SCRIPT OPT_NOLICCHECK = $OPT_NOLICCHECK" >> $INST_LOG # map machine architecture to package architecture # e.g. i686 -> i386 PKGARCH='' COUNT=`echo $PLATFORM | $GREP -Ec "^i[3-6]86$"` if [ $COUNT -eq 1 ] ; then ARCH=i386 PKGARCH=i386 fi COUNT=`echo $PLATFORM | $GREP -Ec "^x86_64$"` if [ $COUNT -eq 1 ] ; then ARCH=i386x PKGARCH=i386 fi COUNT=`echo $PLATFORM | $GREP -Ec "^ia64"` if [ $COUNT -eq 1 ] ; then ARCH=i386x PKGARCH=i386 fi COUNT=`echo $PLATFORM | $GREP -Ec "^s390$"` if [ $COUNT -eq 1 ] ; then ARCH=s390 PKGARCH=s390 fi COUNT=`echo $PLATFORM | $GREP -Ec "^s390x$"` if [ $COUNT -eq 1 ] ; then ARCH=s390x PKGARCH=s390 fi COUNT=`echo $PLATFORM | $GREP -Ec "^ppc"` if [ $COUNT -eq 1 ] ; then ARCH=ppc PKGARCH=ppc fi COUNT=`echo $PLATFORM | $GREP -Ec "^AIX"` if [ $COUNT -eq 1 ] ; then ARCH=ppc PKGARCH=AIX fi COUNT=`echo $PLATFORM | $GREP -Ec "^sparc"` if [ $COUNT -eq 1 ] ; then ARCH=sparc PKGARCH=sparc fi # Check Architecture if [ -z "$ARCH" ] ; then logit "$ENMSG_NOARCH" instexit $RC_PREREQ_UNABLE "NONLS" fi if [ -n "$OPT_DIR" ] ; then if [ -d "${OPT_DIR}/$PKGARCH" ] ; then DIR=$OPT_DIR else logit "$ENMSG_NO_PKGDIR $OPT_DIR" instexit $RC_PREREQ_UNABLE "NONLS" fi fi PKGDIR=${DIR}/$PKGARCH #==================================================== # determine National Language # extract from LANG, LC_ALL, or LC_CTYPE NLS_LANG=`locale | $GREP "LANG=" | sed s/LANG=// | sed 's/\"//g'` 2>/dev/null if [ -z "$NLS_LANG" ] ; then NLS_LANG=`locale | $GREP "LC_ALL=" | sed s/LC_ALL=// | sed 's/\"//g'` 2>/dev/null if [ -z "$NLS_LANG" ] ; then NLS_LANG=`locale | $GREP "LC_CTYPE=" | sed s/LC_CTYPE=// | sed 's/\"//g'` 2>/dev/null if [ -z "$NLS_LANG" ] ; then logit "$ENMSG_NOLANG" NLS_LANG=en_US fi fi fi if [ "$NLS_LANG" = "POSIX" ] || [ "$NLS_LANG" = "C" ] ; then NLS_LANG=en_US fi MSG_DIR= case "$OS" in AIX|Linux|SunOS) MSG_DIR="${DIR}/${OS}/msg" ;; esac NLS_FILE="$MSG_DIR/$MSG_NAME.$NLS_LANG.msg" #echo "try to find: "$NLS_FILE if [ ! -r "$NLS_FILE" ] ; then # try to map to similar language mapLanguage $NLS_LANG NLS_FILE="$MSG_DIR/$MSG_NAME.$NLS_LANG.msg" if [ ! -r "$NLS_FILE" ] ; then # fall back to English logit "$ENMSG_NONLS $NLS_LANG" logit "" logit "$ENMSG_LANGINST" logit "" if [ $OPT_SILENT -eq 0 ] ; then read RES if [ "$RES" = "y" ] || [ "$RES" = "Y" ] ; then logit "$ENMSG_NOT_PERFORMED" instexit $RC_PREREQ_UNABLE "NONLS" fi fi logit "$ENMSG_CONTEN" NLS_FILE="$MSG_DIR/$MSG_NAME.en_US.msg" if [ ! -r "$NLS_FILE" ] ; then logit "$ENMSG_NOT_PERFORMED" logit "$ENMSG_NODEFLANG" instexit $RC_PREREQ_UNABLE "NONLS" fi fi fi # test #cat $NLS_FILE # test # list of messages (from installSAM.*.msg) # I34=Warning: Module 'softdog' could not be loaded... (added 04/06/23) # Get all NLS texts acc. to $NLS_FILE # get ASCII texts from keys #I36=Found 32-bit Java at version: #I37=To run the end-to-end automation management adapter, you must install 32-bit Java at this or higher version: #I60=All prerequisites for the ITSAMP installation are met on operating system: #I61=Error: Prerequisite checking for the ITSAMP installation failed: #I62=Most severe error code returned: #I63=Explanation of all error codes: #I64=One or more prerequisite packages have an incorrect version. #I65=One or more prerequisite packages were not found installed. #I66=The operating system has a version that is not supported. #I67=Unable to perform prerequisite checking. #I68=For details, refer to the 'Error:' entries in the log file: #I69=Using default prerequisite checking on the following AIX package: #I70=AIX package and version required: #I71=AIX package and version installed: #I72=Error: The following AIX package is installed at a too low version: #I73=The following AIX package is installed at required version or higher version: #I74=Error: Unable to check the version of the following AIX package: #I75=Error: The following AIX package is not installed: #I76=Using default prerequisite checking on the following rpm package: #I77=rpm package required: #I78=rpm package and version installed: #I79=Error: The rpm package is installed, but the following part was not found: #I80=Error: Could not list parts for the following rpm package: #I81=Error: The following rpm package is installed at a different level than required: #I82=Error: The following rpm package is not installed: #I83=Detected operating system: #I84=Detected architecture: #I85=Error: Unable to detect which Linux distribution is installed. #I86=Error: Prerequisite checking is not supported for operating system: #I87=Detected distribution: #I88=Supported operating system versions: #I89=Error: Failed to locate the list of supported operating system versions on the following operating system: #I90=Detected operating system version: #I91=Error: Could not detect the operating system version for the following operating system: #I92=Required minimum operating system version: #I93=Error: None of the supported operating system versions matched the version detected for the operating system: #I94=Warning: Module 'softdog' could not be found. It is required to automate critical resources, like IP or file systems. #I95=Error: Distribution is not supported: # new with 2202: #I102=Error: Installed package sam has a too low version for upgrade: obsolete 3.1 #I103=Installed package sam has the correct version for upgrade: # new sam2203 #I105=Error: Unable to install package 'sam' because the following directories have no write access. #I106=Error: Unable to install package 'sam' because the following directories in an AIX WPAR have no write access. # new sam3100 #I107=Error: Currently installed license is not valid for upgrade with service package, minimum required installed version is #I108=Currently installed version: #I109=Version of package to be installed: #I110=Error: Cannot overwrite permanent license with try-and-buy license. #I111=Error: Installed version is too low for upgrade with service package. #I112=Error: Unable to detect which Solaris distribution is installed. #I117=The new RSCT version for AIX to be upgraded is: #I123=Error: The following SUN package is not installed: #I124=SUN package is installed: #I125=Detected supported zone on SunOS. Zone name: #I126=Error: On SunOS only global zone is supported. Detected zone: I36=`getASCII "I36" 1`' ' I37=`getASCII "I37" 1`' ' I60=`getASCII "I60" 1`' ' I61=`getASCII "I61" 1`' ' I62=`getASCII "I62" 1`' ' I63=`getASCII "I63" 1`' ' I64=`getASCII "I64" 1`' ' I65=`getASCII "I65" 1`' ' I66=`getASCII "I66" 1`' ' I67=`getASCII "I67" 1`' ' I68=`getASCII "I68" 1`' ' I69=`getASCII "I69" 1`' ' I70=`getASCII "I70" 1`' ' I71=`getASCII "I71" 1`' ' I72=`getASCII "I72" 1`' ' I73=`getASCII "I73" 1`' ' I74=`getASCII "I74" 1`' ' I75=`getASCII "I75" 1`' ' I76=`getASCII "I76" 1`' ' I77=`getASCII "I77" 1`' ' I78=`getASCII "I78" 1`' ' I79=`getASCII "I79" 1`' ' I80=`getASCII "I80" 1`' ' I81=`getASCII "I81" 1`' ' I82=`getASCII "I82" 1`' ' I83=`getASCII "I83" 1`' ' I84=`getASCII "I84" 1`' ' I85=`getASCII "I85" 1`' ' I86=`getASCII "I86" 1`' ' I87=`getASCII "I87" 1`' ' I88=`getASCII "I88" 1`' ' I89=`getASCII "I89" 1`' ' I90=`getASCII "I90" 1`' ' I91=`getASCII "I91" 1`' ' I92=`getASCII "I92" 1`' ' I93=`getASCII "I93" 1`' ' I94=`getASCII "I94" 1`' ' I95=`getASCII "I95" 1`' ' #I102=`getASCII "I102" 1`' ' obsolete 3.1 I103=`getASCII "I103" 1`' ' I105=`getASCII "I105" 1`' ' I106=`getASCII "I106" 1`' ' I107=`getASCII "I107" 1`' ' # 3.1 I108=`getASCII "I108" 1`' ' I109=`getASCII "I109" 1`' ' I110=`getASCII "I110" 1`' ' I111=`getASCII "I111" 1`' ' I112=`getASCII "I112" 1`' ' # 3.1 Solaris I117=`getASCII "I117" 1`' ' # 3.1 rsct for AIX I123=`getASCII "I123" 1`' ' # 3.1 Solaris I124=`getASCII "I124" 1`' ' # 3.1 Solaris I125=`getASCII "I125" 1`' ' # 3.1 Solaris zone detection I126=`getASCII "I126" 1`' ' # 3.1 Solaris zone detection RC=0 #====================================================== echo "$I83 $OS" >> $INST_LOG echo "$I84 $ARCH" >> $INST_LOG # Determine distro and version DISTRO= IS_VERSION= case "$OS" in AIX) DISTRO=IBM IS_VERSION=`oslevel -r` getRSCTVersionFromOSVersion $IS_VERSION ;; Linux) IS_VERSION=`cat /etc/redhat-release 2>/dev/null` if [ -n "$IS_VERSION" ] ; then COUNT=`echo $IS_VERSION | $GREP -Ec "Red Hat Enterprise.*S"` if [ $COUNT -eq 1 ] ; then DISTRO=RH else logit "$I95" instexit $RC_PREREQ_UNABLE fi else IS_VERSION=`cat /etc/SuSE-release 2>/dev/null` if [ -n "$IS_VERSION" ] ; then COUNT=`echo $IS_VERSION | $GREP -Ec "SLES|SuSE.*Enterprise Server|SUSE.*Enterprise Server"` if [ $COUNT -eq 1 ] ; then DISTRO=SUSE else logit "$I95" instexit $RC_PREREQ_UNABLE fi else logit "$I85" instexit $RC_PREREQ_UNABLE fi fi ;; SunOS) IS_VERSION=`cat /etc/release 2>/dev/null` if [ -n "$IS_VERSION" ] ; then COUNT=`echo $IS_VERSION | $GREP -Ec "Solaris"` if [ $COUNT -eq 1 ] ; then DISTRO=SUN else logit "$I95" instexit $RC_PREREQ_UNABLE fi else logit "$I112" instexit $RC_PREREQ_UNABLE fi ;; *) logit "$I86 $OS" instexit $RC_PREREQ_UNABLE ;; esac echo "$I87 $DISTRO" >> $INST_LOG #======================================================= # Assemble required ${OS}_${ARCH}_${DISTRO}_VERSIONS keyword # and assign its value list to REQ_VERSIONS #REQ_VERSIONS=$(eval "echo \$${OS}_${ARCH}_${DISTRO}_VERSIONS") REQ_VERSIONS=`eval echo \`eval "echo \$\{${OS}_${ARCH}_${DISTRO}_VERSIONS\}"\`` if [ -z "$REQ_VERSIONS" ] ; then logit "$I89 ${DISTRO} ${OS} ${ARCH}" instexit $RC_PREREQ_UNABLE else echo "$I88 ${DISTRO} ${OS} ${ARCH} - $REQ_VERSIONS" >> $INST_LOG fi if [ -z "$IS_VERSION" ] ; then logit "$I91 ${DISTRO} ${OS} ${ARCH}" instexit $RC_PREREQ_UNABLE else case "$OS" in AIX) echo "$I90 $IS_VERSION" >> $INST_LOG ;; Linux|SunOS) echo "$I90" >> $INST_LOG echo "$IS_VERSION" >> $INST_LOG ;; esac fi # Do additional OS checks case "$OS" in AIX) # Check if rsct.basic.rte package is installed RSCT_BASIC_VSN=`lslpp -l rsct.basic.rte 2>/dev/null | $GREP -E rsct.basic.rte | head -1` # if [ -n "$RSCT_BASIC_VSN" ] ; then # RSCT_BASIC_VSN=`echo $RSCT_BASIC_VSN | sed 's/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/#&#/g' | cut -s -d "#" -f2` if [ -z "$RSCT_BASIC_VSN" ] ; then # rsct.basic.rte package is not intalled # Check for installed RSCT version, if it is higher than our packaged version: exit RSCT_CTVERSION=`/usr/sbin/rsct/install/bin/ctversion | cut -d " " -f2` #RSCT_BASIC_PKG=`ls -r ${PKGDIR}${AIX_SAMCORE_DIR}/rsct/ptf/*.rsct.basic.rte.bff | cut -d ' ' -f1 | head -1` #RSCT_BASIC_PKG_VSN=`strings $1 | $GREP -E "$2 [0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}" | cut -d ' ' -f2 | head -1` RSCT_CTVERSIONa=`echo $RSCT_CTVERSION | tr -d .` RSCT_VSNa=`echo $RSCT_VSN | tr -d .` if [ $RSCT_CTVERSIONa -gt $RSCT_VSNa ] ; then logit "Error: Package rsct.basic cannot be installed on AIX because the installed version of other RSCT packages is higher: $RSCT_CTVERSION" instexit $RC_PREREQ_UNABLE; fi fi ;; SunOS) # Check for globalzone in SunOS ZONENAME=`/sbin/zonename` if [ "$ZONENAME" != "global" ] ; then # stop install, because installSAM is not allowed in a local zone logit "$I126 $ZONENAME" instexit $RC_PREREQ_UNABLE; else logit "$I125 $ZONENAME" fi ;; esac VERSION_OK=0 case "$OS" in AIX) case "$ARCH" in ppc) case "$DISTRO" in IBM) VERSION_OK=`checkVersionAIX "$REQ_VERSIONS" "$IS_VERSION"` RC=`checkAIXPrereqs $VERSION_OK` ;; esac ;; esac ;; Linux) case "$ARCH" in i386) case "$DISTRO" in RH) VERSION_OK=`checkVersionaaaRH "$REQ_VERSIONS" "$IS_VERSION"` RC=`checkLinuxPrereqs $VERSION_OK` ;; SUSE) VERSION_OK=`checkVersionaaaSUSE "$REQ_VERSIONS" "$IS_VERSION"` RC=`checkLinuxPrereqs $VERSION_OK` ;; esac ;; i386x) case "$DISTRO" in RH) VERSION_OK=`checkVersionaaaRH "$REQ_VERSIONS" "$IS_VERSION"` RC=`checkLinuxPrereqs $VERSION_OK` ;; SUSE) VERSION_OK=`checkVersionaaaSUSE "$REQ_VERSIONS" "$IS_VERSION"` RC=`checkLinuxPrereqs $VERSION_OK` ;; esac ;; ppc) case "$DISTRO" in RH) VERSION_OK=`checkVersionaaaRH "$REQ_VERSIONS" "$IS_VERSION"` RC=`checkLinuxPrereqs $VERSION_OK` ;; SUSE) VERSION_OK=`checkVersionaaaSUSE "$REQ_VERSIONS" "$IS_VERSION"` RC=`checkLinuxPrereqs $VERSION_OK` ;; esac ;; s390) case "$DISTRO" in RH) VERSION_OK=`checkVersionaaaRH "$REQ_VERSIONS" "$IS_VERSION"` RC=`checkLinuxPrereqs $VERSION_OK` ;; SUSE) VERSION_OK=`checkVersionaaaSUSE "$REQ_VERSIONS" "$IS_VERSION"` RC=`checkLinuxPrereqs $VERSION_OK` ;; esac ;; s390x) case "$DISTRO" in RH) VERSION_OK=`checkVersionaaaRH "$REQ_VERSIONS" "$IS_VERSION"` RC=`checkLinuxPrereqs $VERSION_OK` ;; SUSE) VERSION_OK=`checkVersionaaaSUSE "$REQ_VERSIONS" "$IS_VERSION"` RC=`checkLinuxPrereqs $VERSION_OK` ;; esac ;; esac ;; SunOS) case "$ARCH" in sparc) case "$DISTRO" in SUN) VERSION_OK=`checkVersionSUN "$REQ_VERSIONS" "$IS_VERSION"` RC=`checkSUNPrereqs $VERSION_OK` ;; esac ;; esac ;; esac if [ -z "$VERSION_OK" ] ; then # OS version is not OK - show required vs installed version logit "$I93 ${DISTRO} ${OS} ${ARCH}" logit "$I88 ${DISTRO} ${OS} ${ARCH} - $REQ_VERSIONS" case "$OS" in AIX) logit "$I90 $IS_VERSION" ;; Linux|SunOS) logit "$I90" logit "$IS_VERSION" ;; esac fi if [ $OPT_NOLICCHECK -eq 0 ] ; then # Check sam package version in case of upgrade SRC=`checkSAMPkg $REQ_SAM_UPGRADE_VERSION` # pick worst rc if [ $RC -lt $SRC ] ; then RC=$SRC fi fi # if Linux check if softdog module is installed if [ "$OS" = "Linux" ] ; then modprobe --show softdog 2>/dev/null MRC=$? # logit "modprobe RC=$RC" if [ $MRC -ne 0 ] ; then # softdog module cannot be found logit "$I94" fi fi instexit $RC