#!/bin/sh
#set -x

PATH=/bin:/usr/bin:/usr/sbin:$PATH
CLUS_IMPORT_LOG=/tmp/omni_clus_import.log

#
# For debugging, uncomment this
########################################
#exec 2>/tmp/UTIL_`hostname`_$$_OB2DEBUG
#set -x


init_var()
{
  UNAME=`uname -a`
  ARCH=`echo ${UNAME} | awk '{print $1}'`
  umask 022

  if [ -f /lib/libhpnas.so ]
  then
      UNAME=`echo hpnas-${UNAME}`
      ARCH=`echo hpnas-${ARCH}`
  fi

  case "${ARCH}" in
    OSF1)
      MACHINE=`echo ${UNAME} | awk '{print $5}'`
      OS_REV=`echo  ${UNAME} | awk '{print $3}'`
      case "$OS_REV" in
        V5*)
          SERIES=dec/alpha/osf1-5
          ;;
        *)
          SERIES=dec/alpha/osf1-4
          ;;
      esac
      STRING="dec alpha osf1-${OS_REV}"
      ;;
    HP-UX)
      MACHINE=`echo ${UNAME} | awk '{print $5}'`
      OS_REV=`echo  ${UNAME} | awk '{print $3}'`
      ;;
    SunOS)
      MACHINE=`echo ${UNAME} | awk '{print $5}'`
      OS_REV=`echo  ${UNAME} | awk '{print $3}'`
      PATH=$PATH:/usr/ucb:/usr/etc:/usr/sbin
      ;;
    AIX)
      MACHINE=aix
      OS_REV=`echo ${UNAME} | awk '{printf "%s.%s", $4, $3}'`
      case $OS_REV in
        4*)
          SERIES=ibm/rs6000/aix-43
          ;;
        5*|6*|7*)
          SERIES=ibm/rs6000/aix-51
          ;;
      esac
      STRING="ibm rs6000 aix-${OS_REV}"
      ;;
    Darwin)
      MACHINE=`uname -m`
      MACOS_REV=`sw_vers -productVersion`

      case $MACHINE in
        i[3456]86*)
               SERIES="apple/i386/macos-10.4"
               STRING="apple `uname -p` macos-${MACOS_REV}" 
             ;;
        Power*)
               SERIES="apple/ppc/macos-10.4"
               STRING="apple `uname -p` macos-${MACOS_REV}" 
            ;;
        *x86_64*)
               SERIES="apple/i386/macos-10.4"
               STRING="apple `uname -p` macos-${MACOS_REV}"
            ;;    
      esac
     ;; 
    Linux)
      MACHINE=Linux
      OS_REV=`echo ${UNAME} | awk '{print $3}'` 
      HARDWARE=`uname -m`	  
      case $HARDWARE in
       s390x)
         SERIES="ibm/s390x/zlinux-s390x"
         STRING="ibm `uname -m` linux-${OS_REV}"
       ;;
       *)
         SERIES=gpl/i386/linux
         STRING="gpl `uname -m` linux-${OS_REV}"
       ;;
       esac
      
    ;;
    hpnas-Linux)
      MACHINE=hpnas-Linux
      OS_REV=`echo ${UNAME} | awk '{print $3}'`
      SERIES=gpl/i386/hpnas-linux
      STRING="gpl i386 hpnas-linux-${OS_REV}"
      ;;
    IRIX|IRIX6*)
      MACHINE=irix
      OS_REV=`echo ${UNAME} | awk '{print $3}'`
      SERIES=sgi/mips/irix
      STRING="sgi mips irix-${OS_REV}"
      PATH=$PATH:/usr/bsd:/usr/sbin
      ;;
    ULTRIX)
      MACHINE=`echo ${UNAME} | awk '{print $5}'`
      OS_REV=`echo ${UNAME} | awk '{print $3}'`
      SERIES=dec/risc/ultrix
      STRING="dec risc ultrix-${OS_REV}"
      ;;
    SINIX*|Reliant*)
      MACHINE=`echo ${UNAME} | awk '{print $5}'`
      OS_REV=`echo ${UNAME} | awk '{print $3}'`
          SERIES=siemens/r400/sinix
          STRING="siemens r400 sinix-${OS_REV}"
      PATH=$PATH:/usr/ucb:/usr/sbin
      ;;
        DYNIX/ptx)
      MACHINE=`echo ${UNAME} | awk '{print $5}'`
      OS_REV=`echo ${UNAME} | awk '{print $4}'`
      SERIES=sequent/i386/DYNIX
      STRING="sequent i386 DYNIX-${OS_REV}"
      ;;
        SCO_SV)
      MACHINE=`echo ${UNAME} | awk '{print $5}'`
      OS_REV=`echo ${UNAME} | awk '{print $4}'`
      SERIES=sco/i386/sco_sv
      STRING="sco i386 sco_sv-${OS_REV}"
      ;;
    UnixWare)
      MACHINE=`echo ${UNAME} | awk '{print $5}'`
      OS_REV=`echo ${UNAME} | awk '{print $4}'`
      SERIES=sco/i386/unixware
      STRING="sco i386 unixware-${OS_REV}"
      ;;
        UNIX_SV)
      MACHINE=`echo ${UNAME} | awk '{print $5}'`
      OS_REV=`echo ${UNAME} | awk '{print $4}'`
      SERIES="ncr/i386/mp-ras"
      STRING="NCR Pentium UNIX-SVR4-${OS_REV}"
      PATH=$PATH:/usr/ucb
      ;;
        MPE/iX)
      MACHINE=`echo ${UNAME} | awk '{print $6}'`
      OS_REV=`echo ${UNAME} | awk '{printf "%s-%s",$3,$4}'`
      SERIES=`echo ${UNAME} | awk '{print $6}'`
      SERIES="hp/hp3000/mpeix"
      STRING="MPE/iX ${OS_REV}"
      ;;
    OS/390)
