minor, refactor package scripts abour download tomcat and spark
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/20c32942 Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/20c32942 Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/20c32942 Branch: refs/heads/master-cdh5.7 Commit: 20c329423f75df63bcc3d6dac7883fe12288f668 Parents: d19533c Author: lidongsjtu <lid...@apache.org> Authored: Sat Jan 14 16:19:59 2017 +0800 Committer: lidongsjtu <lid...@apache.org> Committed: Sat Jan 14 16:19:59 2017 +0800 ---------------------------------------------------------------------- build/script/download-spark.sh | 10 ++++-- build/script/download-tomcat.sh | 13 +++++--- build/script/functions.sh | 60 ------------------------------------ 3 files changed, 15 insertions(+), 68 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/20c32942/build/script/download-spark.sh ---------------------------------------------------------------------- diff --git a/build/script/download-spark.sh b/build/script/download-spark.sh index ad9651d..3ea7d08 100755 --- a/build/script/download-spark.sh +++ b/build/script/download-spark.sh @@ -20,10 +20,13 @@ dir=$(dirname ${0}) cd ${dir}/../.. -source build/script/functions.sh - rm -rf build/spark +alias md5cmd="md5sum" +if [[ `uname -a` =~ "Darwin" ]]; then + alias md5cmd="md5 -q" +fi + spark_version="1.6.3" spark_pkg_md5="ce8a2e7529aac0f0175194061769dbd4" @@ -32,7 +35,7 @@ then echo "no binary file found" wget --directory-prefix=build/ http://archive.apache.org/dist/spark/spark-${spark_version}/spark-${spark_version}-bin-hadoop2.6.tgz || echo "Download spark failed" else - if [ `calMd5 build/spark-${spark_version}-bin-hadoop2.6.tgz | awk '{print $1}'` != "${spark_pkg_md5}" ] + if [ `md5cmd build/spark-${spark_version}-bin-hadoop2.6.tgz | awk '{print $1}'` != "${spark_pkg_md5}" ] then echo "md5 check failed" rm build/spark-${spark_version}-bin-hadoop2.6.tgz @@ -40,6 +43,7 @@ else fi fi +unalias md5cmd tar -zxvf build/spark-${spark_version}-bin-hadoop2.6.tgz -C build/ || { exit 1; } mv build/spark-${spark_version}-bin-hadoop2.6 build/spark http://git-wip-us.apache.org/repos/asf/kylin/blob/20c32942/build/script/download-tomcat.sh ---------------------------------------------------------------------- diff --git a/build/script/download-tomcat.sh b/build/script/download-tomcat.sh index c97c3ce..403d87b 100755 --- a/build/script/download-tomcat.sh +++ b/build/script/download-tomcat.sh @@ -27,16 +27,19 @@ if [[ `uname -a` =~ "Darwin" ]]; then alias md5cmd="md5 -q" fi -if [ ! -f "build/apache-tomcat-8.5.9.tar.gz" ] +tomcat_pkg_version="8.5.9" +tomcat_pkg_md5="b41270a64b7774c964e4bec813eea2ed" + +if [ ! -f "build/apache-tomcat-${tomcat_pkg_version}.tar.gz" ] then echo "no binary file found" - wget --directory-prefix=build/ http://archive.apache.org/dist/tomcat/tomcat-8/v8.5.9/bin/apache-tomcat-8.5.9.tar.gz || echo "download tomcat failed" + wget --directory-prefix=build/ http://archive.apache.org/dist/tomcat/tomcat-8/v${tomcat_pkg_version}/bin/apache-tomcat-${tomcat_pkg_version}.tar.gz || echo "Download tomcat failed" else - if [ `md5cmd build/apache-tomcat-8.5.9.tar.gz | awk '{print $1}'` != "b41270a64b7774c964e4bec813eea2ed" ] + if [ `md5cmd build/apache-tomcat-${tomcat_pkg_version}.tar.gz | awk '{print $1}'` != "${tomcat_pkg_md5}" ] then echo "md5 check failed" - rm build/apache-tomcat-8.5.9.tar.gz - wget --directory-prefix=build/ http://archive.apache.org/dist/tomcat/tomcat-8/v8.5.9/bin/apache-tomcat-8.5.9.tar.g || echo "download tomcat failed" + rm build/apache-tomcat-${tomcat_pkg_version}.tar.gz + wget --directory-prefix=build/ http://archive.apache.org/dist/tomcat/tomcat-8/v${tomcat_pkg_version}/bin/apache-tomcat-${tomcat_pkg_version}.tar.gz || echo "download tomcat failed" fi fi unalias md5cmd http://git-wip-us.apache.org/repos/asf/kylin/blob/20c32942/build/script/functions.sh ---------------------------------------------------------------------- diff --git a/build/script/functions.sh b/build/script/functions.sh deleted file mode 100755 index 2eed617..0000000 --- a/build/script/functions.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -# -# 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. -# - -function checkCommandExits() { - echo "Checking ${1}..." - if [ -z "$(command -v ${1})" ] - then - echo "Please install ${1} first so that Kylin packaging can proceed" - exit 1 - else - echo "${1} check passed" - fi -} - -function exportProjectVersions() { - if [ -z "${kylin_versoin}" ]; then - export kylin_version=`mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version -f kylin | grep -Ev '(^\[|Download\w+:)'` - echo "Apache Kylin Version: ${kylin_version}" - fi - if [ -z "${release_version}" ]; then - export release_version=$kap_version - fi -} - -function detectOSType() { - OS_TYPE="linux" - if [[ `uname -a` =~ "Darwin" ]]; then - OS_TYPE="mac" - elif [[ `uname -a` =~ "Cygwin" ]]; then - OS_TYPE="windows" - fi - echo $OS_TYPE -} - -function calMd5() { - OS_TYPE=`detectOSType` - if [[ "$OS_TYPE" == "mac" ]]; then - md5 -q $1 - elif [[ "$OS_TYPE" == "windows" ]]; then - md5sum $1 - else - md5sum $1 - fi -} \ No newline at end of file