aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Allen <[email protected]>2017-02-05 13:35:36 -0600
committerGitHub <[email protected]>2017-02-05 13:35:36 -0600
commit3d4a9c00b500847b32b264c16346ba0124badeb4 (patch)
tree83512c0e691b3d6f9c4266f8a2b0766985db95fe
parentce40df8d8a2a7ac26fec739efcf581ae2f0ad780 (diff)
parent3647703c4fd9079475c5ac5661c5b98f43ac2a27 (diff)
downloadkerl-3d4a9c00b500847b32b264c16346ba0124badeb4.tar.gz
kerl-3d4a9c00b500847b32b264c16346ba0124badeb4.tar.bz2
kerl-3d4a9c00b500847b32b264c16346ba0124badeb4.zip
Merge pull request #176 from kerl/gh170
Assert perl exists before builds (#170)
-rwxr-xr-xkerl28
1 files changed, 25 insertions, 3 deletions
diff --git a/kerl b/kerl
index ed6f0ec..090021d 100755
--- a/kerl
+++ b/kerl
@@ -390,13 +390,35 @@ get_otp_version()
get_perl_version()
{
- perl -v | grep version | sed $SED_OPT -e 's/.*v5\.([0-9]+)\.[0-9].*/\1/'
+ if assert_perl; then
+ perl -v | grep version | sed $SED_OPT -e 's/.*v5\.([0-9]+)\.[0-9].*/\1/'
+ else
+ echo "FATAL: I couldn't find perl which is required to compile Erlang."
+ exit 1
+ fi
+}
+
+assert_perl()
+{
+ perl_loc=$(which perl)
+ if [ -z "$perl_loc" ]; then
+ return 1
+ else
+ # 0 to bash is "true" because of Unix exit code conventions
+ return 0
+ fi
}
get_javac_version()
{
- javaout=$(javac -version 2>&1)
- echo "$javaout" | cut -d' ' -f2 | cut -d'.' -f2
+ java_loc=$(which javac)
+ if [ -z "$java_loc" ]; then
+ # Java's not installed, so just return 0
+ 0
+ else
+ javaout=$(javac -version 2>&1)
+ echo "$javaout" | cut -d' ' -f2 | cut -d'.' -f2
+ fi
}
show_configuration_warnings()