defineInstallerType(){
	if [ -e "$ADDON_TAR" ]; then
		TYPE_SUFFIX="/Add-On Component"
	elif [ -e "$UPGRADE_TAR" ]; then
		TYPE_SUFFIX="/Upgrader"
	else
		TYPE_SUFFIX=""
	fi
	
	if [ -e "$FCNSBUS_TAR" ]; then
		INSTALL_FCNS=1
		THIS_INSTALLER_TYPE="installer"
	elif [ -e "$FCNSEDU_TAR" ]; then
		INSTALL_FCNS=1
		THIS_INSTALLER_TYPE="installer"
	elif [ -e "$FCNSARCH_TAR" ]; then
		INSTALL_FCNS=1
		THIS_INSTALLER_TYPE="installer"
	elif [ -e "$FCNSOTSM_TAR" ]; then
			INSTALL_FCNS=1
			THIS_INSTALLER_TYPE="installer"
	else
		INSTALL_FCNS=0
		THIS_INSTALLER_TYPE="upgrade"
	fi
}

create_temp_folder()
{

	if [ "$_FC_PLATFORM" != "Mac OS X" ]; then
		mkdir -p "$MY_TEMP_FILES"
	else
		sudo mkdir -p "$MY_TEMP_FILES"
		sudo chown "$MY_USER:$MY_GROUP" "$MY_TEMP_FILES"
		sudo chmod 770 "$MY_TEMP_FILES"
		sudo rm -rf "$MY_TEMP_FILES/"*
	fi
	
	if [ ! -d "$MY_TEMP_FILES" ] ; then
	    echo "ERROR: Failed to create temp folder: $MY_TEMP_FILES"
	    cleanup
	    exit 1
	fi
}

upgrade_folder()
{
    # Move fresh install-only files if not overwriting (use mv for that).
    if [ "$2" != "." ] ; then
        mkdir -p "$1/$2"
    fi
    if [ ! -d "$1/$TEMP_INST" ] ; then
	echo "Missing folder: \"$1/$TEMP_INST\""
        cleanup
        exit 1
    fi
    for pn in "$1/$TEMP_INST/$2"/* ; do
	fn="`basename \"$pn\"`"
	if [ -f "$pn" ] ; then
            if [ ! -f "$1/$fn" ] ; then
#		echo "mv \"$pn\" \"$1/$2/$fn\""
                mv "$pn" "$1/$2/"
            fi
        fi
    done
    if [ "$2" != "." ] ; then
#	echo "rm -rf \"$1/$TEMP_INST/$2\" "
        rm -rf "$1/$TEMP_INST/$2"
    fi
}

