Fix permissions before overwriting files

In our bazel-srcs tar ball, files are packed with permissions 550.
Copying into a temporary directory may preserve permissions. So,
when overwriting one of those files in the temporary directory,
grant the user write permissions before writing to that file. Otherwise,
bootstrapping from //:bazel-srcs via ./compile.sh as normal user
will fail on some systems.

--
Change-Id: I70b4645c9bc3c25b9fd356bacdb959205c64b931
Reviewed-on: https://bazel-review.googlesource.com/#/c/6695
MOS_MIGRATED_REVID=136360945
diff --git a/scripts/bootstrap/compile.sh b/scripts/bootstrap/compile.sh
index 123d050..d897a4b 100755
--- a/scripts/bootstrap/compile.sh
+++ b/scripts/bootstrap/compile.sh
@@ -201,6 +201,7 @@
   done
 
   # Overwrite tools.WORKSPACE, this is only for the bootstrap binary
+  chmod u+w "${OUTPUT_DIR}/classes/com/google/devtools/build/lib/bazel/rules/tools.WORKSPACE"
   cat <<EOF >${OUTPUT_DIR}/classes/com/google/devtools/build/lib/bazel/rules/tools.WORKSPACE
 local_repository(name = 'bazel_tools', path = __workspace_dir__)
 bind(name = "cc_toolchain", actual = "@bazel_tools//tools/cpp:default-toolchain")