#	  MACHINE=`echo $(UNAME) | awk '{print $5}'`
	  OS_REV=`echo ${UNAME} | awk '{print $3}'`
	  SERIES="ibm/os390/zos-2-1"
	  STRING="Z/OS V2R1"
	  ;;
	  
    *)
      return 1
      ;;
  esac

  case "${MACHINE}" in
    *9000/[34]*)
        SERIES=hp/s400/hp-ux
        ADD=`echo ${OS_REV} | sed 's/^..0*//'`
        STRING="hp s300 hp-ux-${ADD}"
        ;;
    *9000/7*)
        ADD=`echo ${OS_REV} | sed 's/^..0*//'`
        STRING="hp s700 hp-ux-${ADD}"
        case "${OS_REV}" in
          *\.11\.*) SERIES="hp/s800/hp-ux-11"
                    ;;
          *\.10\.*) SERIES="hp/s800/hp-ux-10"
                    ;;
          *)        SERIES="hp/s800/hp-ux"
                    ;;
        esac
        ;;
    *9000/8*)
        ADD=`echo ${OS_REV} | sed 's/^..0*//'`
        STRING="hp s800 hp-ux-${ADD}"
        case "${OS_REV}" in
          *\.11\.*) SERIES="hp/s800/hp-ux-11"
                    ;;
          *\.10\.*) SERIES="hp/s800/hp-ux-10"
                    ;;
          *)        SERIES="hp/s800/hp-ux"
                    ;;
        esac
        ;;
    *ia64*)
        ADD=`echo ${OS_REV} | sed 's/^..0*//'`
        STRING="hp s800 hp-ux-${ADD}"
        case "${OS_REV}" in
          B.11.22 | B.11.23 | B.11.31 ) STRING="hp ia64 hp-ux-${ADD}"
                 SERIES="hp/sia64/hp-ux-11"
                 ;;
          *\.11\.*) SERIES="hp/s800/hp-ux-11"
                    ;;
          *)        SERIES="hp/s800/hp-ux"
                    ;;
        esac
        ;;
     i86pc)
        SERIES="sun/i86pc/solaris"
        STRING="sun i86pc solaris-${OS_REV}"
        ;;
     sun4*)
        case "${OS_REV}" in
          5.7 | 5.8) SERIES="sun/sparc/solaris-7"
                   STRING="sun sparc solaris-${OS_REV}"
                   ;;
          5.*)     SERIES="sun/sparc/solaris-26"
                   STRING="sun sparc solaris-${OS_REV}"
                   ;;
          4.*)     SERIES="sun/sparc/sunos"
                   STRING="sun sparc sunos-${OS_REV}"
                   ;;
        esac
        ;;
  esac

  case "${SERIES}" in
    hp/s800/hp-ux-10|hp/s800/hp-ux-11|hp/sia64/hp-ux-11)
        OMNIHOME=/opt/omni
        OMNICONFIG=/etc/${OMNIHOME}/server
        OMNICONFIGCLIENT=/etc/${OMNIHOME}/client
        OMNIINFO=${OMNICONFIGCLIENT}/omni_info
        OMNILBIN=/opt/omni/lbin
                DFS_MNTTAB=${OMNICONFIG}/omni_dfstab
                DCEBIN=/opt/dce/bin
                DCESERVER=`hostname | tr "[A-Z]" "[a-z]"`
                DCEPRINCIPAL=root
        ;;

    ncr/i386/mp-ras | sun/sparc/solaris* | gpl/*/linux* | sun/i86pc/solaris*|*s390x*)
        OMNIHOME=/opt/omni
        OMNICONFIG=/etc/${OMNIHOME}/server
        OMNICONFIGCLIENT=/etc/${OMNIHOME}/client
        OMNIINFO=${OMNICONFIGCLIENT}/omni_info
        OMNILBIN=/opt/omni/lbin
                ;;

    *)
        OMNIHOME=/usr/omni
        OMNICONFIG=${OMNIHOME}/config/server
        OMNICONFIGCLIENT=${OMNIHOME}/config/client
        OMNIINFO=${OMNICONFIGCLIENT}/omni_info
        OMNILBIN=/usr/omni/bin
        ;;
  esac

  CELL_SERVER=${OMNICONFIGCLIENT}/cell_server
  USERLIST=${OMNICONFIG}/users/UserList
  TMP=/tmp/inst.tmp.`date +%d%M%y%H%m%S`$$
  SERVICE=omni
}

NumberOfSapSet ()
{
        case $OS_REV in
        ?.10.??|?.11.??) FILENAME="/var/opt/omni/tmp/BAL_$1_0:*"        ;;
                  *) FILENAME="/usr/omni/tmp/BAL_$1_0:*"        ;;
        esac

        SETNUMBER=`ls ${FILENAME} |wc -l 2>/dev/null`
}

getUser ()
{
  if [ -f ${USERLIST} ]
  then
     OPC_EXIST=`cat ${USERLIST} | grep opc_op`
     case $OPC_EXIST in
         "") echo " " 2>/dev/null;;
          *) echo opc_op 2>/dev/null;;
     esac
  fi
}
getOs ()
{
   case $OS_REV in
     ?.10.??|?.11.??) echo 10 2>/dev/null;;
           *) echo 00 2>/dev/null;;
   esac
}

addUser ()
{
   echo '"OpC default Operator" opc_op * * admin' >> ${USERLIST}
}
getCell ()
{
    if [ -f "${CELL_SERVER}" ]; then
        case ${SERIES} in
         *)
            awk  '{print $1;exit}' ${CELL_SERVER}|  tr "[A-Z]" "[a-z]" 2>/dev/null
         ;;
        esac 
    fi
}

getDfsFilesets ()
{
        [ ! -s ${DFS_MNTTAB} ] && return
        [ ! -x ${DCEBIN}/fts ] && return
#
#       Get local fileset list using DCE/DFS command fts lsheader
#       Get fileset info from user-supplied file $DFS_MNTTAB
#       Filter out local filesets only
#
        $OMNILBIN/ob2dcecmd "$DCEBIN/fts lsheader -server $DCESERVER" $DCEPRINCIPAL 2>/dev/null |\
        awk '
                BEGIN { while (getline < "'"$DFS_MNTTAB"'" > 0 )
                                        filesets[$1]=$2 }
                !/^Total|^$/ { if ( filesets[$1] )
                                        print $1, filesets[$1] }' | \
#
#       Check if specified mountpoints valid
#
        while read FSET MNT
        do
                $OMNILBIN/ob2dcecmd "$DCEBIN/fts lsmount $MNT" $DCEPRINCIPAL 2>/dev/null >/dev/null
                if [ $? -eq 0 ] ; then
                        echo $MNT
                fi
        done
}


getBdf()
{
  case ${SERIES} in
    ibm/rs6000/aix*)
        #mount 2>/dev/null | sed -e 's/^ /.local/' | awk '$4 !~ /nfs/ { printf("%s\n", $3) }' | tail -n +3

       rm -f /tmp/OMNI_RESULT

       # Get all file systems with vfs attribute set to autofs and namefs

       mount 2>/dev/null | \
       sed -e 's/^ /.local/' | \
       awk '{ if (($4 ~ "autofs") || ($4 ~ "namefs")) print $3}' \
       > /tmp/OMNI_AUTOFS.TMP

       # Get all file systems except those with vfs attribute set to:
       # nfs, autofs, procfs and namefs

       mount 2>/dev/null | \
       sed -e 's/^ /.local/' | \
       tail -n +3 | \
       awk '{
        if (($4 !~ "nfs") && ($4 !~ "autofs") && ($4 !~ "procfs") && ($4 !~ "namefs"))
           print $3
            }' \
       > /tmp/OMNI_FS.TMP

       cat /tmp/OMNI_FS.TMP | \
       while read line
       do
         cat /tmp/OMNI_AUTOFS.TMP | \
         awk -v string=$line 'BEGIN {found = 0}
                              {
                                 if ($0 == string)
                                    found = 1
                              }
                              END {
                                     if (found == 0)
                                        print string
                                  }' >> /tmp/OMNI_RESULT
       done

       cat /tmp/OMNI_RESULT

       rm -f /tmp/OMNI_AUTOFS.TMP
       rm -f /tmp/OMNI_FS.TMP
       ;;
    hp/s[48]00/hp-ux)
           /etc/mount -l -p 2>/dev/null | awk '$3 ~ /^hfs|^vbfs/ {printf("%s\n", $2)}'
       ;;
    hp/s800/hp-ux-10|hp/s800/hp-ux-11|hp/sia64/hp-ux-11)
       /sbin/mount  -l -p 2>/dev/null | awk '$3 ~ /^vxfs$|^hfs|^lofs$|^hsmfs$/ {printf("%s\n", $2)}'
       getDfsFilesets
       ;;
    gpl/i386/linux)
       configuration=/CONFIGURATION
       base=`/bin/df -P -t psfs -t ext2 -t SFS -t ext -t minix -t xiafs -t vmfs -t reiserfs -t ext3 -t vfat -t vxfs -t xfs -t hsmfs -t gfs -t lustre_lite -t ocfs -t ocfs2 -t gfs2 -t ext4 -t gpfs -t ibrix -t acfs -t lustre -t ldiskfs 2>/dev/null | sed '1d'`
       btrfs=`/bin/df -P -t btrfs 2>/dev/null | sed '1d'`

        if [ "$OB2_SHOW_BTRFS_MOUNTS" == "1" ]
        then
            if ! [ -z "$base" ] && ! [ -z "$btrfs" ]
            then                
                command="$base\n$btrfs";
            elif ! [ -z "$base" ]
            then
                command="$base"
            elif ! [ -z "$btrfs" ]
            then
                command="$btrfs";
           fi
           else
               if ! [ -z "$base" ]
               then
                   command="$base";
               fi

               rootFsType=`/bin/df -P -T / 2>/dev/null | sed '1d' | awk -F ' ' '{print $2}'`
               if [ "$rootFsType" == "btrfs" ]
               then
                   echo "/";
               fi
           fi

       # Check if ADRM entry exists in omni_info file. If it exists, /CONFIGURATION mntpt should be listed
       adrm=`awk ' /autodr/ { print 1 }' ${OMNIINFO}`
       if [ -n "$adrm" ]
       then
         found=0;
         for mntpt in `echo -e "$command" | awk -F ' ' '{print $6}'`

         # if "/CONFIGURATION" mntpt exists on the system, don't list it;
         # this prevents a double listing of "/CONFIGURATION" mntpt
         do
            echo $mntpt;
            if [ "$mntpt" == "$configuration" ]
            then
               found=1;
            fi
         done
         if [ "$found" == "0" ]
            then
            echo "$configuration";
         fi
       else
           if ! [ -z "$command" ]
           then 
               echo -e "$command" | awk '{ tmp=""; for(i=6;i<=NF;i++){if ( i==6 ) tmp = $i; else tmp=tmp " " $i }print tmp }'
           fi
       fi
       ;;
    
     ibm/s390x/*)
        command=`/bin/df -P -t ext2 -t ext3 -t ext4 -t xfs 2>/dev/null | sed '1d'`
         echo "$command" | awk '{ tmp=""; for(i=6;i<=NF;i++){if ( i==6 ) tmp = $i; else tmp=tmp " " $i }print tmp }'
       ;;
    apple/*)
       # Using sed instead of awk allows us to list and backup mountpoints with blanks 
       /bin/df -P -t hfs,ufs 2>/dev/null | sed '1d' | cut -d% -f2 |cut -d/ -f2-256 |sed 's/^\(.*\)/\/\1/'
       ;;
    gpl/i386/hpnas-linux)
        /usr/omni/bin/getVSList -user_volume_names
        ;;
    dec/alpha/osf1*)
       /bin/df -t ufs 2>/dev/null | awk '$6 ~ /\/.*/ {print $6}'
       /bin/df -t advfs 2>/dev/null | awk '$6 ~ /\/.*/ {print $6}'
       ;;
    dec/risc/ultrix)
       /etc/mount 2>/dev/null | awk '$5 ~ /ufs/ {printf("%s\n", $3)}'
       ;;
    sun/sparc/solaris | sun/i86pc/solaris  | sun/sparc/solaris-7 | sun/sparc/solaris-26)
       mount -p 2>/dev/null | awk '$4 ~ /ufs|tmpfs|vxfs|lofs|zfs/ { printf("%s\n", $3) }'
       ;;
    sun/sparc/sunos)
       mount -p 2>/dev/null | awk '$3 ~ /ufs|4.2/ { printf("%s\n", $2) }'
       ;;
    sgi/mips/irix)
       /bin/df -l 2>/dev/null | awk '$2 ~ /efs|xfs/ { printf("%s\n", $7)}'
       ;;
    siemens/r400/sinix)
       mount -p 2>/dev/null | awk '$4 ~ /ufs|vxfs/ { printf("%s\n", $3) }'
       ;;
    sequent/i386/DYNIX)
       /etc/mount -p 2>/dev/null | awk '$4 ~ /ufs|efs/ { printf("%s\n", $3) }'
       ;;
    sco/i386/sco_sv)
        for fs in `/etc/mount | awk '{print $3}'`
                do
                        /etc/fstyp $fs >/dev/null 2>&1 && /bin/df $fs | awk '{print $1}'
                done
                echo >/dev/null
        ;;
    sco/i386/unixware)
       mount -p 2>/dev/null | awk '$4 ~ /memfs|s5|sfs|ufs|bfs|vxfs/ { printf("%s\n", $3) }'
       ;;
        ncr/i386/mp-ras)
                /bin/df -l | awk '{print $1}'
                ;;
        hp/hp3000/mpeix)
                callci "dstat all" | awk -v num=1 'END {for (i=1; i<num; i++) printf "/%s\n",arr[i]} NR>2 {n=split($NF,a,"-");if ((n==2) && (a[n] ~ /[0-9]/)) for (i=1; i<num; i++) if (arr[i] == a[1]) next; arr[num++]=a[1]}'
                ;;
        ibm/os390/zos*)
           /usr/omni/bin/mntent 2>/dev/null
        ;;
  esac
}


