#!/bin/ksh

#
# This script removes the entry for the rgm_vp_version table from the
# CCR directory file.  It also removes the rgm_vp_version table itself
# from the CCR directory.
#


/usr/cluster/lib/sc/rgm_check_ccr

if [ $? -ne 0 ]; then
   exit 1
fi

#check if the heartbeat parameters are correct before backing out the patch

/usr/cluster/lib/sc/tunhb_check_ccr

if [ $? -ne 0 ]; then
   exit 1
fi

#check if IPv6 feature is supported on CCR 

/usr/cluster/lib/sc/ipv6_check_ccr

if [ $? -ne 0 ]; then
   exit 1
fi

echo "Removing entries from rgm_vp_version table!"
SED=/bin/sed
MV=/bin/mv
RM=/bin/rm
CCRADM=/usr/cluster/lib/sc/ccradm
DIRFILE=/etc/cluster/ccr/directory
TMPFILE=/etc/cluster/ccr/directory.no_vp_version
VPTABLE=/etc/cluster/ccr/rgm_vp_version

$RM $TMPFILE 2>&1
$SED -e '/rgm_vp_version/d' $DIRFILE > $TMPFILE
$MV -f $TMPFILE $DIRFILE
$CCRADM -i $DIRFILE -o
$RM $VPTABLE

exit 0
