#!/bin/bash
ACUXE_BIN_INSTALLATION_DIR=/opt/compaq/cpqacuxe/bld/
export ACUXE_BIN_INSTALLATION_DIR
LD_LIBRARY_PATH=$ACUXE_BIN_INSTALLATION_DIR
export LD_LIBRARY_PATH
IM_CFGFILE_PATH=$ACUXE_BIN_INSTALLATION_DIR
export IM_CFGFILE_PATH
ACUXE_LOCK_FILES_DIR=/opt/compaq/cpqacuxe/bld/locks/
export ACUXE_LOCK_FILES_DIR


#
# need to see if this is a SLES 10 box
SUSEREL="/etc/SuSE-release"
VER=""
if [ -f "$SUSEREL" ]
then
        VER=`grep VERSION $SUSEREL | cut -d' ' -f3 | grep "^10"`
fi

# Don't set LD_ASSUME_KERNEL on SLES 10
if [ "$VER" == "" ]
then
        export LD_ASSUME_KERNEL=2.4.1
fi


ACUXE_PASS_FAILED=0
if [ "$1" == "" ] || [ "$1" == "-R" ] || [ "$1" == "-d" ]; then
PROCESSES=`ps -e|grep hpsmhd`
if [ "$PROCESSES" = "" ]; then
   ACUXE_PASS_FAILED=1
fi
fi

if [ "$ACUXE_PASS_FAILED" = 0 ]; then
   chmod ug+s /opt/compaq/cpqacuxe/bld/ipcelmclient 2>/dev/null
   if [ '/usr/bin/tty -s' -o "$HPLSPINSTALL" = "TRUE" ]; then
      $ACUXE_BIN_INSTALLATION_DIR.acuxebin $*
   else
      /usr/bin/X11/xterm -T xterm -hold -e $ACUXE_BIN_INSTALLATION_DIR.acuxebin $* 
      if [ "$?" != 0 ]; then
         $ACUXE_BIN_INSTALLATION_DIR.acuxebin $* 2>/dev/null|cat > /dev/null
      fi
   fi
else
   echo Can not run because of HP System Management Homepage is not started or uninstalled.
   echo Please try to use "/etc/init.d/hpsmhd start" to start it.
   exit 1
fi
