#!/bin/sh
#
#ident "@(#)preinstall   1.5     99/09/26 SMI"
#
# Copyright (c) 1994,1999 by Sun Microsystems, Inc.
#

#
# we assume:
#
# $CLIENT_BASEDIR	set to $BASEDIR with $PKG_INSTALL_ROOT stripped off
#

#echo "begin with the $0 script"
eval=0

seterr() {
	if [ "$1" -gt "$eval" ]; then
		eval=$1
	fi
}

errout() {
	seterr $1
	#echo "done with the $0 script, exiting with $eval"
	exit $eval
}

#
trap 'echo "$0: Caught Signal"; errout 3' 1 2 3

# warn if we're not installing in /
if [ ! "$CLIENT_BASEDIR" ]; then
	CLIENT_BASEDIR=$BASEDIR
fi
#echo "\$CLIENT_BASEDIR = $CLIENT_BASEDIR"
if [ "$CLIENT_BASEDIR" != "/" ]; then
	echo "WARNING: \$CLIENT_BASEDIR '$CLIENT_BASEDIR' != /"
	seterr 2
fi

#
# copy toolmenu registry file to a safe place
#

if [ "$COPY_CONFIG" = "true" ]; then
	cp ${PKG_INSTALL_ROOT}/usr/opt/SUNWmd/lib/locale/ja/metatool-toolsmenu ${PKGSAV}/metatool-toolsmenu
	cp ${PKG_INSTALL_ROOT}/usr/opt/SUNWmd/lib/X11/ja/app-defaults/Metatool ${PKGSAV}/Metatool
fi

errout 0
