#
# Copyright(c)  2000 Sun Microsystems, Inc.
# All Rights Reserved.
#
#ident  "@(#)sample_preremove		1.1	00/02/07	SMI"
#
#  Copied Preremove script to test patch_postremove
#

# Determine if installation is via jumpstart
echo "Running pre-remove"
echo $BASEDIR | grep '^\/a' > /dev/null
if [ $? -eq 0 ]
    then
        JUMPSTART=1
    else
        JUMPSTART=0
fi

# Set root directory as appropriate for installation

RDIR=$PKG_INSTALL_ROOT

# to avoid a redundant slash
if [ "$BASEDIR" = '/' ]
then
      PDIR=''
else
      PDIR="$BASEDIR"
fi

PATH="/bin:/usr/bin:/usr/sbin:$RDIR/bin:$RDIR/usr/bin:$RDIR/usr/sbin"
export PATH

if [ $JUMPSTART = 1 ] ; then
   iopts=
elif [ -z "$RDIR" ] ; then
   iopts=
else
   iopts="-R $RDIR"
fi
printf "\nRunning pre-remove\n"
echo "Processing 32 bit binaries..."
cd $PDIR/SUNWvts/bin
$PDIR/SUNWvts/bin/testrm tapetest
$PDIR/SUNWvts/bin/testadd tape

if { pkginfo $iopts SUNWvtsx 1>/dev/null 2>&1 ; } then
   # do 64 bit version (ld works in both 32 and 64 bit modes correctly)
   echo "Processing 64 bit binaries..."
   cd $PDIR/SUNWvts/bin/sparcv9
   $PDIR/SUNWvts/bin/testrm tapetest
   $PDIR/SUNWvts/bin/testadd tape
else
   # don't do anything for 64 bit if not found
   :
fi

