#!/bin/sh 
#
#ident "@(#)preremove	1.5 09 Sep 1994 SMI"
#
# Copyright 1993 Sun Microsystems, Inc. All Rights Reserved
#
#  
#  Create sym-link from SUNWconn/bin to SUNWconn/<pkgdir>/bin 


# Exit codes for installation scripts 
e_ok=0      
e_fatal=1      # stop installation on this exit
e_warning=2    # Installation will go on. 
e_int=3        # Interrupted. Stop installation
e_reboot=10    # User must reboot after installation of all selected packages
e_rebootnow=20 # User must reboot right after installation of current package
               # To be added to one of the single-digit exit code above

# Trap interrupt
trap `exit $e_int` 15

PKG_DIR=osinet
BIN_DIR=$BASEDIR/SUNWconn/bin
LNBIN_TO_REMOVE="ops osi_trace ositool osidump osi_ping"

if [ ! -d ${BIN_DIR} ]
then
   exit $e_ok           # no sym-links to be removed 
fi

if [ ! -d ${BIN_DIR}/../$PKG_DIR/bin ]
then
  echo "Error: cannot find dir <${BIN_DIR}/../$PKG_DIR/bin> " 1>&2
  exit $e_warning 
fi

echo "Removing sym-links from $BIN_DIR:" 

e_value=$e_ok

cd $BIN_DIR/../$PKG_DIR/bin
for f in $LNBIN_TO_REMOVE ; do
        cd $BIN_DIR
  	if [ -h $f ]
        then
           echo "\t `pwd`/$f" 
           rm $f
           if [ $? -ne 0 ]
           then
               echo "ERROR: cannot remove ${BIN_DIR}/$f" 1>&2 
               e_value=$e_warning
           fi
       fi
done

exit $e_value
