makedeb.sh 5.9 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
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
27
    rm -rf ${pkg_dir}
H
hzcheng 已提交
28 29 30 31
fi
mkdir -p ${pkg_dir}
cd ${pkg_dir}

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

34
# create install dir
H
hzcheng 已提交
35
install_home_path="/usr/local/taos"
36
mkdir -p ${pkg_dir}${install_home_path}
H
hzcheng 已提交
37 38
mkdir -p ${pkg_dir}${install_home_path}/bin
mkdir -p ${pkg_dir}${install_home_path}/cfg
39
#mkdir -p ${pkg_dir}${install_home_path}/connector
H
hzcheng 已提交
40 41 42
mkdir -p ${pkg_dir}${install_home_path}/driver
mkdir -p ${pkg_dir}${install_home_path}/examples
mkdir -p ${pkg_dir}${install_home_path}/include
43
#mkdir -p ${pkg_dir}${install_home_path}/init.d
H
hzcheng 已提交
44
mkdir -p ${pkg_dir}${install_home_path}/script
45

H
hzcheng 已提交
46
cp ${compile_dir}/../packaging/cfg/taos.cfg         ${pkg_dir}${install_home_path}/cfg
47
if [ -f "${compile_dir}/test/cfg/taosadapter.toml" ]; then
48
    cp ${compile_dir}/test/cfg/taosadapter.toml		${pkg_dir}${install_home_path}/cfg || :
49
fi
50
if [ -f "${compile_dir}/test/cfg/taosadapter.service" ]; then
51
    cp ${compile_dir}/test/cfg/taosadapter.service	${pkg_dir}${install_home_path}/cfg || :
52
fi
53

54
#cp ${compile_dir}/../packaging/deb/taosd            ${pkg_dir}${install_home_path}/init.d
H
hzcheng 已提交
55 56
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
57 58 59
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
60

H
hzcheng 已提交
61
cp ${compile_dir}/build/bin/taosd                   ${pkg_dir}${install_home_path}/bin
62
cp ${compile_dir}/build/bin/taosBenchmark           ${pkg_dir}${install_home_path}/bin
63

64 65
if [ -f "${compile_dir}/build/bin/taosadapter" ]; then
    cp ${compile_dir}/build/bin/taosadapter                    ${pkg_dir}${install_home_path}/bin ||:
66 67
fi

H
hzcheng 已提交
68
cp ${compile_dir}/build/bin/taos                    ${pkg_dir}${install_home_path}/bin
69
cp ${compile_dir}/build/lib/${libfile}              ${pkg_dir}${install_home_path}/driver
H
hzcheng 已提交
70
cp ${compile_dir}/../src/inc/taos.h                 ${pkg_dir}${install_home_path}/include
71
cp ${compile_dir}/../src/inc/taosdef.h              ${pkg_dir}${install_home_path}/include
L
lihui 已提交
72
cp ${compile_dir}/../src/inc/taoserror.h            ${pkg_dir}${install_home_path}/include
73
cp -r ${top_dir}/examples/*                         ${pkg_dir}${install_home_path}/examples
74 75 76 77
#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 -r ${top_dir}/src/connector/nodejs               ${pkg_dir}${install_home_path}/connector
#cp ${compile_dir}/build/lib/taos-jdbcdriver*.*  ${pkg_dir}${install_home_path}/connector ||:
78

79 80
install_user_local_path="/usr/local"

81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
if [ -f ${compile_dir}/build/bin/jemalloc-config ]; then
    mkdir -p ${pkg_dir}${install_user_local_path}/{bin,lib,lib/pkgconfig,include/jemalloc,share/doc/jemalloc,share/man/man3}
    cp ${compile_dir}/build/bin/jemalloc-config ${pkg_dir}${install_user_local_path}/bin/
    if [ -f ${compile_dir}/build/bin/jemalloc.sh ]; then
        cp ${compile_dir}/build/bin/jemalloc.sh ${pkg_dir}${install_user_local_path}/bin/
    fi
    if [ -f ${compile_dir}/build/bin/jeprof ]; then
        cp ${compile_dir}/build/bin/jeprof ${pkg_dir}${install_user_local_path}/bin/
    fi
    if [ -f ${compile_dir}/build/include/jemalloc/jemalloc.h ]; then
        cp ${compile_dir}/build/include/jemalloc/jemalloc.h ${pkg_dir}${install_user_local_path}/include/jemalloc/
    fi
    if [ -f ${compile_dir}/build/lib/libjemalloc.so.2 ]; then
        cp ${compile_dir}/build/lib/libjemalloc.so.2 ${pkg_dir}${install_user_local_path}/lib/
        ln -sf libjemalloc.so.2 ${pkg_dir}${install_user_local_path}/lib/libjemalloc.so
    fi
    if [ -f ${compile_dir}/build/lib/libjemalloc.a ]; then
        cp ${compile_dir}/build/lib/libjemalloc.a ${pkg_dir}${install_user_local_path}/lib/
    fi
    if [ -f ${compile_dir}/build/lib/libjemalloc_pic.a ]; then
        cp ${compile_dir}/build/lib/libjemalloc_pic.a ${pkg_dir}${install_user_local_path}/lib/
    fi
    if [ -f ${compile_dir}/build/lib/pkgconfig/jemalloc.pc ]; then
        cp ${compile_dir}/build/lib/pkgconfig/jemalloc.pc ${pkg_dir}${install_user_local_path}/lib/pkgconfig/
    fi
    if [ -f ${compile_dir}/build/share/doc/jemalloc/jemalloc.html ]; then
        cp ${compile_dir}/build/share/doc/jemalloc/jemalloc.html ${pkg_dir}${install_user_local_path}/share/doc/jemalloc/
    fi
    if [ -f ${compile_dir}/build/share/man/man3/jemalloc.3 ]; then
        cp ${compile_dir}/build/share/man/man3/jemalloc.3 ${pkg_dir}${install_user_local_path}/share/man/man3/
    fi
fi
H
hzcheng 已提交
113 114 115 116 117 118 119

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
120

H
hzcheng 已提交
121
#get taos version, then set deb name
L
lihui 已提交
122 123
if [ "$verMode" == "cluster" ]; then
  debname="TDengine-server-"${tdengine_ver}-${osType}-${cpuType}
L
lihui 已提交
124
elif [ "$verMode" == "edge" ]; then
L
lihui 已提交
125
  debname="TDengine-server"-${tdengine_ver}-${osType}-${cpuType}
L
lihui 已提交
126
else
L
lihui 已提交
127
  echo "unknow verMode, nor cluster or edge"
L
lihui 已提交
128 129 130 131
  exit 1
fi

if [ "$verType" == "beta" ]; then
132
  debname="TDengine-server-"${tdengine_ver}-${verType}-${osType}-${cpuType}".deb"
133
elif [ "$verType" == "stable" ]; then
L
lihui 已提交
134
  debname=${debname}".deb"
L
lihui 已提交
135
else
L
lihui 已提交
136 137
  echo "unknow verType, nor stabel or beta"
  exit 1
L
lihui 已提交
138
fi
H
hzcheng 已提交
139 140 141 142 143

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

144
cp ${pkg_dir}/*.deb ${output_dir}
H
hzcheng 已提交
145

146
# clean temp dir
H
hzcheng 已提交
147
rm -rf ${pkg_dir}