From d7db8a34b60791780764963d1cb69285586f06dd Mon Sep 17 00:00:00 2001 From: yanghao3 Date: Fri, 1 Sep 2017 16:09:12 +0800 Subject: [PATCH] patch --- build/bin/find-hadoop-conf-dir.sh | 106 +++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 52 deletions(-) diff --git a/build/bin/find-hadoop-conf-dir.sh b/build/bin/find-hadoop-conf-dir.sh index 403bc97..f5658ce 100755 --- a/build/bin/find-hadoop-conf-dir.sh +++ b/build/bin/find-hadoop-conf-dir.sh @@ -21,57 +21,59 @@ source $(cd -P -- "$(dirname -- "$0")" && pwd -P)/header.sh echo Retrieving hadoop conf dir... -override_hadoop_conf_dir=`bash ${KYLIN_HOME}/bin/get-properties.sh kylin.env.hadoop-conf-dir` - -if [ -n "$override_hadoop_conf_dir" ]; then - verbose "kylin_hadoop_conf_dir is override as $override_hadoop_conf_dir" - export kylin_hadoop_conf_dir=${override_hadoop_conf_dir} - return -fi - -hbase_classpath=`hbase classpath` - -arr=(`echo $hbase_classpath | cut -d ":" -f 1- | sed 's/:/ /g'`) -kylin_hadoop_conf_dir= - -for data in ${arr[@]} -do - result=`echo $data | grep -v -E ".*jar"` - if [ $result ] - then - valid_conf_dir=true - - if [ ! -f $result/yarn-site.xml ] - then - verbose "$result is not valid hadoop dir conf because yarn-site.xml is missing" - valid_conf_dir=false - continue - fi - - if [ ! -f $result/mapred-site.xml ] - then - verbose "$result is not valid hadoop dir conf because mapred-site.xml is missing" - valid_conf_dir=false - continue - fi - - if [ ! -f $result/hdfs-site.xml ] - then - verbose "$result is not valid hadoop dir conf because hdfs-site.xml is missing" - valid_conf_dir=false - continue - fi - - if [ ! -f $result/core-site.xml ] - then - verbose "$result is not valid hadoop dir conf because core-site.xml is missing" - valid_conf_dir=false - continue - fi - - verbose "kylin_hadoop_conf_dir is $result" - export kylin_hadoop_conf_dir=$result +function find_hadoop_conf_dir() { + override_hadoop_conf_dir=`bash ${KYLIN_HOME}/bin/get-properties.sh kylin.env.hadoop-conf-dir` + + if [ -n "$override_hadoop_conf_dir" ]; then + verbose "kylin_hadoop_conf_dir is override as $override_hadoop_conf_dir" + export kylin_hadoop_conf_dir=${override_hadoop_conf_dir} return fi -done - + + hbase_classpath=`hbase classpath` + + arr=(`echo $hbase_classpath | cut -d ":" -f 1- | sed 's/:/ /g'`) + kylin_hadoop_conf_dir= + + for data in ${arr[@]} + do + result=`echo $data | grep -v -E ".*jar"` + if [ $result ] + then + valid_conf_dir=true + + if [ ! -f $result/yarn-site.xml ] + then + verbose "$result is not valid hadoop dir conf because yarn-site.xml is missing" + valid_conf_dir=false + continue + fi + + if [ ! -f $result/mapred-site.xml ] + then + verbose "$result is not valid hadoop dir conf because mapred-site.xml is missing" + valid_conf_dir=false + continue + fi + + if [ ! -f $result/hdfs-site.xml ] + then + verbose "$result is not valid hadoop dir conf because hdfs-site.xml is missing" + valid_conf_dir=false + continue + fi + + if [ ! -f $result/core-site.xml ] + then + verbose "$result is not valid hadoop dir conf because core-site.xml is missing" + valid_conf_dir=false + continue + fi + + verbose "kylin_hadoop_conf_dir is $result" + export kylin_hadoop_conf_dir=$result + return + fi + done +} +find_hadoop_conf_dir \ No newline at end of file -- 1.9.1