# Copyright (c) 2005 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms
#
CONF_FILE=$PKG_INSTALL_ROOT/etc/imq/imqenv.conf

#
# This "JAVA_HOME" value is defined by Orion from a pkg response file.
# If JAVA_HOME is defined, then append to conf file.
# If JAVA_HOME is NOT defined and imqenv.conf file exists then 
# 	set IMQ_DEFAULT_JAVAHOME to nothing.
#
if [ "$JAVA_HOME" != "" ]; then
    if [ -f $CONF_FILE ]; then
        echo "IMQ_DEFAULT_JAVAHOME=$JAVA_HOME" >> $CONF_FILE
    else
        echo "IMQ_DEFAULT_JAVAHOME=$JAVA_HOME" > $CONF_FILE
	/usr/bin/chmod 644 $CONF_FILE
  	/usr/sbin/installf $INSTALL_ARGS $PKGINST $CONF_FILE e
	/usr/sbin/installf $INSTALL_ARGS -f $PKGINST || exit 2
    fi
fi;

exit 0