excludeCell()
{
    # Cell server
    # ###########
    CHECKSERVER=$1

    if [ ! -r "${CELL_SERVER}" ]; then
        return 0
    fi

    # old cell server name in the cell_server
    # #######################################
    SERVER=`awk '{print $1}' ${CELL_SERVER} | tr "[A-Z]" "[a-z]" 2> /dev/null`

    case "${SERIES}" in
      hp/s*|sun/*|*/linux*)
        # on CM platforms, check local hostname
        # #####################################
        HOSTNAME=`hostname | tr "[A-Z]" "[a-z]"`
        NODE=`/opt/omni/lbin/utilns/hostlookup $HOSTNAME | tr "[A-Z]" "[a-z]"`
        if [ "${NODE}" = "${SERVER}" ]
        then
          # Cell Server cannot be excluded from its own cell
          # ################################################
          echo "Error: Cell Server cannot be excluded from its own cell"
          return 1
        fi
        ;;
      *)
        ;;
    esac

    CHECKSERVER=`echo ${CHECKSERVER} | tr "[A-Z]" "[a-z]"`

    if [ "${CHECKSERVER}" = "${SERVER}" ] || [ -z "${SERVER}" ]
    then

      case "${SERIES}" in
        hp/s[48]00/hp-ux)
          # check for HP-UX diskless client:
          # ################################
          CNODE=`getcontext | grep -c remoteroot 2>/dev/null`
          if [ ${CNODE} -eq 1 ]
          then
            # system equals cluster client, determine cluster server system
            # #############################################################
            CLUST_CLT=${NODE}
            CLUST_SV=`cnodes -rA`
            if [ `grep -v CELL_SERVER ${OMNIINFO} | grep -cv ${NODE}` -gt 0 ]
            then
                # CELL_SERVER won't be deleted from the file
                # user wanted to exclude diskless client, so change will be made
                # just on cell server
                return 0
            fi
          fi
          ;;
        *)
          ;;
      esac

      if [ -r "${OMNIINFO}" ]
      then
        awk  '{if ($1!="CELL_SERVER") {print}}' ${OMNIINFO}  > ${TMP}
        cp ${TMP} ${OMNIINFO}
        rm ${TMP}
      fi

      rm -f ${CELL_SERVER}
      rm -f ${OMNICONFIGCLIENT}/allow_hosts
      return 0 # Host excluded
    else
      echo "Error: Client system belongs to another cell"
      return 1 # Cannot exclude host that belongs to another cell
    fi
}

