|
| 1 | +#!/usr/bin/env bash |
| 2 | +# Copyright (c) 2017, Baidu.com, Inc. All Rights Reserved |
| 3 | + |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, |
| 11 | +# software distributed under the License is distributed on an |
| 12 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 13 | +# KIND, either express or implied. See the License for the |
| 14 | +# specific language governing permissions and limitations |
| 15 | +# under the License. |
| 16 | + |
| 17 | +# check DORIS_HOME |
| 18 | +if [[ -z ${DORIS_HOME} ]]; then |
| 19 | + echo "Error: DORIS_HOME is not set" |
| 20 | + exit 1 |
| 21 | +fi |
| 22 | + |
| 23 | +# include custom environment variables |
| 24 | +if [[ -f ${DORIS_HOME}/custom_env.sh ]]; then |
| 25 | + source ${DORIS_HOME}/custom_env.sh |
| 26 | +fi |
| 27 | + |
| 28 | +# check java version |
| 29 | +if [ -z ${JAVA_HOME} ]; then |
| 30 | + echo "Error: JAVA_HOME is not set, use thirdparty/installed/jdk1.8.0_131" |
| 31 | + export JAVA_HOME=${DORIS_HOME}/thirdparty/installed/jdk1.8.0_131 |
| 32 | +fi |
| 33 | + |
| 34 | +export JAVA=${JAVA_HOME}/bin/java |
| 35 | +JAVA_VER=$(${JAVA} -version 2>&1 | sed 's/.* version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q' | cut -f1 -d " ") |
| 36 | +if [ $JAVA_VER -lt 18 ]; then |
| 37 | + echo "Error: require JAVA with JDK version at least 1.8" |
| 38 | + exit 1 |
| 39 | +fi |
| 40 | + |
| 41 | +# check maven |
| 42 | +export MVN=mvn |
| 43 | +if ! ${MVN} --version; then |
| 44 | + echo "Error: mvn is not found" |
| 45 | + exit 1 |
| 46 | +fi |
| 47 | + |
| 48 | +# check python |
| 49 | +export PYTHON=python |
| 50 | +if ! ${PYTHON} --version; then |
| 51 | + export PYTHON=python2.7 |
| 52 | + if ! ${PYTHON} --version; then |
| 53 | + echo "Error: python is not found" |
| 54 | + exit |
| 55 | + fi |
| 56 | +fi |
| 57 | + |
| 58 | +# set DORIS_THIRDPARTY |
| 59 | +if [ -z ${DORIS_THIRDPARTY} ]; then |
| 60 | + export DORIS_THIRDPARTY=${DORIS_HOME}/thirdparty |
| 61 | +fi |
| 62 | + |
0 commit comments