makearbi.sh 2.0 KB
Newer Older
H
Hui Li 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#!/bin/bash
#
# Generate arbitrator's tar.gz setup package for all os system

set -e
#set -x

curr_dir=$(pwd)
compile_dir=$1
version=$2
build_time=$3
cpuType=$4
osType=$5
verMode=$6
verType=$7
pagMode=$8

script_dir="$(dirname $(readlink -f $0))"
top_dir="$(readlink -f ${script_dir}/../..)"

Z
change  
zyyang 已提交
21 22
productName="TDengine"

H
Hui Li 已提交
23 24 25 26 27 28 29
# create compressed install file.
build_dir="${compile_dir}/build"
code_dir="${top_dir}/src"
release_dir="${top_dir}/release"

#package_name='linux'
if [ "$verMode" == "cluster" ]; then
Z
change  
zyyang 已提交
30
    install_dir="${release_dir}/${productName}-enterprise-arbitrator-${version}"
H
Hui Li 已提交
31
else
Z
change  
zyyang 已提交
32
    install_dir="${release_dir}/${productName}-arbitrator-${version}"
H
Hui Li 已提交
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
fi

# Directories and files.
bin_files="${build_dir}/bin/tarbitrator ${script_dir}/remove_arbi.sh"
install_files="${script_dir}/install_arbi.sh"

init_file_tarbitrator_deb=${script_dir}/../deb/tarbitratord
init_file_tarbitrator_rpm=${script_dir}/../rpm/tarbitratord

# make directories.
mkdir -p ${install_dir} && cp ${install_files} ${install_dir} && chmod a+x ${install_dir}/install_arbi.sh || :
mkdir -p ${install_dir}/bin && cp ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/* || :
mkdir -p ${install_dir}/init.d && cp ${init_file_tarbitrator_deb} ${install_dir}/init.d/tarbitratord.deb || :
mkdir -p ${install_dir}/init.d && cp ${init_file_tarbitrator_rpm} ${install_dir}/init.d/tarbitratord.rpm || :

cd ${release_dir} 

50 51 52
#  install_dir has been distinguishes  cluster from  edege, so comments this code
pkg_name=${install_dir}-${osType}-${cpuType}

haoranc's avatar
haoranc 已提交
53
if [[ "$verType" == "beta" ]] || [[ "$verType" == "preRelease" ]]; then
54 55 56
  pkg_name=${install_dir}-${verType}-${osType}-${cpuType} 
elif [ "$verType" == "stable" ]; then
  pkg_name=${pkg_name}
H
Hui Li 已提交
57 58 59 60 61 62 63 64 65 66 67 68 69
else
  echo "unknow verType, nor stabel or beta"
  exit 1
fi

tar -zcv -f "$(basename ${pkg_name}).tar.gz" $(basename ${install_dir}) --remove-files || :
exitcode=$?
if [ "$exitcode" != "0" ]; then
    echo "tar ${pkg_name}.tar.gz error !!!"
    exit $exitcode
fi

cd ${curr_dir}