includeCell()
{
    case "${SERIES}" in
    *)
        NEWSERVER=$1
        CHECKSERVER=$1
    ;;
    esac

    if [ ! -r "${OMNIINFO}" ]
    then
#        echo "Error: ${OMNIINFO} file does not exist or is not readable."
        return 1
    fi


    # added bacause of preinstalled software
    # ######################################
    if [ "`grep HOSTNAME ${OMNIINFO} 2>/dev/null | wc -l`" -gt 0 ]; then
        case "${SERIES}" in
        hp/s[48]00/hp-ux)
          HOSTNAME=`hostname | tr "[A-Z]" "[a-z]"`
          HOST=`/opt/omni/lbin/utilns/hostlookup $HOSTNAME | tr "[A-Z]" "[a-z]"`
          cat ${OMNIINFO} | sed "s/HOSTNAME/${HOST}/" > ${TMP}
          mv ${TMP} ${OMNIINFO}
          ;;
        *)
          HOST=""
          ;;
        esac
    fi

    SERVER=`awk  '{print $1}' ${CELL_SERVER} | tr "[A-Z]" "[a-z]" 2> /dev/null`
    CHECKSERVER=`echo ${CHECKSERVER} | tr "[A-Z]" "[a-z]"`

    if [ "${CHECKSERVER}" != "${SERVER}" ]
    then
        if [ -z "${SERVER}" -o "$2" = "FORCE" ]
        then
            if [ ! -d ${OMNICONFIGCLIENT} ]
            then
              mkdir -p ${OMNICONFIGCLIENT}
            fi
            echo  ${NEWSERVER} > ${CELL_SERVER}
            grep -v "allow_cmd=" ${OMNICONFIGCLIENT}/config > ${OMNICONFIGCLIENT}/config.tmp
            mv ${OMNICONFIGCLIENT}/config.tmp ${OMNICONFIGCLIENT}/config
            return 0   # Host included
        else
            echo "Client system already in another cell"
            return 1   # Host belongs to another cell
        fi
    else
        grep -v "allow_cmd=" ${OMNICONFIGCLIENT}/config > ${OMNICONFIGCLIENT}/config.tmp
        mv ${OMNICONFIGCLIENT}/config.tmp ${OMNICONFIGCLIENT}/config
        return 0  # Host  already belongs to the required cell
    fi
}


