#!/bin/sh
#
# Copyright (c) 07/24/98, by Sun Microsystems, Inc. All rights reserved.
#
# "@(#)preremove 1.2 98/07/24 SMI"
#

# 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

CP=/bin/cp
ECHO=/bin/echo
MKDIR=/bin/mkdir
PKGP=/bin/pkgparam
RM=/bin/rm

# Get Java DMK version

VERSION=`$PKGP SUNWjawco VERSION | sed -e 's/ //g'`

# Backup the file jaw.env

jaw_env_file="/etc/opt/SUNWconn/jaw/conf/jaw.env"

if [ -f ${jaw_env_file} ]; then
  $MKDIR -p /var/tmp/jaw_${VERSION}/conf
  $CP ${jaw_env_file} /var/tmp/jaw_${VERSION}/conf
  $RM -f ${jaw_env_file}
  $ECHO "File ${jaw_env_file} has been backed up to /var/tmp/jaw_${VERSION}/conf."
fi

# Happy End
exit $e_ok
