diff options
author | 2015-09-04 13:41:54 +0000 | |
---|---|---|
committer | 2015-09-04 14:10:12 +0000 | |
commit | 2984f1c6e96680de28e213aa769d9b24d74e759c (patch) | |
tree | 89d10749d6aadd64da36411f41b07644f3d3aeab /scripts | |
parent | 76f9a22f02bd5243f9c7fc05fd539fde29951642 (diff) |
Adds some safety checks in the Bazel installer
Without those check, a wrong call can wipe unwanted stuff
--
MOS_MIGRATED_REVID=102337203
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/packages/template_bin.sh | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/scripts/packages/template_bin.sh b/scripts/packages/template_bin.sh index 01e43bd0ba..2fb73bf3f0 100755 --- a/scripts/packages/template_bin.sh +++ b/scripts/packages/template_bin.sh @@ -127,7 +127,14 @@ test_write "${bazelrc}" # Do the actual installation echo -n "Uncompressing." -rm -fr "${bin}/bazel" "${base}" + +# Cleaning-up, with some guards. +if [ -f "${bin}/bazel" ]; then + rm -f "${bin}/bazel" +fi +if [ -d "${base}" && -x "${base}/bin/bazel" ]; then + rm -fr "${base}" +fi mkdir -p ${bin} ${base} ${base}/bin ${base}/etc ${base}/base_workspace echo -n . |