infoCell()
{
    case "${SERIES}" in
    hp/s[48]00/hp-ux)
      HOSTNAME=`hostname | tr "[A-Z]" "[a-z]"`
      HOST=`/opt/omni/lbin/utilns/hostlookup $HOSTNAME | tr "[A-Z]" "[a-z]"`
      ;;
    *)
      HOST=""
      ;;
    esac

    if [ ! -r "${OMNIINFO}" ]
    then
        return 1
    fi

        VERS=`awk ' /CELL_CONSOLE_VERSION/ { printf (" -cc %s", $NF) }
                                /DISK_AGENT_VERSION/ { printf (" -da %s", $NF) }
                                /MEDIA_AGENT_VERSION/ { printf (" -ma %s", $NF) }
                                /OMNIBACKI_VERSION/ { printf (" -o1 %s", $NF) }
                                /ORACLE_INTEGRATION_VERSION/ { printf (" -oracle %s", $NF) }
                                /OST_INTEGRATION_VERSION/ { printf (" -omnist %s", $NF) }
                                /SAP_INTEGRATION_VERSION/ { printf (" -sap %s", $NF) }
                                /OPC_INTEGRATION_VERSION/ { printf (" -opc %s", $NF) }
                                /SYBASE_INTEGRATION_VERSION/ { printf (" -sybase %s", $NF) }
                                /EMC_INTEGRATION_VERSION/ { printf (" -emc %s", $NF) }
                                /FASTRAX_MEDIA_AGENT_VERSION/ { printf (" -fxma %s", $NF) }
                                /FASTRAX_INTEGRATION_VERSION/ { printf (" -fastrax %s", $NF) }
                                /ORACLE8_INTEGRATION_VERSION/ { printf (" -oracle8 %s", $NF) }
                                /INFORMIX_INTEGRATION_VERSION/ { printf (" -informix %s", $NF) }
                                /ACS_INTEGRATION_VERSION/ { printf (" -acs %s", $NF) }
                                /DAS_INTEGRATION_VERSION/ { printf (" -das %s", $NF) }
                                /ENABLER_INTEGRATION_VERSION/ { printf (" -oms %s", $NF) }
                                /SSEA_INTEGRATION_VERSION/ { printf (" -ssea %s", $NF) }
                                /64BIT/ { printf (" -64bit") }
                        END     { printf("\n") } ' ${OMNIINFO}`

        STRING="-os \"${STRING}\""
        echo "${STRING} ${VERS}"

    return 0
}



GetVersion()
{
        PDIR=${1}/*/*/*/*
        if [ -f ${PDIR}/packet.Z ]
        then
		# ls -d ${PDIR} | grep -v "require.dat" |cut -f10 -d/ |sort -r | head -1
		for f in ${PDIR}/packet.Z; do
			d=${f%/packet.Z}
			echo ${d##*/}
		done | sort | tail -1
        fi
        return
}


#
#       Return installation packets available on Installation Server
##################################################################
IS_info()
{
    case "${SERIES}" in
		hp/s800/hp-ux-1*)
			ISERVER=`/usr/sbin/swlist DATA-PROTECTOR 2>/dev/null | grep DATA-PROTECTOR.OMNI-CORE-IS`
			PACKETDIR=${OMNIHOME}/databases/vendor
			;;

		sun/sparc/solaris-7)
			ISERVER=`/bin/pkginfo 2>/dev/null | grep OB2-C-IS `
			PACKETDIR=${OMNIHOME}/databases/vendor
			;;

                *)
                  ;;
    esac

        if [ -z "${ISERVER}" ]
        then
                echo "This host does not have the installation packages."
                return 1
        fi
#
# get the last version of installed components (if any)
# and print out merged version string in cell_info format
#

        CC_VERS=`GetVersion             ${PACKETDIR}/cc`
        MOMGUI_VERS=`GetVersion ${PACKETDIR}/momgui`
        DA_VERS=`GetVersion             ${PACKETDIR}/da`
        MA_VERS=`GetVersion             ${PACKETDIR}/ma`
        OB_VERS=`GetVersion             ${PACKETDIR}/ob`
        ORACLE_VERS=`GetVersion ${PACKETDIR}/oracle`
        OST_VERS=`GetVersion    ${PACKETDIR}/ost`
        SAP_VERS=`GetVersion    ${PACKETDIR}/sap`
        OPC_VERS=`GetVersion    ${PACKETDIR}/opc`
        SYBASE_VERS=`GetVersion ${PACKETDIR}/sybase`
        EMC_VERS=`GetVersion    ${PACKETDIR}/emc`
        FXMA_VERS=`GetVersion   ${PACKETDIR}/fxma`
        FASTRAX_VERS=`GetVersion ${PACKETDIR}/fastrax`
        OR8_VERS=`GetVersion    ${PACKETDIR}/oracle8`
        ACS_VERS=`GetVersion    ${PACKETDIR}/acs`
        DAS_VERS=`GetVersion    ${PACKETDIR}/das`
        ENABLER_VERS=`GetVersion ${PACKETDIR}/enabler`
        INFORMIX_VERS=`GetVersion ${PACKETDIR}/informix`
        SSEA_VERS=`GetVersion ${PACKETDIR}/ssea`

        [ -n "${CC_VERS}" ]             && CC_VERS="-cc ${CC_VERS}"
        [ -n "${MOMGUI_VERS}" ]         && CC_VERS="-momgui ${MOMGUI_VERS}"
        [ -n "${DA_VERS}" ]             && DA_VERS="-da ${DA_VERS}"
        [ -n "${MA_VERS}" ]             && MA_VERS="-ma ${MA_VERS}"
        [ -n "${OB_VERS}" ]             && OB_VERS="-o1 ${OB_VERS}"
        [ -n "${ORACLE_VERS}" ]         && ORACLE_VERS="-oracle ${ORACLE_VERS}"
        [ -n "${OST_VERS}" ]            && OST_VERS="-omnist ${OST_VERS}"
        [ -n "${SAP_VERS}" ]            && SAP_VERS="-sap ${SAP_VERS}"
        [ -n "${OPC_VERS}" ]            && OPC_VERS="-opc ${OPC_VERS}"
        [ -n "${SYBASE_VERS}" ]         && SYBASE_VERS="-sybase ${SYBASE_VERS}"
        [ -n "${EMC_VERS}" ]            && EMC_VERS="-emc ${EMC_VERS}"
        [ -n "${FXMA_VERS}" ]       && FXMA_VERS="-fxma ${FXMA_VERS}"
        [ -n "${FASTRAX_VERS}" ]        && FASTRAX_VERS="-fastrax ${FASTRAX_VERS}"
        [ -n "${OR8_VERS}" ]            && OR8_VERS="-oracle8 ${OR8_VERS}"
        [ -n "${ACS_VERS}" ]            && ACS_VERS="-acs ${ACS_VERS}"
        [ -n "${DAS_VERS}" ]            && DAS_VERS="-das ${DAS_VERS}"
        [ -n "${ENABLER_VERS}" ]        && ENABLER_VERS="-oms ${ENABLER_VERS}"
        [ -n "${INFORMIX_VERS}" ]       && INFORMIX_VERS="-informix ${INFORMIX_VERS}"
        [ -n "${SSEA_VERS}" ]           && SSEA_VERS="-ssea ${SSEA_VERS}"

        HOSTNAME=`hostname | tr "[A-Z]" "[a-z]"`
        HOST="-host \"`/opt/omni/lbin/utilns/hostlookup $HOSTNAME | tr "[A-Z]" "[a-z]"`\""
        STRING="-os \"${STRING}\""

        DIR_64=${PACKETDIR}/*/*/*
        if [ -d ${DIR_64}/hp-ux-11-64 ]
        then
                PACKETS_64="-64bit"
        fi

        echo "${HOST} ${STRING} ${PACKETS_64} ${CC_VERS} ${DA_VERS} ${MA_VERS} ${OB_VERS} ${ORACLE_VERS} ${OST_VERS} ${SAP_VERS} ${OPC_VERS} ${INFORMIX_VERS} ${SYBASE_VERS} ${ENABLER_VERS} ${EMC_VERS} ${FXMA_VERS} ${FASTRAX_VERS} ${OR8_VERS} ${ACS_VERS} ${DAS_VERS} ${SSEA_VERS}"

    return 0
}

