#!/bin/sh

INSTALLLOG=/var/spool/compaq/cma.log
INSTMSG="cmasvr installation"

PKGSCRIPTENABLED="No"
for i in 2 3 4 5; do
	ls /etc/rc.d/rc$i.d/S[0-9][0-9]snmpd >/dev/null 2>&1
	[ "$?" = "0" ] &&  PKGSCRIPTENABLED="Yes"
done

if [ "$PKGSCRIPTENABLED" != "Yes" ]; then
  echo "`date`: $INSTMSG: No snmpd Start script is turned on!" >> $INSTALLLOG
  echo
  echo "No snmpd Start script is turned on!"
  BOOTRUNLEVEL=`grep '^id:[0-9]' /etc/inittab | sed 's/^id:\([0-9]*\).*initdefault.*$/\1/'`
  if [ -z "$BOOTRUNLEVEL" ]; then
     BOOTRUNLEVEL="2345"
  fi
  echo "`date`: $INSTMSG: Turned on snmpd Start script at default boot runlevel $BOOTRUNLEVEL!" >> $INSTALLLOG
  echo "Turned on snmpd Start script at default boot runlevel $BOOTRUNLEVEL!"

  /sbin/chkconfig --level $BOOTRUNLEVEL snmpd on

fi
