(The quotes in "$@" are important.)
Also, your script will fall over if any of the paths have spaces in them, such as INSTALLDIR.
You should use lowercase for variable names like SCRIPT_PATH. Uppercase is for exported variables.
readlink -f $0 breaks on OS X. You must do both readlink -f $0 and readlink $0 in order for it to work everywhere.
Shell scripting isn't easy. It took a year to understand these nuances to the point that they're second-nature, and I'm still discovering new ones. Anything that improves this situation would be a welcome change in my opinion.
EDIT: cat<<'EOF' is necessary here. cat<<"EOF" will interpolate variables.