# ----------------------------------------------------------------------
#
#  Detect the type of cluster: SG or VCS based on installed binaries
#  We presume that only one cluster software is installed on the system.
#
# ----------------------------------------------------------------------
detectClusType()
{
    CLUSTYPE="NONE"

    if [ -x /usr/sbin/cmquerycl ]; then
      SGBIN_DIR="/usr/sbin/"
      CLUSTYPE="SG"
    elif [ -x /usr/local/cmcluster/bin/cmquerycl ]; then
      SGBIN_DIR="/usr/local/cmcluster/bin/"
      CLUSTYPE="SG"
    elif [ -x /opt/cmcluster/bin/cmquerycl ]; then
      SGBIN_DIR="/opt/cmcluster/bin/"
      CLUSTYPE="SG"
    else
      SGBIN_DIR=""
    fi
    
    if [ ${CLUSTYPE} != "NONE" ] ; then
      return
    fi
    
    if [ -x /opt/VRTSvcs/bin/haclus ]; then
      VCSBIN_DIR="/opt/VRTSvcs/bin/"
      CLUSTYPE="VCS"
    fi
}

# ----------------------------------------------------------------------
#
#  Function(s) gets a list of node names and virtual names from a cluster
#  that this host belongs to.
#
# ----------------------------------------------------------------------
infoClus()
{
  detectClusType
  if [ ${CLUSTYPE} = "SG" ] ; then
    infoClus_SG
  elif [ ${CLUSTYPE} = "VCS" ] ; then
    infoClus_VCS
  else
    return 1
  fi
}

infoClus_VCS()
{
  vcsNodes=""             # string with physical nodes
  vcsVirtual=""           # string with virtual servers (from packages)

  VCS_NODES=`${VCSBIN_DIR}hasys -list -localclus`
  if [ $? != 0 ]; then
      # hasys failed
      return 1
  fi
  
  VCS_VS_IP=`${VCSBIN_DIR}hares -display -type IP -attribute Address -localclus | awk '!/^#/{ print $4 }'`
  if [ $? != 0 ]; then
      # hares failed
      return 1
  fi
  
  for X in ${VCS_NODES}
  do
    VTMP=`/opt/omni/bin/oblookup ${X} | awk '{printf "%s", $2}' 2>/dev/null`
    if [ $? = 0 ] ; then
      vcsNodes=$vcsNodes"1 \"${VTMP}\""
    else
      vcsNodes=$vcsNodes"1 \"${X}\""
    fi
  done

  for X in ${VCS_VS_IP}
  do
    VTMP=`/opt/omni/bin/oblookup ${X} | awk '{printf "%s", $2}' 2>/dev/null`
    if [ $? = 0 ] ; then
      vcsVirtual=$vcsVirtual"8 \"${VTMP}\""
    else
      vcsVirtual=$vcsVirtual"8 \"${X}\""
    fi
  done

  echo "$vcsNodes$vcsVirtual"
  echo "$vcsNodes$vcsVirtual" >> /opt/omni/lbin/trace.log
}

