KYLIN-2781 make find-hadoop-conf-dir.sh executable

Signed-off-by: Li Yang <liy...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/1da269d5
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/1da269d5
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/1da269d5

Branch: refs/heads/2622-2764
Commit: 1da269d5912aed83eebb93a2e4429fd025321386
Parents: 2e4474e
Author: yanghao3 <yangh...@xiaomi.com>
Authored: Fri Sep 1 16:09:12 2017 +0800
Committer: Li Yang <liy...@apache.org>
Committed: Sun Sep 3 19:51:04 2017 +0800

----------------------------------------------------------------------
 build/bin/find-hadoop-conf-dir.sh | 106 +++++++++++++++++----------------
 1 file changed, 54 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/1da269d5/build/bin/find-hadoop-conf-dir.sh
----------------------------------------------------------------------
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

Reply via email to