postinstall revision 7c478bd95313f5f23a4c958a745db2134aa03244
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 1996-1997, 2001-2002 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#pragma ident "%Z%%M% %I% %E% SMI"
#
# pkgdefs/SUNWsacom/postinstall
#
#
# Retain original SNMPD configuration file they might have from an
# earlier SunNet Manager installation.
#
if [ -f $BASEDIR/etc/opt/SUNWconn/snm/snmpd.conf ] ; then
cp $BASEDIR/etc/snmp/conf/snmpd.conf $BASEDIR/etc/snmp/conf/snmpd.conf.original
echo 'Copying $BASEDIR/etc/opt/SUNWconn/snm/snmpd.conf (existing SNMPD configuration file)'
echo 'to $BASEDIR/etc/snmp/conf/snmpd.conf'
cp $BASEDIR/etc/opt/SUNWconn/snm/snmpd.conf $BASEDIR/etc/snmp/conf/snmpd.conf
fi
def_read="public"
def_write="private"
def_desc="Sun SNMP Agent, Company Property Number 123456"
def_cont="System administrator"
def_loc="System administrators office"
READSTR=$def_read
WRITESTR=$def_write
desc=`/etc/prtconf |/usr/bin/head -5|/usr/bin/grep SUNW |awk -F, '{print $2}'`
if [ "$desc" = "" ]; then
desc=`/etc/prtconf |/usr/bin/head -5|/usr/bin/grep SUNW |awk '{print $1}'`
fi
def_desc="Sun SNMP Agent, $desc"
DESCSTR=$def_desc
CONTSTR=$def_cont
LOCSTR=$def_loc
export READSTR WRITESTR DESCSTR CONTSTR LOCSTR
# main ()
#
# Update the snmpd.conf file with the default community strings
# for the system on which this is installed.
#
/usr/bin/ed -s $BASEDIR/etc/snmp/conf/snmpd.conf <<SNMPEOF>/dev/null
1,\$s!ALLDESC!$DESCSTR!g
1,\$s!ALLCONT!$CONTSTR!g
1,\$s!ALLLOC!$LOCSTR!g
w
q
SNMPEOF
installf -f $PKGINST
exit 0