infoClus_SG()
{
    sgNodes=""             # string with physical nodes
    sgVirtual=""           # string with virtual servers (from packages)
    
    sgClusName=""          # latest cluster found
    sgLocalClusName=""     # cluster that local host belongs to
    
    localhost=`hostname`   # hostname of the local machine
    localhost=`/opt/omni/lbin/utilns/hostlookup $localhost  2>/dev/null`
    
    if [ -x /usr/sbin/cmquerycl ]; then
      SGBIN_DIR="/usr/sbin/"
    elif [ -x /usr/local/cmcluster/bin/cmquerycl ]; then
      SGBIN_DIR="/usr/local/cmcluster/bin/"
    elif [ -x /opt/cmcluster/bin/cmquerycl ]; then
      SGBIN_DIR="/opt/cmcluster/bin/"
    else
      SGBIN_DIR=""
    fi

    #
    # copy the output of command for further processing
    #
    
    ${SGBIN_DIR}cmquerycl > /tmp/.obsgtmp 2>> /dev/null

    if [ $? != 0 ]; then
        #
        # cmquerycl failed: clustering is most probably not installed
        #
        rm /tmp/.obsgtmp 2> /dev/null
        return 1
    fi

    # Format of the output of cmquerycl is:
    # Cluster Name Node Name
    # Cluster Name
    # Node1
    # Node2
    #
    # Cluster Name 2
    # Node3
    # Node4
    #
    
    #
    # STEP 1:
    # Find the cluster name that local host belongs to by scanning the file
    # line by line.
    #
    
    sgLoopState="none"

    while read line
    do
        if [ "$sgLoopState" = "none" ]; then
            #
            # Skip everything in front of the header
            #
            (echo "$line" | grep "Cluster " 2>&1 | grep "Node " 2>&1 ) > /dev/null
            
            if [ $? = 0 ]; then
                sgLoopState="go"
            fi
        else            
            if [ "$sgClusName" = "" ]; then
                sgClusName=$line
            else
                linetmp=`/opt/omni/lbin/utilns/hostlookup $line 2>/dev/null`
                if [ $? = 0 ]; then
                    line=${linetmp}
                fi
                if [ "$line" = "$localhost" ]; then
                    sgLocalClusName=$sgClusName
                else
                    if [ "$line" = "" ]; then
                        #
                        # Empty line is delimiter between clusters
                        #
                        sgClusName=""
                    fi
                fi
            fi
        fi
    done < /tmp/.obsgtmp
    
    if [ "$sgLocalClusName" = "" ]; then
        #
        # this node is not in a cluster (clustering sw is installed)
        #
        rm /tmp/.obsgtmp 2> /dev/null
        return 2 # local host not in cluster
    fi
    
    #
    # STEP 2: second pass -> get the node names
    # Extract node names from the same file once you have the cluster name by
    # scanning the file again.
    #
    sgLoopState="clus"
    
    while read line
    do
        case "$sgLoopState" in
        "clus")
            if [ "$sgLocalClusName" = "$line" ]; then
                sgLoopState="node"
            fi
            ;;
        "node")
            if [ "$line" = "" ]; then
                sgLoopState="done"
            else
                linetmp=`/opt/omni/lbin/utilns/hostlookup $line 2>/dev/null`
                if [ $? = 0 ]; then
                    line=${linetmp}
                fi
                sgNodes=$sgNodes"1 \"$line\""
            fi
            ;;
        *)
            ;;
        esac
    done < /tmp/.obsgtmp

    SG_PKG_IP_ALL=`${SGBIN_DIR}cmviewcl -c ${sgLocalClusName} -vf line -l package 2>/dev/null | grep ip_address`
    if [ $? != 0 ]; then
        rm /tmp/.obsgtmp2 2> /dev/null
        return 3 # error getting virtual names (cluster not up or similar)
    fi
    
    SG_PKG_IP1=`echo "${SG_PKG_IP_ALL}" | awk 'BEGIN { FS = "|" } ; /ip_address=/ { print $3 }' | awk 'BEGIN { FS = "=" } ; { print $2 }'`
    SG_PKG_IP2=`echo "${SG_PKG_IP_ALL}" | awk 'BEGIN { FS = "|" } ; /ip_address:/ { print $2 }' | awk 'BEGIN { FS = ":" } ; { print $2 }'`

    # Resolve IPs to hostnames and skip
    # listing IPs which could not be resolved
    for X in ${SG_PKG_IP1}
    do
      VTMP=`/opt/omni/bin/oblookup ${X} 2>/dev/null | awk '{printf "%s", $2}'`
      if [ $? = 0 ] ; then
        sgVirtual=$sgVirtual"8 \"$VTMP\""
      fi
    done
    
    for X in ${SG_PKG_IP2}
    do
      VTMP=`/opt/omni/bin/oblookup ${X} | awk '{printf "%s", $2}'` 2>/dev/null
      if [ $? = 0 ] ; then
        echo ${SG_PKG_IP1} | grep ${X}
        if [ $? != 0 ] ; then
          sgVirtual=$sgVirtual"8 \"$VTMP\""
        fi
      fi
    done
    
    rm /tmp/.obsgtmp 2> /dev/null

    echo "$sgNodes$sgVirtual"
    echo "$sgNodes$sgVirtual" >> /opt/omni/lbin/trace.log
    #
    # Output is:
    #
    # 1 "audi.domain.com"1 "dodge.domain.com"8 "sgipr.domain.com"
    #
}

# ----------------------------------------------------------------------
#
#  Function checks for a hostname if it has OmniInet in cluster mode
#  installed.
#
#  The criteria is: If the host has MC/SG/VCS installed, then also
#  OmniInet is in cluster mode.
#
# ----------------------------------------------------------------------
infoClus1()
{
    #
    # On MC/SG/VCS we suppose that the node is in cluster if it has
    # software installed.
    #
    detectClusType

    if [ ${CLUSTYPE} = "VCS" ] ; then
      ${VCSBIN_DIR}haclus -list > /dev/null 2>&1
    else
      ${SGBIN_DIR}cmquerycl 2>&1 > /dev/null
    fi

    if [ $? != 0 ]; then
        #
        # An error: we suppose that the MC/SG/VCS is not installed.
        #
        echo "0 \"NONE\""
        echo "0 \"NONE\"" >> /opt/omni/lbin/trace.log
    else
        #
        # 49 means: E_CLUS_NODE (1) + E_CLUS_OB_INST (16) +
        #           E_CLUS_OB_CLUS (32)
        #
        localhost=`hostname`   # hostname of the local machine
        localhost=`/opt/omni/lbin/utilns/hostlookup $localhost  2>/dev/null`

        echo "49 \"$localhost\""
        echo "49 \"$localhost\"" >> /opt/omni/lbin/trace.log
    fi
}


checkCluster()
{
    OB2CONF=/etc/opt/omni/server/sg
    CONFIG_SG=${OB2CONF}/sg.conf
    test -r $CONFIG_SG

    if [ $? = 0 ]
    then
        . $CONFIG_SG
        VALUE=`eval 'echo $SHARED_DISK_ROOT'`

        test -n "$VALUE"

        if [ $? != 0 ]
        then
            CLUSTER="NO"
        else
            CLUSTER="YES"
            SHARED_PATH=${VALUE}
        fi
    else
        CLUSTER="NO"
    fi
}


# ----------------------------------------------------------------------
#
#  Construct and print a FQDN from uname and domain name info.
#  This is called in case DNS lookup fails on Linux and Solaris.
#
# ----------------------------------------------------------------------
printFQDN()
{
    tmpHost=`uname -a | awk '{print $2}'`

    case "${ARCH}" in
        Linux*)
            if [ -f "/bin/dnsdomainname" ]
            then
                # get info from dnsdomainname
                tmpDomain=`/bin/dnsdomainname`
            else
                # parse resolve conf
                # CHECKME: is it okay to parse the "search" lines?
                if [ -f "/etc/resolv.conf" ]
                then
                    tmpDomain=`cat /etc/resolv.conf 2>/dev/null | grep ^search | awk '{print $2}'`
                    if [ "$tmpDomain" = "" ]
                    then
                        tmpDomain=`cat /etc/resolv.conf 2>/dev/null | grep ^domain | awk '{print $2}'`
                    fi
                fi
            fi
            ;;
        SunOS*)
            if [ -f "/etc/defaultdomain" ]
            then
                tmpDomain=`cat /etc/defaultdomain 2>/dev/null`
            fi
            ;;
    esac

    if [ "$tmpDomain" != "" ]
    then
        tmpDomain=".$tmpDomain"
    fi
    echo ${tmpHost}${tmpDomain} | tr "[A-Z]" "[a-z]"

    return 0
}



