#!/bin/sh

if [ ! -f "${II2RESOURCES}/basename" ]
then
	echo "### I cannot upate myself because I am too old. Please use the II2.dmg available from the web. Bailing out..."
	exit 1
fi

PROGNAME=`"${II2RESOURCES}/basename" "$0"`

echo "### ${PROGNAME}: Started..."

if [ -f "${II2RESOURCES}/ii2shfuncs.sh" ]
then
	source "${II2RESOURCES}/ii2shfuncs.sh"
	ii2checksanity
else
	echo "### ${PROGNAME}: Cannot load ${II2RESOURCES}/ii2shfuncs.sh."
fi

# Just for certainty in cas ii2.ii2 is made before i-Installer.pkg is made
chown -R root:admin "${II2INSTALLDIR}/i-Installer.app"

if [ "${II2RESOURCES}" != "${II2INSTALLDIR}/i-Installer.app/Contents/Resources" ]
then
	papadir=`/usr/bin/dirname "${II2RESOURCES}"`
	papadir=`/usr/bin/dirname "${papadir}"`
	title="Different Location"
	msg="You have installed i_Installer in another location (${II2INSTALLDIR}) than the location of the i-Installer you are running now (${papadir}). The program you are running now has not been updated."
	"${II2RESOURCES}"/doalerter -s "${II2DOSERVER}" -V -t Alert -T "${title}" -I "${msg}." -1 "Accept"
fi

echo "### ${PROGNAME}: Finished."

exit 0

# $Id: libtiff.configure 60 2006-09-24 19:16:00Z gctwnl $
