#!/bin/sh
#
#  Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
#  Use is subject to license terms.
#
# ident	"@(#)preinstall	1.7	07/11/13 SMI"
#
# *
# * U.S. Government Rights - Commercial software. Government users are subject
# * to the Sun Microsystems, Inc. standard license agreement and applicable
# * provisions of the FAR and its supplements.
#
# This distribution may include materials developed by third parties. Sun,
# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
#  trademarks of Sun Microsystems, Inc. in the U.S. and other countries.

CONF=$BASEDIR/etc/sma/snmp/snmpd.conf

#
# Correct possible corruption due to bug ID 6564641
#

SPARC_SUM="10738"
X86_SUM="12985"

if [ -f $CONF -a -f $CONF.save ]; then
        CONF_SUM=`/usr/bin/sum $CONF | /usr/bin/sed "s/^\([0-9]*[0-9]*\) .*/\1/"`
	if [ $CONF_SUM = $SPARC_SUM -o $CONF_SUM = $X86_SUM ]; then
		/usr/bin/mv $CONF.save $CONF
	fi
fi

if [ -f $CONF ] ; then
	/usr/bin/cp -p $CONF $CONF.save
fi

#
# make sure the enabled/disabled state is maintained over upgrades.
# on initial installs the SMF profile is responsible for the state.
#
if [ "$UPDATE" = yes ]; then
	if [ -f $BASEDIR/etc/rc3.d/S82initsma ]; then
		touch $BASEDIR/var/sma.tmp
	fi
fi

exit 0