# main part of the script

COMMAND=$1
shift
PARAMS="$*"


init_var $PARAMS

case $COMMAND in
     sap_set)    NumberOfSapSet $PARAMS ;;
     adduser)    addUser $PARAMS;;
     USER   )    getUser $PARAMS;;
     OS     )    getOs $PARAMS;;
     CELL   )    getCell $PARAMS;;
     BDF    )    getBdf $PARAMS;;
     EXCLUDE)    excludeCell $PARAMS
                 exit $?
                 ;;
     INCLUDE)    includeCell $PARAMS
                 exit $?
                 ;;
     INFO   )    infoCell $PARAMS
                 exit $?
                 ;;
     ISINFO )    IS_info $PARAMS
                 exit $?
                 ;;
     OSINFO )    echo "${STRING}"
                 exit $?
                 ;;
     SECURE )   VAROPTOMNIDIR="/var/opt/omni"
                ENHINCRDB="${VAROPTOMNIDIR}/enhincrdb"
                LOGDIR="${VAROPTOMNIDIR}/log"
                SERVERDIR="${VAROPTOMNIDIR}/server"
                TMPDIR="${VAROPTOMNIDIR}/tmp"
                WINDUDIR="${VAROPTOMNIDIR}/windu"
                SERVERLOGDIR="${SERVERDIR}/log"
                NEWCONFIG="/opt/omni/newconfig"


                HOSTNAME=`hostname | tr "[A-Z]" "[a-z]"`
                chmod 1777 ${ENHINCRDB}
                chmod 1777 ${LOGDIR}
                chmod 1777 ${TMPDIR}
                chmod 1777 ${WINDUDIR}

                if [ -d ${NEWCONFIG} ]
                then
                    chmod 1777 ${NEWCONFIG}${ENHINCRDB}
                    chmod 1777 ${NEWCONFIG}${LOGDIR}
                    chmod 1777 ${NEWCONFIG}${TMPDIR}
                fi

                CLUSTER="NO"
                SHARED_PATH=""

                checkCluster

                if [ ${CLUSTER} = "YES" ]; then
                    chmod 1777 ${VAROPTOMNIDIR}/server.save
                    chmod 1777 ${SHARED_PATH}/var_opt_omni_server
                    chmod 1777 ${SHARED_PATH}/var_opt_omni_server/log
                else
                    chmod 1777 ${SERVERDIR}
                    chmod 1777 ${SERVERLOGDIR}
                fi

                echo "Successfully Secured the Client $HOSTNAME"
                exit 0
                ;;

    RMSECURE )  VAROPTOMNIDIR="/var/opt/omni"
                ENHINCRDB="${VAROPTOMNIDIR}/enhincrdb"
                LOGDIR="${VAROPTOMNIDIR}/log"
                SERVERDIR="${VAROPTOMNIDIR}/server"
                TMPDIR="${VAROPTOMNIDIR}/tmp"
                WINDUDIR="${VAROPTOMNIDIR}/windu"
                SERVERLOGDIR="${SERVERDIR}/log"
                NEWCONFIG="/opt/omni/newconfig"

                HOSTNAME=`hostname | tr "[A-Z]" "[a-z]"`
                chmod 777 ${ENHINCRDB}
                chmod 777 ${LOGDIR}
                chmod 777 ${TMPDIR}
                chmod 777 ${WINDUDIR}
                if [ -d ${NEWCONFIG} ]
                then
                    chmod 777 ${NEWCONFIG}${ENHINCRDB}
                    chmod 777 ${NEWCONFIG}${LOGDIR}
                    chmod 777 ${NEWCONFIG}${TMPDIR}
                fi

                CLUSTER="NO"
                SHARED_PATH=""

                checkCluster

                if [ ${CLUSTER} = "YES" ]; then
                    chmod 777 ${VAROPTOMNIDIR}/server.save
                    chmod 777 ${SHARED_PATH}/var_opt_omni_server
                    chmod 777 ${SHARED_PATH}/var_opt_omni_server/log
                else
                    chmod 777 ${SERVERDIR}
                    chmod 777 ${SERVERLOGDIR}
                fi

                echo "Successfully Unsecured the Client $HOSTNAME"
                exit 0
                ;;


     HOSTNAME)   case "${ARCH}" in
                   MPE*)
                     uname -a | awk '{print $2}'
                     exit $?
                     ;;
                   Linux*|SunOS*)
                     tmpHost=`${OMNIHOME}/bin/oblookup \`hostname\` 2> /dev/null | awk '/^Name:/ {print $2}' | tr "[A-Z]" "[a-z]"`
                     if [ "$tmpHost" = "" ]
                     then
                         printFQDN
                     else
                        echo $tmpHost
                     fi
                     exit $?
                     ;;
              OS/390*)
                    ${OMNIHOME}/bin/oblookup `hostname -r` 2> /dev/null | awk '/^Name:/ {print $2}' | tr "[A-Z]" "[a-z]"
                     exit $?
                     ;;
                   *)
                     ${OMNIHOME}/bin/oblookup `hostname` 2> /dev/null | awk '/^Name:/ {print $2}' | tr "[A-Z]" "[a-z]"
                     exit $?
                     ;;
                 esac
                 ;;

    UNAME)      echo ${UNAME}
                exit $?
                ;;

    OMNIACS   ) case $SERIES in
                    hp*) while true ; do
                             PAR="${PAR} '$1'"
                             shift
                             if [ $# = 0 ] ; then
                                 break
                             fi
                         done
                         eval "$OMNILBIN/omniacs $PAR"
                         exit $?
                         ;;
                    *)   echo Platform not supported!
                         exit 1;
                         ;;
                 esac
                 ;;

    OMNIDAS   ) case $SERIES in
                    hp*) while true ; do
                             PAR="${PAR} '$1'"
                             shift
                             if [ $# = 0 ] ; then
                                 break
                             fi
                         done
                         eval "$OMNILBIN/omnidas $PAR"
                         exit $?
                         ;;
                    *)   echo Platform not supported!
                         exit 1;
                         ;;
                 esac
                 ;;

    INFO_CLUS   )
                    infoClus
                ;;

    INFO_CLUS1  )
                    infoClus1
                ;;

esac

