#!/bin/sh

#
# The script has *no* provision for backing out changes.
#
echo "BayNetworks DM/VM AIX NetView install script."

if [ `whoami` != "root" ]; then
	echo "ERROR: $0 must be run as root."
	exit 1
fi

#
# Copy files and bitmaps into OV.
#
cp $DMPATH/aixnv/Connector_BayFrameSwitch_* /usr/OV/symbols/C
cp $DMPATH/aixnv/bayframeswitch_fields /usr/OV/fields/C
cp $DMPATH/aixnv/bayframeswitch.reg /usr/OV/registration/C
cp $DMPATH/aixnv/accelar_connector/* /usr/OV/bitmaps/C
cp $DMPATH/aixnv/baystack_connector/* /usr/OV/bitmaps/C


#
# Copy Accelar MIBs so that they can be found by user when loading.
#
if [ ! -d /usr/OV/snmp_mibs ]; then
	mkdir /usr/OV/snmp_mibs
fi

cp $DMPATH/aixnv/accelar_mibs/*.mib /usr/OV/snmp_mibs
cp $DMPATH/aixnv/baystack_mibs/*.mib /usr/OV/snmp_mibs

#
# If we don't see our sysObjectID, then append it to oid_to_sym.
#
if [ `grep -c 1.3.6.1.4.1.2272.2 /usr/OV/conf/C/oid_to_sym` = 0 ]; then
	echo "1.3.6.1.4.1.2272.2:Connector:Accelar1100 # Accelar Routing Switch" >> /usr/OV/conf/C/oid_to_sym
fi

if [ `grep -c 1.3.6.1.4.1.2272.6 /usr/OV/conf/C/oid_to_sym` = 0 ]; then
	echo "1.3.6.1.4.1.2272.6:Connector:Accelar1250 # Accelar Routing Switch" >> /usr/OV/conf/C/oid_to_sym
fi

if [ `grep -c 1.3.6.1.4.1.2272.7 /usr/OV/conf/C/oid_to_sym` = 0 ]; then
	echo "1.3.6.1.4.1.2272.7:Connector:Accelar1150 # Accelar Routing Switch" >> /usr/OV/conf/C/oid_to_sym
fi

if [ `grep -c 1.3.6.1.4.1.2272.8 /usr/OV/conf/C/oid_to_sym` = 0 ]; then
	echo "1.3.6.1.4.1.2272.8:Connector:Accelar1200 # Accelar Routing Switch" >> /usr/OV/conf/C/oid_to_sym
fi

if [ `grep -c 1.3.6.1.4.1.2272.9 /usr/OV/conf/C/oid_to_sym` = 0 ]; then
	echo "1.3.6.1.4.1.2272.9:Connector:Accelar105x # Accelar Routing Switch" >> /usr/OV/conf/C/oid_to_sym
fi

if [ `grep -c 1.3.6.1.4.1.45.3.35.1 /usr/OV/conf/C/oid_to_sym` = 0 ]; then
	echo "1.3.6.1.4.1.45.3.35.1:Connector:BayStack # BayStack Switch" >> /usr/OV/conf/C/oid_to_sym
fi

#
# Merge traps.
#
if [ -f $DMPATH/aixnv/accelar_nv_trapd.conf ]; then
	chmod 777 $DMPATH/aixnv/accelar_nv_trapd.conf
        $DMPATH/aixnv/accelar_nv_trapd.conf
fi

#
# Prompt user to restart NetView
#
echo "Done.  Run:\n1 'ovw -fields' to update fields database\n2 'ovstop netmon' to stop monitoring\n3 'ovtopofix' to recognize bitmaps\n4 'ovstart netmon' to restart monitoring\n5 'ovw' to start NetView\n6 Load Accelar/450 Mibs (Options->Load Mibs)"

