makedeb.sh 3.8 KB
Newer Older
H
hzcheng 已提交
1 2 3
#!/bin/bash
#
# Generate deb package for ubuntu
L
lihui 已提交
4
set -e
S
slguan 已提交
5
# set -x
H
hzcheng 已提交
6 7 8 9 10

#curr_dir=$(pwd)
compile_dir=$1
output_dir=$2
tdengine_ver=$3
L
lihui 已提交
11 12 13 14
cpuType=$4
osType=$5
verMode=$6
verType=$7
H
hzcheng 已提交
15 16

script_dir="$(dirname $(readlink -f $0))"
F
Frozen 已提交
17
top_dir="$(readlink -f ${script_dir}/../..)"
H
hzcheng 已提交
18 19 20 21 22 23 24 25 26 27 28 29 30 31
pkg_dir="${top_dir}/debworkroom"

#echo "curr_dir: ${curr_dir}"
#echo "top_dir: ${top_dir}"
#echo "script_dir: ${script_dir}"
echo "compile_dir: ${compile_dir}"
echo "pkg_dir: ${pkg_dir}"

if [ -d ${pkg_dir} ]; then
	 rm -rf ${pkg_dir}
fi
mkdir -p ${pkg_dir}
cd ${pkg_dir}

L
lihui 已提交
32
libfile="libtaos.so.${tdengine_ver}"
H
huili 已提交
33

H
hzcheng 已提交
34 35
# create install dir 
install_home_path="/usr/local/taos"
36
mkdir -p ${pkg_dir}${install_home_path}
H
hzcheng 已提交
37 38 39 40 41 42 43 44 45 46 47 48 49
mkdir -p ${pkg_dir}${install_home_path}/bin
mkdir -p ${pkg_dir}${install_home_path}/cfg
mkdir -p ${pkg_dir}${install_home_path}/connector
mkdir -p ${pkg_dir}${install_home_path}/driver
mkdir -p ${pkg_dir}${install_home_path}/examples
mkdir -p ${pkg_dir}${install_home_path}/include
mkdir -p ${pkg_dir}${install_home_path}/init.d
mkdir -p ${pkg_dir}${install_home_path}/script
 
cp ${compile_dir}/../packaging/cfg/taos.cfg         ${pkg_dir}${install_home_path}/cfg
cp ${compile_dir}/../packaging/deb/taosd            ${pkg_dir}${install_home_path}/init.d
cp ${compile_dir}/../packaging/tools/post.sh        ${pkg_dir}${install_home_path}/script
cp ${compile_dir}/../packaging/tools/preun.sh       ${pkg_dir}${install_home_path}/script
50 51 52
cp ${compile_dir}/../packaging/tools/startPre.sh    ${pkg_dir}${install_home_path}/bin
cp ${compile_dir}/../packaging/tools/set_core.sh    ${pkg_dir}${install_home_path}/bin
cp ${compile_dir}/../packaging/tools/taosd-dump-cfg.gdb    ${pkg_dir}${install_home_path}/bin
S
slguan 已提交
53
cp ${compile_dir}/build/bin/taosdemo                ${pkg_dir}${install_home_path}/bin
54
cp ${compile_dir}/build/bin/taosdump                ${pkg_dir}${install_home_path}/bin
H
hzcheng 已提交
55 56
cp ${compile_dir}/build/bin/taosd                   ${pkg_dir}${install_home_path}/bin
cp ${compile_dir}/build/bin/taos                    ${pkg_dir}${install_home_path}/bin
H
huili 已提交
57
cp ${compile_dir}/build/lib/${libfile}              ${pkg_dir}${install_home_path}/driver 
H
hzcheng 已提交
58
cp ${compile_dir}/../src/inc/taos.h                 ${pkg_dir}${install_home_path}/include
L
lihui 已提交
59
cp ${compile_dir}/../src/inc/taoserror.h            ${pkg_dir}${install_home_path}/include
H
hzcheng 已提交
60
cp -r ${top_dir}/tests/examples/*                   ${pkg_dir}${install_home_path}/examples
Z
zyyang 已提交
61 62 63 64 65 66
if [ -d "${top_dir}/src/connector/grafanaplugin/dist" ]; then
  cp -r ${top_dir}/src/connector/grafanaplugin/dist   ${pkg_dir}${install_home_path}/connector/grafanaplugin
else
  echo "grafanaplugin bundled directory not found!"
  exit 1
fi
H
hzcheng 已提交
67 68
cp -r ${top_dir}/src/connector/python               ${pkg_dir}${install_home_path}/connector
cp -r ${top_dir}/src/connector/go                   ${pkg_dir}${install_home_path}/connector
H
Hui Li 已提交
69
cp -r ${top_dir}/src/connector/nodejs               ${pkg_dir}${install_home_path}/connector
P
plum-lihui 已提交
70
cp ${compile_dir}/build/lib/taos-jdbcdriver*dist.*  ${pkg_dir}${install_home_path}/connector ||:
H
hzcheng 已提交
71 72 73 74 75 76 77 78 79

cp -r ${compile_dir}/../packaging/deb/DEBIAN        ${pkg_dir}/
chmod 755 ${pkg_dir}/DEBIAN/*

# modify version of control
debver="Version: "$tdengine_ver
sed -i "2c$debver" ${pkg_dir}/DEBIAN/control
 
#get taos version, then set deb name
L
lihui 已提交
80 81 82 83


if [ "$verMode" == "cluster" ]; then
  debname="TDengine-server-"${tdengine_ver}-${osType}-${cpuType}
L
lihui 已提交
84
elif [ "$verMode" == "edge" ]; then
L
lihui 已提交
85
  debname="TDengine-server"-${tdengine_ver}-${osType}-${cpuType}
L
lihui 已提交
86
else
L
lihui 已提交
87
  echo "unknow verMode, nor cluster or edge"
L
lihui 已提交
88 89 90 91 92 93 94
  exit 1
fi

if [ "$verType" == "beta" ]; then
  debname=${debname}-${verType}".deb"
elif [ "$verType" == "stable" ]; then 
  debname=${debname}".deb"
L
lihui 已提交
95
else
L
lihui 已提交
96 97
  echo "unknow verType, nor stabel or beta"
  exit 1
L
lihui 已提交
98
fi
H
hzcheng 已提交
99 100 101 102 103 104 105 106 107 108

# make deb package
dpkg -b ${pkg_dir} $debname
echo "make deb package success!"

cp ${pkg_dir}/*.deb ${output_dir} 

# clean tmep dir
rm -rf ${pkg_dir}