# Copyright 26 Jan 1997 Sun Microsystems, Inc. All Rights Reserved.
#
#pragma ident  "@(#)preinstall	1.5 97/01/26 Sun Microsystems"
#
# preinstall script for Openstep End User Libraries/Services.
#
# Return pid of named process in variable "pid"
#
# 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 codes above

#
# Trap interrupt
#
trap `exit $e_int` 15
#

#
killproc() {
    pid=`/usr/bin/ps -e | /usr/bin/grep $1 |
         /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`

    for p in $pid
    do
         echo "Terminating $1: PID=$p "
         kill -9  $p
    done
}
 
 
#echo "Terminating OpenStep Service Daemon(s)..."
 
#killproc ospd
#killproc osaks
#killproc ospdinfo
#killproc ospbs
#killproc osspell
 
#
# remove shared memory allocated by OpenStep
#
 

 
#
# create a link with /usr/openstep first
#
if [ ! -d /usr/openstep ]; then
     if [ ! -h /usr/openstep ]; then
          ln -s  $BASEDIR/SUNWdoe/openstep  /usr/openstep
     else
	echo "WARNING!!! /usr/openstep currently exists so will not be automatically"
	echo "relinked.  You will need to link /usr/openstep to your newest"
	echo "install by hand in order to use your newly installed OpenStep, please"
	echo "refer to the Installation Guide."
#          mv     /usr/openstep   /usr/openstep.$$ 
#          ln -s  $BASEDIR/SUNWdoe/openstep  /usr/openstep
     fi
else
	echo "WARNING!!! /usr/openstep currently exists so will not be automatically"
	echo "relinked.  You will need to link /usr/openstep to your newest"
	echo "install by hand in order to use your newly installed OpenStep, please"
	echo "refer to the Installation Guide."
#     mv     /usr/openstep   /usr/openstep.$$
#     ln -s  $BASEDIR/SUNWdoe/openstep  /usr/openstep
fi
 
 
exit $e_ok

 


