diff options
author | Damien Martin-Guillerez <dmarting@google.com> | 2015-08-31 12:23:50 +0000 |
---|---|---|
committer | Kristina Chodorow <kchodorow@google.com> | 2015-08-31 19:13:42 +0000 |
commit | a1d93965eca2d7a7c1afca79a85d9e546f22096f (patch) | |
tree | 4bcf157970dc87c77d29c2a9e1cacbdaecbfcf38 /scripts/packages/template_bin.sh | |
parent | ea9a436b12f848edf47fabd391e2c50e87e08734 (diff) |
Add detections for installed JDK and unzip in the Bazel installer.
--
MOS_MIGRATED_REVID=101926016
Diffstat (limited to 'scripts/packages/template_bin.sh')
-rwxr-xr-x | scripts/packages/template_bin.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/packages/template_bin.sh b/scripts/packages/template_bin.sh index ea20044c30..9431ec6ecf 100755 --- a/scripts/packages/template_bin.sh +++ b/scripts/packages/template_bin.sh @@ -88,10 +88,44 @@ function test_write() { } } +# Test for dependencies +# unzip +if ! which unzip >/dev/null; then + echo >&2 + echo "unzip not found, please install the corresponding package." >&2 + echo "See http://bazel.io/docs/install.html for more information on" >&2 + echo "dependencies of Bazel." >&2 + exit 1 +fi + +# java +if [ -z "${JAVA_HOME-}" ]; then + case "$(uname -s | tr 'A-Z' 'a-z')" in + linux) + JAVA_HOME="$(readlink -f $(which javac) 2>/dev/null | sed 's_/bin/javac__')" || true + ;; + freebsd) + JAVA_HOME="/usr/local/openjdk8" + ;; + darwin) + JAVA_HOME="$(/usr/libexec/java_home -v ${JAVA_VERSION}+ 2> /dev/null)" || true + ;; + esac +fi +if [ ! -x "${JAVA_HOME}/bin/javac" ]; then + echo >&2 + echo "Java not found, please install the corresponding package" >&2 + echo "See http://bazel.io/docs/install.html for more information on" >&2 + echo "dependencies of Bazel." >&2 + exit 1 +fi + +# Test for write access test_write "${bin}" test_write "${base}" test_write "${bazelrc}" +# Do the actual installation echo -n "Uncompressing." rm -fr "${bin}" "${base}" "${bazelrc}" |