mirror of https://github.com/apache/druid.git
56 lines
1.6 KiB
Perl
Executable File
56 lines
1.6 KiB
Perl
Executable File
#!/usr/bin/env perl
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
# or more contributor license agreements. See the NOTICE file
|
|
# distributed with this work for additional information
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
# to you under the Apache License, Version 2.0 (the
|
|
# "License"); you may not use this file except in compliance
|
|
# with the License. You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing,
|
|
# software distributed under the License is distributed on an
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
# KIND, either express or implied. See the License for the
|
|
# specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
sub fail_check {
|
|
my ($current_version) = @_;
|
|
my $current_version_text = $current_version
|
|
? "Your current version is: $current_version."
|
|
: "Make sure that "java" is installed and on your PATH.";
|
|
|
|
print STDERR <<"EOT";
|
|
Druid requires Java 8. $current_version_text
|
|
|
|
If you believe this check is in error, you can skip it using an
|
|
environment variable:
|
|
|
|
export DRUID_SKIP_JAVA_CHECK=1
|
|
|
|
Otherwise, install Java 8 and try again.
|
|
EOT
|
|
exit 1;
|
|
}
|
|
|
|
my $skip_var = $ENV{'DRUID_SKIP_JAVA_CHECK'};
|
|
if ($skip_var && $skip_var ne "0" && $skip_var ne "false" && $skip_var ne "f") {
|
|
exit 0;
|
|
}
|
|
|
|
my $java_version = qx[java -version 2>&1];
|
|
if ($?) {
|
|
fail_check();
|
|
}
|
|
|
|
# If we know it won't work, die. Otherwise hope for the best.
|
|
if ($java_version =~ /version \"((\d+)\.(\d+).*?)\"/ && ($2 != 1 || $3 != 8)) {
|
|
fail_check($1);
|
|
}
|