#! /bin/sh -x
#
#
cancel=0
# preflight for Max 6.0
if [ ! -d  "/Applications/Max6" ] ; then
		osascript $1/Contents/Resources/StopInst60.scpt
		exit 1
# in DIPS551.pkg
	else
		if [ -d "/Applications/Max6/DIPS5" ] ; then
			echo "run warning6"
			cancel=`osascript $1/Contents/Resources/DeleteDIPS5first.scpt >&1`
			echo $cancel
			if [ $cancel -eq 1 ]; then
# clean archives
				if [ -f "$1/../dips551.pkg/Contents/Archive.pax.gz" ]; then
				rm -f $1/../dips551.pkg/Contents/Archive.pax.gz
				fi
				if [ -f "$1/../dips560.pkg/Contents/Archive.pax.gz" ]; then
				rm -f $1/../dips560.pkg/Contents/Archive.pax.gz
				fi
				if [ -f "$1/../dips561.pkg/Contents/Archive.pax.gz" ]; then
				rm -f $1/../dips561.pkg/Contents/Archive.pax.gz
				fi
				exit 1
			fi
		fi
fi

exit $cancel

	