restore upstream build.sh changes