release.sh 2.0 KB
Newer Older
1 2
set -e

B
Bomin Zhang 已提交
3
# releash.sh  -c [armv6l | arm64 | amd64 | 386] 
4 5 6
#             -o [linux | darwin | windows]  

# set parameters by default value
B
Bomin Zhang 已提交
7
cpuType=amd64    # [armv6l | arm64 | amd64 | 386]
8
osType=linux   # [linux | darwin | windows]
H
Hui Li 已提交
9
version=""
Z
zyyang-taosdata 已提交
10
verType=stable   # [stable, beta]
B
Bomin Zhang 已提交
11
declare -A archMap=(["armv6l"]="arm" ["arm64"]="arm64" ["amd64"]="x64" ["386"]="x86")
Z
zyyang-taosdata 已提交
12
while getopts "h:c:o:n:V:" arg
13 14 15 16 17 18 19 20 21 22
do
  case $arg in
    c)
      #echo "cpuType=$OPTARG"
      cpuType=$(echo $OPTARG)
      ;;
    o)
      #echo "osType=$OPTARG"
      osType=$(echo $OPTARG)
      ;;
H
Hui Li 已提交
23 24 25 26
    n)
      #echo "version=$OPTARG"
      version=$(echo $OPTARG)
      ;;
Z
zyyang-taosdata 已提交
27 28 29 30
     V)
      #echo "verType=$OPTARG"
      verType=$(echo $OPTARG)
      ;;
31
    h)
B
Bomin Zhang 已提交
32
      echo "Usage: `basename $0` -c [armv6l | arm64 | amd64 | 386] -o [linux | darwin | windows]"
33 34 35 36 37 38 39 40 41
      exit 0
      ;;
    ?) #unknown option 
      echo "unknown argument"
      exit 1
      ;;
  esac
done

H
Hui Li 已提交
42 43 44 45
if [ "$version" == "" ]; then 
  echo "Please input the correct version!"
  exit 1
fi
46 47 48 49 50 51 52 53 54

startdir=$(pwd)
scriptdir=$(dirname $(readlink -f $0))
cd ${scriptdir}/cmd/alert

echo "cpuType=${cpuType}"
echo "osType=${osType}"
echo "version=${version}"

H
Hui Li 已提交
55 56 57 58 59 60 61 62
GOOS=${osType} GOARCH=${cpuType} go build -ldflags '-X main.version='${version}

mkdir -p TDengine-alert/driver

cp alert alert.cfg install_driver.sh ./TDengine-alert/.
cp ../../../debug/build/lib/libtaos.so.${version} ./TDengine-alert/driver/.
chmod 777 ./TDengine-alert/install_driver.sh

Z
zyyang-taosdata 已提交
63
tar -I 'gzip -9' -cf ${scriptdir}/TDengine-alert-${version}-${osType^}-${archMap[${cpuType}]}.tar.gz TDengine-alert/
H
Hui Li 已提交
64
rm -rf ./TDengine-alert
65

Z
zyyang-taosdata 已提交
66 67 68 69 70 71


# mv package to comminuty/release/
pkg_name=TDengine-alert-${version}-${osType^}-${archMap[${cpuType}]}

if [ "$verType" == "beta" ]; then
72
  pkg_name=TDengine-alert-${version}-${verType}-${osType^}-${archMap[${cpuType}]}
Z
zyyang-taosdata 已提交
73 74 75 76 77 78 79 80 81
elif [ "$verType" == "stable" ]; then
  pkg_name=${pkg_name}
else
  echo "unknow verType, nor stabel or beta"
  exit 1
fi

cd ${scriptdir}/../release/
mv ${scriptdir}/TDengine-alert-${version}-${osType^}-${archMap[${cpuType}]}.tar.gz  ${pkg_name}.tar.gz