makedeb.sh 2.9 KB
Newer Older
H
hzcheng 已提交
1 2 3
#!/bin/bash
#
# Generate deb package for ubuntu
S
slguan 已提交
4
# set -x
H
hzcheng 已提交
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

#curr_dir=$(pwd)
compile_dir=$1
output_dir=$2
tdengine_ver=$3

script_dir="$(dirname $(readlink -f $0))"
top_dir="$(readlink -m ${script_dir}/../..)"
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}

S
slguan 已提交
27
versioninfo=$(${script_dir}/../tools/get_version.sh ${script_dir}/../../src/util/src/version.c)
H
huili 已提交
28 29
libfile="libtaos.so.${versioninfo}"

H
hzcheng 已提交
30 31
# create install dir 
install_home_path="/usr/local/taos"
32
mkdir -p ${pkg_dir}${install_home_path}
H
hzcheng 已提交
33 34 35 36 37 38 39 40 41 42 43 44 45
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
46
cp ${compile_dir}/build/bin/taosdump                ${pkg_dir}${install_home_path}/bin
S
slguan 已提交
47
cp ${compile_dir}/build/bin/taosdemo                ${pkg_dir}${install_home_path}/bin
H
hzcheng 已提交
48 49
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 已提交
50
cp ${compile_dir}/build/lib/${libfile}              ${pkg_dir}${install_home_path}/driver 
H
hzcheng 已提交
51
cp ${compile_dir}/../src/inc/taos.h                 ${pkg_dir}${install_home_path}/include
L
lihui 已提交
52
cp ${compile_dir}/../src/inc/taoserror.h            ${pkg_dir}${install_home_path}/include
H
hzcheng 已提交
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
cp -r ${top_dir}/tests/examples/*                   ${pkg_dir}${install_home_path}/examples
cp -r ${top_dir}/src/connector/grafana              ${pkg_dir}${install_home_path}/connector
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
cp ${compile_dir}/build/lib/taos-jdbcdriver*dist.*  ${pkg_dir}${install_home_path}/connector

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
debname="tdengine-"${tdengine_ver}".deb"

# 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}