#!/bin/sh

if [ "$appHome" = "" ]; then
  appHome="/opt/webservice"
fi
if [ "$varPath" = "" ]; then
  varPath="/var/opt/webservice"
fi

identifier="HPA500i"
${appHome}/scripts/is_hpa > /dev/null
rc=$?
if [ "$rc" = "1" ]; then
  # it is a OSA500, check the type a or i
  sg_config_file=/var/opt/soco/config/initialcfg.xml
  if [ ! -f ${sg_config_file} ]; then
    # SoftGate not configured, I can not differentiate between a and i
    echo "no ${identifier}"
    exit 0
  else
    grep "hardwareType" ${sg_config_file} > /dev/null
    if [ $? == 0 ]; then
      # there is an entry hardwareType in initialcfg.xml -> check it
      hwtype=`grep "hardwareType" ${sg_config_file} | sed 's/.*value="//'`
      hwtype=`echo ${hwtype}  | sed 's/".*//'`
      if [ "${hwtype}" = "2" ]; then
        echo "${identifier}"
        exit 1
      else
        echo "no ${identifier}"
        exit 0
      fi
    else
      echo "no ${identifier}"
      exit 0
    fi
  fi
else
  echo "no ${identifier}"
  exit 0
fi

  