Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ccfd17df
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1181
Star
22014
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ccfd17df
编写于
11月 22, 2019
作者:
L
lihui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[modify packging script]
上级
8742300c
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
611 addition
and
135 deletion
+611
-135
packaging/deb/DEBIAN/preinst
packaging/deb/DEBIAN/preinst
+4
-4
packaging/deb/DEBIAN/prerm
packaging/deb/DEBIAN/prerm
+3
-1
packaging/deb/makedeb.sh
packaging/deb/makedeb.sh
+1
-2
packaging/release.sh
packaging/release.sh
+21
-11
packaging/rpm/tdengine.spec
packaging/rpm/tdengine.spec
+8
-8
packaging/tools/install.sh
packaging/tools/install.sh
+95
-32
packaging/tools/install_client.sh
packaging/tools/install_client.sh
+198
-1
packaging/tools/makeclient.sh
packaging/tools/makeclient.sh
+79
-0
packaging/tools/makepkg.sh
packaging/tools/makepkg.sh
+26
-18
packaging/tools/post.sh
packaging/tools/post.sh
+41
-23
packaging/tools/preun.sh
packaging/tools/preun.sh
+29
-17
packaging/tools/remove.sh
packaging/tools/remove.sh
+31
-18
packaging/tools/remove_client.sh
packaging/tools/remove_client.sh
+75
-0
未找到文件。
packaging/deb/DEBIAN/preinst
浏览文件 @
ccfd17df
...
@@ -9,13 +9,13 @@ fi
...
@@ -9,13 +9,13 @@ fi
if
pidof taosd &> /dev/null
;
then
if
pidof taosd &> /dev/null
;
then
if
pidof systemd &> /dev/null
;
then
if
pidof systemd &> /dev/null
;
then
${
csudo
}
systemctl stop taosd
||
:
${
csudo
}
systemctl stop taosd
||
:
elif
$(
which insserv &> /dev/null
)
;
then
elif
$(
which service &> /dev/null
)
;
then
${
csudo
}
service taosd stop
||
:
elif
$(
which update-rc.d &> /dev/null
)
;
then
${
csudo
}
service taosd stop
||
:
${
csudo
}
service taosd stop
||
:
else
else
pid
=
$(
ps
-ef
|
grep
"taosd"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
pid
=
$(
ps
-ef
|
grep
"taosd"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
${
csudo
}
kill
-9
${
pid
}
||
:
if
[
-n
"
$pid
"
]
;
then
${
csudo
}
kill
-9
$pid
||
:
fi
fi
fi
echo
"Stop taosd service success!"
echo
"Stop taosd service success!"
sleep
1
sleep
1
...
...
packaging/deb/DEBIAN/prerm
浏览文件 @
ccfd17df
...
@@ -35,6 +35,8 @@ else
...
@@ -35,6 +35,8 @@ else
${
csudo
}
rm
-f
${
data_link_dir
}
||
:
${
csudo
}
rm
-f
${
data_link_dir
}
||
:
pid
=
$(
ps
-ef
|
grep
"taosd"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
pid
=
$(
ps
-ef
|
grep
"taosd"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
${
csudo
}
kill
-9
${
pid
}
||
:
if
[
-n
"
$pid
"
]
;
then
${
csudo
}
kill
-9
$pid
||
:
fi
fi
fi
packaging/deb/makedeb.sh
浏览文件 @
ccfd17df
...
@@ -24,8 +24,7 @@ fi
...
@@ -24,8 +24,7 @@ fi
mkdir
-p
${
pkg_dir
}
mkdir
-p
${
pkg_dir
}
cd
${
pkg_dir
}
cd
${
pkg_dir
}
versioninfo
=
$(
${
script_dir
}
/../tools/get_version.sh
${
script_dir
}
/../../src/util/src/version.c
)
libfile
=
"libtaos.so.
${
tdengine_ver
}
"
libfile
=
"libtaos.so.
${
versioninfo
}
"
# create install dir
# create install dir
install_home_path
=
"/usr/local/taos"
install_home_path
=
"/usr/local/taos"
...
...
packaging/release.sh
浏览文件 @
ccfd17df
...
@@ -3,7 +3,9 @@
...
@@ -3,7 +3,9 @@
# Generate the deb package for ubunt, or rpm package for centos, or tar.gz package for other linux os
# Generate the deb package for ubunt, or rpm package for centos, or tar.gz package for other linux os
set
-e
set
-e
#set -x
# set -x
armver
=
$1
curr_dir
=
$(
pwd
)
curr_dir
=
$(
pwd
)
script_dir
=
"
$(
dirname
$(
readlink
-f
$0
))
"
script_dir
=
"
$(
dirname
$(
readlink
-f
$0
))
"
...
@@ -110,21 +112,28 @@ echo "char gitinfo[128] = \"$(git rev-parse --verify HEAD)\";" >> ${versioninfo
...
@@ -110,21 +112,28 @@ echo "char gitinfo[128] = \"$(git rev-parse --verify HEAD)\";" >> ${versioninfo
echo
"char buildinfo[512] =
\"
Built by
${
USER
}
at
${
build_time
}
\"
;"
>>
${
versioninfo
}
echo
"char buildinfo[512] =
\"
Built by
${
USER
}
at
${
build_time
}
\"
;"
>>
${
versioninfo
}
# 2. cmake executable file
# 2. cmake executable file
#default use debug mode
compile_mode
=
"debug"
if
[[
$1
==
"Release"
]]
||
[[
$1
==
"release"
]]
;
then
compile_mode
=
"Release"
fi
compile_dir
=
"
${
top_dir
}
/
${
compile_mode
}
"
compile_dir
=
"
${
top_dir
}
/
debug
"
if
[
-d
${
compile_dir
}
]
;
then
if
[
-d
${
compile_dir
}
]
;
then
${
csudo
}
rm
-rf
${
compile_dir
}
${
csudo
}
rm
-rf
${
compile_dir
}
fi
fi
${
csudo
}
mkdir
-p
${
compile_dir
}
${
csudo
}
mkdir
-p
${
compile_dir
}
cd
${
compile_dir
}
cd
${
compile_dir
}
${
csudo
}
cmake
-DCMAKE_BUILD_TYPE
=
${
compile_mode
}
${
top_dir
}
${
csudo
}
make
# arm only support lite ver
if
[
-z
"
$armver
"
]
;
then
cmake
${
top_dir
}
/../
elif
[
"
$armver
"
==
"arm64"
]
;
then
cmake
${
top_dir
}
/../
-DVERSION
=
lite
-DARMVER
=
arm64
elif
[
"
$armver
"
==
"arm32"
]
;
then
cmake
${
top_dir
}
/../
-DVERSION
=
lite
-DARMVER
=
arm32
else
echo
"input parameter error!!!"
return
fi
make
cd
${
curr_dir
}
cd
${
curr_dir
}
...
@@ -153,7 +162,8 @@ ${csudo} ./makerpm.sh ${compile_dir} ${output_dir} ${version}
...
@@ -153,7 +162,8 @@ ${csudo} ./makerpm.sh ${compile_dir} ${output_dir} ${version}
echo
"do tar.gz package for all systems"
echo
"do tar.gz package for all systems"
cd
${
script_dir
}
/tools
cd
${
script_dir
}
/tools
${
csudo
}
./makepkg.sh
${
compile_dir
}
${
version
}
"
${
build_time
}
"
${
csudo
}
./makepkg.sh
${
compile_dir
}
${
version
}
"
${
build_time
}
"
${
armver
}
${
csudo
}
./makeclient.sh
${
compile_dir
}
${
version
}
"
${
build_time
}
"
${
armver
}
# 4. Clean up temporary compile directories
# 4. Clean up temporary compile directories
#${csudo} rm -rf ${compile_dir}
#${csudo} rm -rf ${compile_dir}
...
...
packaging/rpm/tdengine.spec
浏览文件 @
ccfd17df
...
@@ -39,8 +39,7 @@ echo topdir: %{_topdir}
...
@@ -39,8 +39,7 @@ echo topdir: %{_topdir}
echo version: %{_version}
echo version: %{_version}
echo buildroot: %{buildroot}
echo buildroot: %{buildroot}
versioninfo=$(%{_compiledir}/../packaging/tools/get_version.sh ../../src/util/src/version.c)
libfile="libtaos.so.%{_version}"
libfile="libtaos.so.${versioninfo}"
# create install path, and cp file
# create install path, and cp file
mkdir -p %{buildroot}%{homepath}/bin
mkdir -p %{buildroot}%{homepath}/bin
...
@@ -80,18 +79,17 @@ fi
...
@@ -80,18 +79,17 @@ fi
if pidof taosd &> /dev/null; then
if pidof taosd &> /dev/null; then
if pidof systemd &> /dev/null; then
if pidof systemd &> /dev/null; then
${csudo} systemctl stop taosd || :
${csudo} systemctl stop taosd || :
elif $(which insserv &> /dev/null); then
elif $(which service &> /dev/null); then
${csudo} service taosd stop || :
elif $(which update-rc.d &> /dev/null); then
${csudo} service taosd stop || :
${csudo} service taosd stop || :
else
else
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
${csudo} kill -9 ${pid} || :
if [ -n "$pid" ]; then
${csudo} kill -9 $pid || :
fi
fi
fi
echo "Stop taosd service success!"
echo "Stop taosd service success!"
sleep 1
sleep 1
fi
fi
# if taos.cfg already softlink, remove it
# if taos.cfg already softlink, remove it
if [ -f %{cfg_install_dir}/taos.cfg ]; then
if [ -f %{cfg_install_dir}/taos.cfg ]; then
${csudo} rm -f %{homepath}/cfg/taos.cfg || :
${csudo} rm -f %{homepath}/cfg/taos.cfg || :
...
@@ -146,7 +144,9 @@ if [ $1 -eq 0 ];then
...
@@ -146,7 +144,9 @@ if [ $1 -eq 0 ];then
${csudo} rm -f ${data_link_dir} || :
${csudo} rm -f ${data_link_dir} || :
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
${csudo} kill -9 ${pid} || :
if [ -n "$pid" ]; then
${csudo} kill -9 $pid || :
fi
fi
fi
fi
fi
...
...
packaging/tools/install.sh
浏览文件 @
ccfd17df
#!/bin/bash
#!/bin/bash
#
#
# This file is used to install
TAOS time-series database on linux systems. The operating system
# This file is used to install
database on linux systems. The operating system
# is required to use systemd to manage services at boot
# is required to use systemd to manage services at boot
set
-e
set
-e
...
@@ -41,19 +41,58 @@ if command -v sudo > /dev/null; then
...
@@ -41,19 +41,58 @@ if command -v sudo > /dev/null; then
csudo
=
"sudo"
csudo
=
"sudo"
fi
fi
initd_mod
=
0
service_mod
=
2
service_mod
=
2
if
pidof systemd &> /dev/null
;
then
if
pidof systemd &> /dev/null
;
then
service_mod
=
0
service_mod
=
0
elif
$(
which
update-rc.d &> /dev/null
)
;
then
elif
$(
which
service &> /dev/null
)
;
then
service_mod
=
1
service_mod
=
1
service_config_dir
=
"/etc/init.d"
service_config_dir
=
"/etc/init.d"
if
$(
which chkconfig &> /dev/null
)
;
then
initd_mod
=
1
elif
$(
which insserv &> /dev/null
)
;
then
initd_mod
=
2
elif
$(
which update-rc.d &> /dev/null
)
;
then
initd_mod
=
3
else
service_mod
=
2
fi
else
else
service_mod
=
2
service_mod
=
2
fi
fi
# get the operating system type for using the corresponding init file
# ubuntu/debian(deb), centos/fedora(rpm), others: opensuse, redhat, ..., no verification
#osinfo=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
osinfo
=
$(
cat
/etc/os-release |
grep
"NAME"
|
cut
-d
'"'
-f2
)
#echo "osinfo: ${osinfo}"
os_type
=
0
if
echo
$osinfo
|
grep
-qwi
"ubuntu"
;
then
echo
"this is ubuntu system"
os_type
=
1
elif
echo
$osinfo
|
grep
-qwi
"debian"
;
then
echo
"this is debian system"
os_type
=
1
elif
echo
$osinfo
|
grep
-qwi
"Kylin"
;
then
echo
"this is Kylin system"
os_type
=
1
elif
echo
$osinfo
|
grep
-qwi
"centos"
;
then
echo
"this is centos system"
os_type
=
2
elif
echo
$osinfo
|
grep
-qwi
"fedora"
;
then
echo
"this is fedora system"
os_type
=
2
else
echo
"this is other linux system"
os_type
=
0
fi
function
kill_taosd
()
{
function
kill_taosd
()
{
pid
=
$(
ps
-ef
|
grep
"taosd"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
pid
=
$(
ps
-ef
|
grep
"taosd"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
${
csudo
}
kill
-9
pid
||
:
if
[
-n
"
$pid
"
]
;
then
${
csudo
}
kill
-9
$pid
||
:
fi
}
}
function
install_main_path
()
{
function
install_main_path
()
{
...
@@ -81,7 +120,7 @@ function install_bin() {
...
@@ -81,7 +120,7 @@ function install_bin() {
#Make link
#Make link
[
-x
${
install_main_dir
}
/bin/taos
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taos
${
bin_link_dir
}
/taos
||
:
[
-x
${
install_main_dir
}
/bin/taos
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taos
${
bin_link_dir
}
/taos
||
:
[
-x
${
install_main_dir
}
/bin/taosd
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taosd
${
bin_link_dir
}
/taosd
||
:
[
-x
${
install_main_dir
}
/bin/taosd
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taosd
${
bin_link_dir
}
/taosd
||
:
[
-x
${
install_main_dir
}
/bin/taosdump
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taosdump
${
bin_link_dir
}
/taosdump
||
:
[
-x
${
install_main_dir
}
/bin/taosdump
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taosdump
${
bin_link_dir
}
/taosdump
||
:
[
-x
${
install_main_dir
}
/bin/taosdemo
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taosdemo
${
bin_link_dir
}
/taosdemo
||
:
[
-x
${
install_main_dir
}
/bin/taosdemo
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taosdemo
${
bin_link_dir
}
/taosdemo
||
:
[
-x
${
install_main_dir
}
/bin/remove.sh
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/remove.sh
${
bin_link_dir
}
/rmtaos
||
:
[
-x
${
install_main_dir
}
/bin/remove.sh
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/remove.sh
${
bin_link_dir
}
/rmtaos
||
:
...
@@ -89,7 +128,7 @@ function install_bin() {
...
@@ -89,7 +128,7 @@ function install_bin() {
function
install_lib
()
{
function
install_lib
()
{
# Remove links
# Remove links
${
csudo
}
rm
-f
${
lib_link_dir
}
/libtaos.
*
||
:
${
csudo
}
rm
-f
${
lib_link_dir
}
/libtaos.
*
||
:
${
csudo
}
cp
-rf
${
script_dir
}
/driver/
*
${
install_main_dir
}
/driver
&&
${
csudo
}
chmod
777
${
install_main_dir
}
/driver/
*
${
csudo
}
cp
-rf
${
script_dir
}
/driver/
*
${
install_main_dir
}
/driver
&&
${
csudo
}
chmod
777
${
install_main_dir
}
/driver/
*
...
@@ -98,7 +137,7 @@ function install_lib() {
...
@@ -98,7 +137,7 @@ function install_lib() {
}
}
function
install_header
()
{
function
install_header
()
{
${
csudo
}
rm
-f
${
inc_link_dir
}
/taos.h
${
inc_link_dir
}
/taoserror.h
||
:
${
csudo
}
rm
-f
${
inc_link_dir
}
/taos.h
${
inc_link_dir
}
/taoserror.h
||
:
${
csudo
}
cp
-f
${
script_dir
}
/inc/
*
${
install_main_dir
}
/include
&&
${
csudo
}
chmod
644
${
install_main_dir
}
/include/
*
${
csudo
}
cp
-f
${
script_dir
}
/inc/
*
${
install_main_dir
}
/include
&&
${
csudo
}
chmod
644
${
install_main_dir
}
/include/
*
${
csudo
}
ln
-s
${
install_main_dir
}
/include/taos.h
${
inc_link_dir
}
/taos.h
${
csudo
}
ln
-s
${
install_main_dir
}
/include/taos.h
${
inc_link_dir
}
/taos.h
${
csudo
}
ln
-s
${
install_main_dir
}
/include/taoserror.h
${
inc_link_dir
}
/taoserror.h
${
csudo
}
ln
-s
${
install_main_dir
}
/include/taoserror.h
${
inc_link_dir
}
/taoserror.h
...
@@ -107,16 +146,17 @@ function install_header() {
...
@@ -107,16 +146,17 @@ function install_header() {
function
install_config
()
{
function
install_config
()
{
#${csudo} rm -f ${install_main_dir}/cfg/taos.cfg || :
#${csudo} rm -f ${install_main_dir}/cfg/taos.cfg || :
if
[
!
-f
${
cfg_install_dir
}
/taos.cfg
]
;
then
if
[
!
-f
${
cfg_install_dir
}
/taos.cfg
]
;
then
${
csudo
}
mkdir
-p
${
cfg_install_dir
}
${
csudo
}
mkdir
-p
${
cfg_install_dir
}
[
-f
${
script_dir
}
/cfg/taos.cfg
]
&&
${
csudo
}
cp
${
script_dir
}
/cfg/taos.cfg
${
cfg_install_dir
}
[
-f
${
script_dir
}
/cfg/taos.cfg
]
&&
${
csudo
}
cp
${
script_dir
}
/cfg/taos.cfg
${
cfg_install_dir
}
${
csudo
}
chmod
644
${
cfg_install_dir
}
/
*
${
csudo
}
chmod
644
${
cfg_install_dir
}
/
*
fi
fi
${
csudo
}
cp
-f
${
script_dir
}
/cfg/taos.cfg
${
install_main_dir
}
/cfg/taos.cfg.org
${
csudo
}
cp
-f
${
script_dir
}
/cfg/taos.cfg
${
install_main_dir
}
/cfg/taos.cfg.org
${
csudo
}
ln
-s
${
cfg_install_dir
}
/taos.cfg
${
install_main_dir
}
/cfg
${
csudo
}
ln
-s
${
cfg_install_dir
}
/taos.cfg
${
install_main_dir
}
/cfg
}
}
function
install_log
()
{
function
install_log
()
{
${
csudo
}
rm
-rf
${
log_dir
}
||
:
${
csudo
}
rm
-rf
${
log_dir
}
||
:
${
csudo
}
mkdir
-p
${
log_dir
}
&&
${
csudo
}
chmod
777
${
log_dir
}
${
csudo
}
mkdir
-p
${
log_dir
}
&&
${
csudo
}
chmod
777
${
log_dir
}
...
@@ -139,14 +179,26 @@ function install_examples() {
...
@@ -139,14 +179,26 @@ function install_examples() {
}
}
function
clean_service_on_sysvinit
()
{
function
clean_service_on_sysvinit
()
{
restart_config_str
=
"taos:2345:respawn:
${
service_config_dir
}
/taosd start"
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
#${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
if
pidof taosd &> /dev/null
;
then
if
pidof taosd &> /dev/null
;
then
${
csudo
}
service taosd stop
||
:
${
csudo
}
service taosd stop
||
:
fi
fi
${
csudo
}
sed
-i
"
\|
${
restart_config_str
}
|d"
/etc/inittab
||
:
if
((
${
initd_mod
}
==
1
))
;
then
${
csudo
}
chkconfig
--del
taosd
||
:
elif
((
${
initd_mod
}
==
2
))
;
then
${
csudo
}
insserv
-r
taosd
||
:
elif
((
${
initd_mod
}
==
3
))
;
then
${
csudo
}
update-rc.d
-f
taosd remove
||
:
fi
${
csudo
}
rm
-f
${
service_config_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
service_config_dir
}
/taosd
||
:
${
csudo
}
update-rc.d
-f
taosd remove
||
:
${
csudo
}
init q
||
:
if
$(
which init &> /dev/null
)
;
then
${
csudo
}
init q
||
:
fi
}
}
function
install_service_on_sysvinit
()
{
function
install_service_on_sysvinit
()
{
...
@@ -155,14 +207,27 @@ function install_service_on_sysvinit() {
...
@@ -155,14 +207,27 @@ function install_service_on_sysvinit() {
sleep
1
sleep
1
# Install taosd service
# Install taosd service
${
csudo
}
cp
-f
${
script_dir
}
/init.d/taosd
${
install_main_dir
}
/init.d
${
csudo
}
cp
${
script_dir
}
/init.d/taosd
${
service_config_dir
}
&&
${
csudo
}
chmod
a+x
${
service_config_dir
}
/taosd
if
((
${
os_type
}
==
1
))
;
then
restart_config_str
=
"taos:2345:respawn:
${
service_config_dir
}
/taosd start"
${
csudo
}
cp
-f
${
script_dir
}
/init.d/taosd.deb
${
install_main_dir
}
/init.d/taosd
${
csudo
}
cp
${
script_dir
}
/init.d/taosd.deb
${
service_config_dir
}
/taosd
&&
${
csudo
}
chmod
a+x
${
service_config_dir
}
/taosd
${
csudo
}
grep
-q
-F
"
$restart_config_str
"
/etc/inittab
||
${
csudo
}
bash
-c
"echo '
${
restart_config_str
}
' >> /etc/inittab"
elif
((
${
os_type
}
==
2
))
;
then
# TODO: for centos, change here
${
csudo
}
cp
-f
${
script_dir
}
/init.d/taosd.rpm
${
install_main_dir
}
/init.d/taosd
${
csudo
}
update-rc.d taosd defaults
${
csudo
}
cp
${
script_dir
}
/init.d/taosd.rpm
${
service_config_dir
}
/taosd
&&
${
csudo
}
chmod
a+x
${
service_config_dir
}
/taosd
# chkconfig mysqld on
fi
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
#${csudo} grep -q -F "$restart_config_str" /etc/inittab || ${csudo} bash -c "echo '${restart_config_str}' >> /etc/inittab"
if
((
${
initd_mod
}
==
1
))
;
then
${
csudo
}
chkconfig
--add
taosd
||
:
${
csudo
}
chkconfig
--level
2345 taosd on
||
:
elif
((
${
initd_mod
}
==
2
))
;
then
${
csudo
}
insserv taosd
||
:
${
csudo
}
insserv
-d
taosd
||
:
elif
((
${
initd_mod
}
==
3
))
;
then
${
csudo
}
update-rc.d taosd defaults
||
:
fi
}
}
function
clean_service_on_systemd
()
{
function
clean_service_on_systemd
()
{
...
@@ -212,7 +277,7 @@ function install_service() {
...
@@ -212,7 +277,7 @@ function install_service() {
elif
((
${
service_mod
}
==
1
))
;
then
elif
((
${
service_mod
}
==
1
))
;
then
install_service_on_sysvinit
install_service_on_sysvinit
else
else
# must manual st
art
taosd
# must manual st
op
taosd
kill_taosd
kill_taosd
fi
fi
}
}
...
@@ -266,7 +331,7 @@ function update_TDengine() {
...
@@ -266,7 +331,7 @@ function update_TDengine() {
echo
"File taos.tar.gz does not exist"
echo
"File taos.tar.gz does not exist"
exit
1
exit
1
fi
fi
tar
-zxf
taos.tar.gz
tar
-zxf
taos.tar.gz
# Check if version compatible
# Check if version compatible
if
!
is_version_compatible
;
then
if
!
is_version_compatible
;
then
...
@@ -274,7 +339,7 @@ function update_TDengine() {
...
@@ -274,7 +339,7 @@ function update_TDengine() {
return
1
return
1
fi
fi
echo
-e
"
${
GREEN
}
Start to update TD
E
ngine...
${
NC
}
"
echo
-e
"
${
GREEN
}
Start to update TD
e
ngine...
${
NC
}
"
# Stop the service if running
# Stop the service if running
if
pidof taosd &> /dev/null
;
then
if
pidof taosd &> /dev/null
;
then
if
((
${
service_mod
}
==
0
))
;
then
if
((
${
service_mod
}
==
0
))
;
then
...
@@ -306,8 +371,7 @@ function update_TDengine() {
...
@@ -306,8 +371,7 @@ function update_TDengine() {
if
((
${
service_mod
}
==
0
))
;
then
if
((
${
service_mod
}
==
0
))
;
then
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
:
${
csudo
}
systemctl start taosd
${
NC
}
"
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
:
${
csudo
}
systemctl start taosd
${
NC
}
"
elif
((
${
service_mod
}
==
1
))
;
then
elif
((
${
service_mod
}
==
1
))
;
then
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
:
${
csudo
}
update-rc.d taosd default
${
RED
}
for the first time
${
NC
}
"
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
:
${
csudo
}
service taosd start
${
NC
}
"
echo
-e
" :
${
csudo
}
service taosd start
${
RED
}
after
${
NC
}
"
else
else
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
: ./taosd
${
NC
}
"
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
: ./taosd
${
NC
}
"
fi
fi
...
@@ -316,7 +380,7 @@ function update_TDengine() {
...
@@ -316,7 +380,7 @@ function update_TDengine() {
echo
echo
echo
-e
"
\0
33[44;32;1mTDengine is updated successfully!
${
NC
}
"
echo
-e
"
\0
33[44;32;1mTDengine is updated successfully!
${
NC
}
"
else
else
install_bin
$1
install_bin
install_config
install_config
echo
echo
...
@@ -332,9 +396,9 @@ function install_TDengine() {
...
@@ -332,9 +396,9 @@ function install_TDengine() {
echo
"File taos.tar.gz does not exist"
echo
"File taos.tar.gz does not exist"
exit
1
exit
1
fi
fi
tar
-zxf
taos.tar.gz
tar
-zxf
taos.tar.gz
echo
-e
"
${
GREEN
}
Start to install TD
E
ngine...
${
NC
}
"
echo
-e
"
${
GREEN
}
Start to install TD
e
ngine...
${
NC
}
"
install_main_path
install_main_path
...
@@ -362,10 +426,9 @@ function install_TDengine() {
...
@@ -362,10 +426,9 @@ function install_TDengine() {
if
((
${
service_mod
}
==
0
))
;
then
if
((
${
service_mod
}
==
0
))
;
then
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
:
${
csudo
}
systemctl start taosd
${
NC
}
"
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
:
${
csudo
}
systemctl start taosd
${
NC
}
"
elif
((
${
service_mod
}
==
1
))
;
then
elif
((
${
service_mod
}
==
1
))
;
then
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
:
${
csudo
}
update-rc.d taosd default
${
RED
}
for the first time
${
NC
}
"
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
:
${
csudo
}
service taosd start
${
NC
}
"
echo
-e
" :
${
csudo
}
service taosd start
${
RED
}
after
${
NC
}
"
else
else
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
:
./
taosd
${
NC
}
"
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
: taosd
${
NC
}
"
fi
fi
echo
-e
"
${
GREEN_DARK
}
To access TDengine
${
NC
}
: use
${
GREEN_UNDERLINE
}
taos
${
NC
}
in shell
${
NC
}
"
echo
-e
"
${
GREEN_DARK
}
To access TDengine
${
NC
}
: use
${
GREEN_UNDERLINE
}
taos
${
NC
}
in shell
${
NC
}
"
...
...
packaging/tools/install_client.sh
浏览文件 @
ccfd17df
#!/bin/bash
#!/bin/bash
#
# This file is used to install TDengine client on linux systems. The operating system
# is required to use systemd to manage services at boot
set
-e
#set -x
# -----------------------Variables definition---------------------
script_dir
=
$(
dirname
$(
readlink
-m
"
$0
"
))
script_dir
=
$(
dirname
$(
readlink
-m
"
$0
"
))
${
script_dir
}
/install.sh client
# Dynamic directory
data_dir
=
"/var/lib/taos"
log_dir
=
"/var/log/taos"
log_link_dir
=
"/usr/local/taos/log"
cfg_install_dir
=
"/etc/taos"
bin_link_dir
=
"/usr/bin"
lib_link_dir
=
"/usr/lib"
inc_link_dir
=
"/usr/include"
#install main path
install_main_dir
=
"/usr/local/taos"
# old bin dir
bin_dir
=
"/usr/local/taos/bin"
# Color setting
RED
=
'\033[0;31m'
GREEN
=
'\033[1;32m'
GREEN_DARK
=
'\033[0;32m'
GREEN_UNDERLINE
=
'\033[4;32m'
NC
=
'\033[0m'
csudo
=
""
if
command
-v
sudo
>
/dev/null
;
then
csudo
=
"sudo"
fi
update_flag
=
0
function
kill_client
()
{
pid
=
$(
ps
-ef
|
grep
"taos"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
if
[
-n
"
$pid
"
]
;
then
${
csudo
}
kill
-9
$pid
||
:
fi
}
function
install_main_path
()
{
#create install main dir and all sub dir
${
csudo
}
rm
-rf
${
install_main_dir
}
||
:
${
csudo
}
mkdir
-p
${
install_main_dir
}
${
csudo
}
mkdir
-p
${
install_main_dir
}
/cfg
${
csudo
}
mkdir
-p
${
install_main_dir
}
/bin
${
csudo
}
mkdir
-p
${
install_main_dir
}
/connector
${
csudo
}
mkdir
-p
${
install_main_dir
}
/driver
${
csudo
}
mkdir
-p
${
install_main_dir
}
/examples
${
csudo
}
mkdir
-p
${
install_main_dir
}
/include
}
function
install_bin
()
{
# Remove links
${
csudo
}
rm
-f
${
bin_link_dir
}
/taos
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdump
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/rmtaos
||
:
${
csudo
}
cp
-r
${
script_dir
}
/bin/
*
${
install_main_dir
}
/bin
&&
${
csudo
}
chmod
0555
${
install_main_dir
}
/bin/
*
#Make link
[
-x
${
install_main_dir
}
/bin/taos
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taos
${
bin_link_dir
}
/taos
||
:
[
-x
${
install_main_dir
}
/bin/taosdump
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taosdump
${
bin_link_dir
}
/taosdump
||
:
[
-x
${
install_main_dir
}
/bin/remove_client.sh
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/remove_client.sh
${
bin_link_dir
}
/rmtaos
||
:
}
function
clean_lib
()
{
sudo rm
-f
/usr/lib/libtaos.so
||
:
sudo rm
-rf
${
lib_dir
}
||
:
}
function
install_lib
()
{
# Remove links
${
csudo
}
rm
-f
${
lib_link_dir
}
/libtaos.
*
||
:
${
csudo
}
cp
-rf
${
script_dir
}
/driver/
*
${
install_main_dir
}
/driver
&&
${
csudo
}
chmod
777
${
install_main_dir
}
/driver/
*
${
csudo
}
ln
-s
${
install_main_dir
}
/driver/libtaos.
*
${
lib_link_dir
}
/libtaos.so.1
${
csudo
}
ln
-s
${
lib_link_dir
}
/libtaos.so.1
${
lib_link_dir
}
/libtaos.so
}
function
install_header
()
{
${
csudo
}
rm
-f
${
inc_link_dir
}
/taos.h
${
inc_link_dir
}
/taoserror.h
||
:
${
csudo
}
cp
-f
${
script_dir
}
/inc/
*
${
install_main_dir
}
/include
&&
${
csudo
}
chmod
644
${
install_main_dir
}
/include/
*
${
csudo
}
ln
-s
${
install_main_dir
}
/include/taos.h
${
inc_link_dir
}
/taos.h
${
csudo
}
ln
-s
${
install_main_dir
}
/include/taoserror.h
${
inc_link_dir
}
/taoserror.h
}
function
install_config
()
{
#${csudo} rm -f ${install_main_dir}/cfg/taos.cfg || :
if
[
!
-f
${
cfg_install_dir
}
/taos.cfg
]
;
then
${
csudo
}
mkdir
-p
${
cfg_install_dir
}
[
-f
${
script_dir
}
/cfg/taos.cfg
]
&&
${
csudo
}
cp
${
script_dir
}
/cfg/taos.cfg
${
cfg_install_dir
}
${
csudo
}
chmod
644
${
cfg_install_dir
}
/
*
fi
${
csudo
}
cp
-f
${
script_dir
}
/cfg/taos.cfg
${
install_main_dir
}
/cfg/taos.cfg.org
${
csudo
}
ln
-s
${
cfg_install_dir
}
/taos.cfg
${
install_main_dir
}
/cfg
}
function
install_log
()
{
${
csudo
}
rm
-rf
${
log_dir
}
||
:
${
csudo
}
mkdir
-p
${
log_dir
}
&&
${
csudo
}
chmod
777
${
log_dir
}
${
csudo
}
ln
-s
${
log_dir
}
${
install_main_dir
}
/log
}
function
install_connector
()
{
${
csudo
}
cp
-rf
${
script_dir
}
/connector/
*
${
install_main_dir
}
/connector
}
function
install_examples
()
{
if
[
-d
${
script_dir
}
/examples
]
;
then
${
csudo
}
cp
-rf
${
script_dir
}
/examples/
*
${
install_main_dir
}
/examples
fi
}
function
update_TDengine
()
{
# Start to update
if
[
!
-e
taos.tar.gz
]
;
then
echo
"File taos.tar.gz does not exist"
exit
1
fi
tar
-zxf
taos.tar.gz
echo
-e
"
${
GREEN
}
Start to update TDengine client...
${
NC
}
"
# Stop the client shell if running
if
pidof taos &> /dev/null
;
then
kill_client
sleep
1
fi
install_main_path
install_log
install_header
install_lib
install_connector
install_examples
install_bin
install_config
echo
echo
-e
"
\0
33[44;32;1mTDengine client is updated successfully!
${
NC
}
"
rm
-rf
$(
tar
-tf
taos.tar.gz
)
}
function
install_TDengine
()
{
# Start to install
if
[
!
-e
taos.tar.gz
]
;
then
echo
"File taos.tar.gz does not exist"
exit
1
fi
tar
-zxf
taos.tar.gz
echo
-e
"
${
GREEN
}
Start to install TDengine client...
${
NC
}
"
install_main_path
install_log
install_header
install_lib
install_connector
install_examples
install_bin
install_config
echo
echo
-e
"
\0
33[44;32;1mTDengine client is installed successfully!
${
NC
}
"
rm
-rf
$(
tar
-tf
taos.tar.gz
)
}
## ==============================Main program starts from here============================
# Install or updata client and client
# if server is already install, don't install client
if
[
-e
${
bin_dir
}
/taosd
]
;
then
echo
-e
"
\0
33[44;32;1mThere are already installed TDengine server, so don't need install client!
${
NC
}
"
exit
0
fi
if
[
-x
${
bin_dir
}
/taos
]
;
then
update_flag
=
1
update_TDengine
else
install_TDengine
fi
packaging/tools/makeclient.sh
0 → 100755
浏览文件 @
ccfd17df
#!/bin/bash
#
# Generate tar.gz package for linux client
set
-e
set
-x
curr_dir
=
$(
pwd
)
compile_dir
=
$1
version
=
$2
build_time
=
$3
armver
=
$4
script_dir
=
"
$(
dirname
$(
readlink
-f
$0
))
"
top_dir
=
"
$(
readlink
-m
${
script_dir
}
/../..
)
"
# create compressed install file.
build_dir
=
"
${
compile_dir
}
/build"
code_dir
=
"
${
top_dir
}
/src"
release_dir
=
"
${
top_dir
}
/release"
community_dir
=
"
${
script_dir
}
/../../../community/src"
package_name
=
'linux'
install_dir
=
"
${
release_dir
}
/TDengine-client-enterprise-
${
version
}
-
${
package_name
}
-
$(
echo
${
build_time
}
|
tr
': '
-
)
"
# Directories and files.
bin_files
=
"
${
build_dir
}
/bin/taos
${
build_dir
}
/bin/taosdump
${
script_dir
}
/remove_client.sh"
lib_files
=
"
${
build_dir
}
/lib/libtaos.so.
${
version
}
"
header_files
=
"
${
community_dir
}
/inc/taos.h
${
community_dir
}
/inc/taoserror.h"
cfg_dir
=
"
${
top_dir
}
/packaging/cfg"
install_files
=
"
${
script_dir
}
/install_client.sh"
# make directories.
mkdir
-p
${
install_dir
}
mkdir
-p
${
install_dir
}
/inc
&&
cp
${
header_files
}
${
install_dir
}
/inc
mkdir
-p
${
install_dir
}
/cfg
&&
cp
${
cfg_dir
}
/taos.cfg
${
install_dir
}
/cfg/taos.cfg
mkdir
-p
${
install_dir
}
/bin
&&
cp
${
bin_files
}
${
install_dir
}
/bin
&&
chmod
a+x
${
install_dir
}
/bin/
*
cd
${
install_dir
}
tar
-zcv
-f
taos.tar.gz
*
--remove-files
||
:
cd
${
curr_dir
}
cp
${
install_files
}
${
install_dir
}
&&
chmod
a+x
${
install_dir
}
/install
*
# Copy example code
mkdir
-p
${
install_dir
}
/examples
cp
-r
${
top_dir
}
/tests/examples/c
${
install_dir
}
/examples
cp
-r
${
top_dir
}
/tests/examples/JDBC
${
install_dir
}
/examples
cp
-r
${
top_dir
}
/tests/examples/matlab
${
install_dir
}
/examples
cp
-r
${
top_dir
}
/tests/examples/python
${
install_dir
}
/examples
cp
-r
${
top_dir
}
/tests/examples/R
${
install_dir
}
/examples
cp
-r
${
top_dir
}
/tests/examples/go
${
install_dir
}
/examples
# Copy driver
mkdir
-p
${
install_dir
}
/driver
cp
${
lib_files
}
${
install_dir
}
/driver
# Copy connector
connector_dir
=
"
${
community_dir
}
/connector"
mkdir
-p
${
install_dir
}
/connector
cp
${
build_dir
}
/lib/
*
.jar
${
install_dir
}
/connector
cp
-r
${
connector_dir
}
/grafana
${
install_dir
}
/connector/
cp
-r
${
connector_dir
}
/python
${
install_dir
}
/connector/
cp
-r
${
connector_dir
}
/go
${
install_dir
}
/connector
# Copy release note
# cp ${script_dir}/release_note ${install_dir}
# exit 1
cd
${
release_dir
}
if
[
-z
"
$armver
"
]
;
then
tar
-zcv
-f
"
$(
basename
${
install_dir
}
)
.tar.gz"
$(
basename
${
install_dir
}
)
--remove-files
elif
[
"
$armver
"
==
"arm64"
]
;
then
tar
-zcv
-f
"
$(
basename
${
install_dir
}
)
-arm64.tar.gz"
$(
basename
${
install_dir
}
)
--remove-files
elif
[
"
$armver
"
==
"arm32"
]
;
then
tar
-zcv
-f
"
$(
basename
${
install_dir
}
)
-arm32.tar.gz"
$(
basename
${
install_dir
}
)
--remove-files
fi
cd
${
curr_dir
}
packaging/tools/makepkg.sh
浏览文件 @
ccfd17df
...
@@ -6,6 +6,7 @@ curr_dir=$(pwd)
...
@@ -6,6 +6,7 @@ curr_dir=$(pwd)
compile_dir
=
$1
compile_dir
=
$1
version
=
$2
version
=
$2
build_time
=
$3
build_time
=
$3
armver
=
$4
script_dir
=
"
$(
dirname
$(
readlink
-f
$0
))
"
script_dir
=
"
$(
dirname
$(
readlink
-f
$0
))
"
top_dir
=
"
$(
readlink
-m
${
script_dir
}
/../..
)
"
top_dir
=
"
$(
readlink
-m
${
script_dir
}
/../..
)
"
...
@@ -20,11 +21,10 @@ install_dir="${release_dir}/taos-${version}-${package_name}-$(echo ${build_time}
...
@@ -20,11 +21,10 @@ install_dir="${release_dir}/taos-${version}-${package_name}-$(echo ${build_time}
# Directories and files.
# Directories and files.
bin_files
=
"
${
build_dir
}
/bin/taosd
${
build_dir
}
/bin/taos
${
build_dir
}
/bin/taosdemo
${
build_dir
}
/bin/taosdump
${
script_dir
}
/remove.sh"
bin_files
=
"
${
build_dir
}
/bin/taosd
${
build_dir
}
/bin/taos
${
build_dir
}
/bin/taosdemo
${
build_dir
}
/bin/taosdump
${
script_dir
}
/remove.sh"
versioninfo
=
$(
${
script_dir
}
/get_version.sh
${
code_dir
}
/util/src/version.c
)
lib_files
=
"
${
build_dir
}
/lib/libtaos.so.
${
version
}
"
lib_files
=
"
${
build_dir
}
/lib/libtaos.so.
${
versioninfo
}
"
header_files
=
"
${
code_dir
}
/inc/taos.h
${
code_dir
}
/inc/taoserror.h"
header_files
=
"
${
code_dir
}
/inc/taos.h
${
code_dir
}
/inc/taoserror.h"
cfg_
files
=
"
${
top_dir
}
/packaging/cfg/*.
cfg"
cfg_
dir
=
"
${
top_dir
}
/packaging/
cfg"
install_files
=
"
${
script_dir
}
/install.sh
${
script_dir
}
/install_client.sh
"
install_files
=
"
${
script_dir
}
/install.sh"
# Init file
# Init file
#init_dir=${script_dir}/deb
#init_dir=${script_dir}/deb
...
@@ -33,29 +33,32 @@ install_files="${script_dir}/install.sh ${script_dir}/install_client.sh"
...
@@ -33,29 +33,32 @@ install_files="${script_dir}/install.sh ${script_dir}/install_client.sh"
#fi
#fi
#init_files=${init_dir}/taosd
#init_files=${init_dir}/taosd
# temp use rpm's taosd. TODO: later modify according to os type
# temp use rpm's taosd. TODO: later modify according to os type
init_files
=
${
script_dir
}
/../rpm/taosd
init_file_deb
=
${
script_dir
}
/../deb/taosd
init_file_rpm
=
${
script_dir
}
/../rpm/taosd
# make directories.
# make directories.
mkdir
-p
${
install_dir
}
mkdir
-p
${
install_dir
}
mkdir
-p
${
install_dir
}
/inc
&&
cp
${
header_files
}
${
install_dir
}
/inc
mkdir
-p
${
install_dir
}
/inc
&&
cp
${
header_files
}
${
install_dir
}
/inc
mkdir
-p
${
install_dir
}
/cfg
&&
cp
${
cfg_
files
}
${
install_dir
}
/
cfg
mkdir
-p
${
install_dir
}
/cfg
&&
cp
${
cfg_
dir
}
/taos.cfg
${
install_dir
}
/cfg/taos.
cfg
mkdir
-p
${
install_dir
}
/bin
&&
cp
${
bin_files
}
${
install_dir
}
/bin
&&
chmod
a+x
${
install_dir
}
/bin/
*
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_files
}
${
install_dir
}
/init.d
mkdir
-p
${
install_dir
}
/init.d
&&
cp
${
init_file_deb
}
${
install_dir
}
/init.d/taosd.deb
mkdir
-p
${
install_dir
}
/init.d
&&
cp
${
init_file_rpm
}
${
install_dir
}
/init.d/taosd.rpm
cd
${
install_dir
}
cd
${
install_dir
}
tar
-zcv
-f
taos.tar.gz
*
--remove-files
||
:
tar
-zcv
-f
taos.tar.gz
*
--remove-files
||
:
cd
${
curr_dir
}
cd
${
curr_dir
}
cp
${
install_files
}
${
install_dir
}
&&
chmod
a+x
${
install_dir
}
/install
*
cp
${
install_files
}
${
install_dir
}
&&
chmod
a+x
${
install_dir
}
/install
*
# Copy example code
# Copy example code
mkdir
-p
${
install_dir
}
/examples
mkdir
-p
${
install_dir
}
/examples
cp
-r
${
top_dir
}
/tests/examples/c
${
install_dir
}
/examples
examples_dir
=
"
${
top_dir
}
/tests/examples"
cp
-r
${
top_dir
}
/tests/examples/JDBC
${
install_dir
}
/examples
cp
-r
${
examples_dir
}
/c
${
install_dir
}
/examples
cp
-r
${
top_dir
}
/tests/examples/matlab
${
install_dir
}
/examples
cp
-r
${
examples_dir
}
/JDBC
${
install_dir
}
/examples
cp
-r
${
top_dir
}
/tests/examples/python
${
install_dir
}
/examples
cp
-r
${
examples_dir
}
/matlab
${
install_dir
}
/examples
cp
-r
${
top_dir
}
/tests/examples/R
${
install_dir
}
/examples
cp
-r
${
examples_dir
}
/python
${
install_dir
}
/examples
cp
-r
${
top_dir
}
/tests/examples/go
${
install_dir
}
/examples
cp
-r
${
examples_dir
}
/R
${
install_dir
}
/examples
cp
-r
${
examples_dir
}
/go
${
install_dir
}
/examples
# Copy driver
# Copy driver
mkdir
-p
${
install_dir
}
/driver
mkdir
-p
${
install_dir
}
/driver
...
@@ -64,18 +67,23 @@ cp ${lib_files} ${install_dir}/driver
...
@@ -64,18 +67,23 @@ cp ${lib_files} ${install_dir}/driver
# Copy connector
# Copy connector
connector_dir
=
"
${
code_dir
}
/connector"
connector_dir
=
"
${
code_dir
}
/connector"
mkdir
-p
${
install_dir
}
/connector
mkdir
-p
${
install_dir
}
/connector
cp
${
build_dir
}
/lib/
*
.jar
${
install_dir
}
/connector
cp
-r
${
connector_dir
}
/grafana
${
install_dir
}
/connector/
cp
-r
${
connector_dir
}
/grafana
${
install_dir
}
/connector/
cp
-r
${
connector_dir
}
/python
${
install_dir
}
/connector/
cp
-r
${
connector_dir
}
/python
${
install_dir
}
/connector/
cp
-r
${
connector_dir
}
/go
${
install_dir
}
/connector
cp
-r
${
connector_dir
}
/go
${
install_dir
}
/connector
cp
${
build_dir
}
/lib/
*
.jar
${
install_dir
}
/connector
# Copy release note
# Copy release note
cp
${
script_dir
}
/release_note
${
install_dir
}
#
cp ${script_dir}/release_note ${install_dir}
# exit 1
# exit 1
cd
${
release_dir
}
cd
${
release_dir
}
tar
-zcv
-f
"
$(
basename
${
install_dir
}
)
.tar.gz"
$(
basename
${
install_dir
}
)
--remove-files
if
[
-z
"
$armver
"
]
;
then
tar
-zcv
-f
"
$(
basename
${
install_dir
}
)
.tar.gz"
$(
basename
${
install_dir
}
)
--remove-files
elif
[
"
$armver
"
==
"arm64"
]
;
then
tar
-zcv
-f
"
$(
basename
${
install_dir
}
)
-arm64.tar.gz"
$(
basename
${
install_dir
}
)
--remove-files
elif
[
"
$armver
"
==
"arm32"
]
;
then
tar
-zcv
-f
"
$(
basename
${
install_dir
}
)
-arm32.tar.gz"
$(
basename
${
install_dir
}
)
--remove-files
fi
cd
${
curr_dir
}
cd
${
curr_dir
}
packaging/tools/post.sh
浏览文件 @
ccfd17df
...
@@ -42,14 +42,18 @@ initd_mod=0
...
@@ -42,14 +42,18 @@ initd_mod=0
service_mod
=
2
service_mod
=
2
if
pidof systemd &> /dev/null
;
then
if
pidof systemd &> /dev/null
;
then
service_mod
=
0
service_mod
=
0
elif
$(
which
insserv &> /dev/null
)
;
then
elif
$(
which
service &> /dev/null
)
;
then
service_mod
=
1
service_mod
=
1
initd_mod
=
1
service_config_dir
=
"/etc/init.d"
service_config_dir
=
"/etc/init.d"
if
$(
which chkconfig &> /dev/null
)
;
then
elif
$(
which update-rc.d &> /dev/null
)
;
then
initd_mod
=
1
service_mod
=
1
elif
$(
which insserv &> /dev/null
)
;
then
initd_mod
=
2
initd_mod
=
2
service_config_dir
=
"/etc/init.d"
elif
$(
which update-rc.d &> /dev/null
)
;
then
initd_mod
=
3
else
service_mod
=
2
fi
else
else
service_mod
=
2
service_mod
=
2
fi
fi
...
@@ -57,7 +61,9 @@ fi
...
@@ -57,7 +61,9 @@ fi
function
kill_taosd
()
{
function
kill_taosd
()
{
# ${csudo} pkill -f taosd || :
# ${csudo} pkill -f taosd || :
pid
=
$(
ps
-ef
|
grep
"taosd"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
pid
=
$(
ps
-ef
|
grep
"taosd"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
${
csudo
}
kill
-9
${
pid
}
||
:
if
[
-n
"
$pid
"
]
;
then
${
csudo
}
kill
-9
$pid
||
:
fi
}
}
function
install_include
()
{
function
install_include
()
{
...
@@ -103,20 +109,26 @@ function install_config() {
...
@@ -103,20 +109,26 @@ function install_config() {
}
}
function
clean_service_on_sysvinit
()
{
function
clean_service_on_sysvinit
()
{
restart_config_str
=
"taos:2345:respawn:
${
service_config_dir
}
/taosd start"
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
#${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
if
pidof taosd &> /dev/null
;
then
if
pidof taosd &> /dev/null
;
then
${
csudo
}
service taosd stop
||
:
${
csudo
}
service taosd stop
||
:
fi
fi
${
csudo
}
sed
-i
"
\|
${
restart_config_str
}
|d"
/etc/inittab
||
:
${
csudo
}
rm
-f
${
service_config_dir
}
/taosd
||
:
if
((
${
initd_mod
}
==
1
))
;
then
if
((
${
initd_mod
}
==
1
))
;
then
${
csudo
}
grep
-q
-F
"taos"
/etc/inittab
&&
${
csudo
}
insserv
-r
taosd
||
:
${
csudo
}
chkconfig
--del
taosd
||
:
elif
((
${
initd_mod
}
==
2
))
;
then
elif
((
${
initd_mod
}
==
2
))
;
then
${
csudo
}
grep
-q
-F
"taos"
/etc/inittab
&&
${
csudo
}
update-rc.d
-f
taosd remove
||
:
${
csudo
}
insserv
-r
taosd
||
:
elif
((
${
initd_mod
}
==
3
))
;
then
${
csudo
}
update-rc.d
-f
taosd remove
||
:
fi
${
csudo
}
rm
-f
${
service_config_dir
}
/taosd
||
:
if
$(
which init &> /dev/null
)
;
then
${
csudo
}
init q
||
:
fi
fi
# ${csudo} update-rc.d -f taosd remove || :
${
csudo
}
init q
||
:
}
}
function
install_service_on_sysvinit
()
{
function
install_service_on_sysvinit
()
{
...
@@ -127,18 +139,24 @@ function install_service_on_sysvinit() {
...
@@ -127,18 +139,24 @@ function install_service_on_sysvinit() {
# Install taosd service
# Install taosd service
${
csudo
}
cp
%
{
init_d_dir
}
/taosd
${
service_config_dir
}
&&
${
csudo
}
chmod
a+x
${
service_config_dir
}
/taosd
${
csudo
}
cp
%
{
init_d_dir
}
/taosd
${
service_config_dir
}
&&
${
csudo
}
chmod
a+x
${
service_config_dir
}
/taosd
restart_config_str
=
"taos:2345:respawn:
${
service_config_dir
}
/taosd start"
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
#${csudo} grep -q -F "$restart_config_str" /etc/inittab || ${csudo} bash -c "echo '${restart_config_str}' >> /etc/inittab"
${
csudo
}
grep
-q
-F
"
$restart_config_str
"
/etc/inittab
||
${
csudo
}
bash
-c
"echo '
${
restart_config_str
}
' >> /etc/inittab"
# TODO: for centos, change here
if
((
${
initd_mod
}
==
1
))
;
then
${
csudo
}
update-rc.d taosd defaults
${
csudo
}
chkconfig
--add
taosd
||
:
# chkconfig mysqld on
${
csudo
}
chkconfig
--level
2345 taosd on
||
:
elif
((
${
initd_mod
}
==
2
))
;
then
${
csudo
}
insserv taosd
||
:
${
csudo
}
insserv
-d
taosd
||
:
elif
((
${
initd_mod
}
==
3
))
;
then
${
csudo
}
update-rc.d taosd defaults
||
:
fi
}
}
function
clean_service_on_systemd
()
{
function
clean_service_on_systemd
()
{
taosd_service_config
=
"
${
service_config_dir
}
/taosd.service"
taosd_service_config
=
"
${
service_config_dir
}
/taosd.service"
# taosd service already is stoped before install
# taosd service already is stoped before install
in preinst script
#if systemctl is-active --quiet taosd; then
#if systemctl is-active --quiet taosd; then
# echo "TDengine is running, stopping it..."
# echo "TDengine is running, stopping it..."
# ${csudo} systemctl stop taosd &> /dev/null || echo &> /dev/null
# ${csudo} systemctl stop taosd &> /dev/null || echo &> /dev/null
...
...
packaging/tools/preun.sh
浏览文件 @
ccfd17df
...
@@ -26,22 +26,27 @@ initd_mod=0
...
@@ -26,22 +26,27 @@ initd_mod=0
service_mod
=
2
service_mod
=
2
if
pidof systemd &> /dev/null
;
then
if
pidof systemd &> /dev/null
;
then
service_mod
=
0
service_mod
=
0
elif
$(
which
insserv &> /dev/null
)
;
then
elif
$(
which
service &> /dev/null
)
;
then
service_mod
=
1
service_mod
=
1
initd_mod
=
1
service_config_dir
=
"/etc/init.d"
service_config_dir
=
"/etc/init.d"
if
$(
which chkconfig &> /dev/null
)
;
then
elif
$(
which update-rc.d &> /dev/null
)
;
then
initd_mod
=
1
service_mod
=
1
elif
$(
which insserv &> /dev/null
)
;
then
initd_mod
=
2
initd_mod
=
2
service_config_dir
=
"/etc/init.d"
elif
$(
which update-rc.d &> /dev/null
)
;
then
initd_mod
=
3
else
service_mod
=
2
fi
else
else
service_mod
=
2
service_mod
=
2
fi
fi
function
kill_taosd
()
{
function
kill_taosd
()
{
pid
=
$(
ps
-ef
|
grep
"taosd"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
pid
=
$(
ps
-ef
|
grep
"taosd"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
${
csudo
}
kill
-9
${
pid
}
||
:
if
[
-n
"
$pid
"
]
;
then
${
csudo
}
kill
-9
$pid
||
:
fi
}
}
function
clean_service_on_systemd
()
{
function
clean_service_on_systemd
()
{
...
@@ -57,20 +62,27 @@ function clean_service_on_systemd() {
...
@@ -57,20 +62,27 @@ function clean_service_on_systemd() {
}
}
function
clean_service_on_sysvinit
()
{
function
clean_service_on_sysvinit
()
{
restart_config_str
=
"taos:2345:respawn:
${
service_config_dir
}
/taosd start"
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
#${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
if
pidof taosd &> /dev/null
;
then
if
pidof taosd &> /dev/null
;
then
echo
"TDengine taosd is running, stopping it..."
${
csudo
}
service taosd stop
||
:
${
csudo
}
service taosd stop
||
:
fi
fi
${
csudo
}
sed
-i
"
\|
${
restart_config_str
}
|d"
/etc/inittab
||
:
${
csudo
}
rm
-f
${
service_config_dir
}
/taosd
||
:
if
((
${
initd_mod
}
==
1
))
;
then
if
((
${
initd_mod
}
==
1
))
;
then
${
csudo
}
grep
-q
-F
"taos"
/etc/inittab
&&
${
csudo
}
insserv
-r
taosd
||
:
${
csudo
}
chkconfig
--del
taosd
||
:
elif
((
${
initd_mod
}
==
2
))
;
then
elif
((
${
initd_mod
}
==
2
))
;
then
${
csudo
}
grep
-q
-F
"taos"
/etc/inittab
&&
${
csudo
}
update-rc.d
-f
taosd remove
||
:
${
csudo
}
insserv
-r
taosd
||
:
elif
((
${
initd_mod
}
==
3
))
;
then
${
csudo
}
update-rc.d
-f
taosd remove
||
:
fi
${
csudo
}
rm
-f
${
service_config_dir
}
/taosd
||
:
if
$(
which init &> /dev/null
)
;
then
${
csudo
}
init q
||
:
fi
fi
# ${csudo} update-rc.d -f taosd remove || :
${
csudo
}
init q
||
:
}
}
function
clean_service
()
{
function
clean_service
()
{
...
@@ -79,7 +91,7 @@ function clean_service() {
...
@@ -79,7 +91,7 @@ function clean_service() {
elif
((
${
service_mod
}
==
1
))
;
then
elif
((
${
service_mod
}
==
1
))
;
then
clean_service_on_sysvinit
clean_service_on_sysvinit
else
else
# must manual st
art
taosd
# must manual st
op
taosd
kill_taosd
kill_taosd
fi
fi
}
}
...
...
packaging/tools/remove.sh
浏览文件 @
ccfd17df
#!/bin/bash
#!/bin/bash
#
#
# Script to stop the service and uninstall
td
engine, but retain the config, data and log files.
# Script to stop the service and uninstall
TD
engine, but retain the config, data and log files.
RED
=
'\033[0;31m'
RED
=
'\033[0;31m'
GREEN
=
'\033[1;32m'
GREEN
=
'\033[1;32m'
...
@@ -27,21 +27,27 @@ initd_mod=0
...
@@ -27,21 +27,27 @@ initd_mod=0
service_mod
=
2
service_mod
=
2
if
pidof systemd &> /dev/null
;
then
if
pidof systemd &> /dev/null
;
then
service_mod
=
0
service_mod
=
0
elif
$(
which
insserv &> /dev/null
)
;
then
elif
$(
which
service &> /dev/null
)
;
then
service_mod
=
1
service_mod
=
1
initd_mod
=
1
service_config_dir
=
"/etc/init.d"
service_config_dir
=
"/etc/init.d"
if
$(
which chkconfig &> /dev/null
)
;
then
elif
$(
which update-rc.d &> /dev/null
)
;
then
initd_mod
=
1
service_mod
=
1
elif
$(
which insserv &> /dev/null
)
;
then
initd_mod
=
2
initd_mod
=
2
service_config_dir
=
"/etc/init.d"
elif
$(
which update-rc.d &> /dev/null
)
;
then
initd_mod
=
3
else
service_mod
=
2
fi
else
else
service_mod
=
2
service_mod
=
2
fi
fi
function
kill_taosd
()
{
function
kill_taosd
()
{
pid
=
$(
ps
-ef
|
grep
"taosd"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
pid
=
$(
ps
-ef
|
grep
"taosd"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
${
csudo
}
kill
-9
${
pid
}
||
:
if
[
-n
"
$pid
"
]
;
then
${
csudo
}
kill
-9
$pid
||
:
fi
}
}
function
clean_bin
()
{
function
clean_bin
()
{
...
@@ -87,20 +93,27 @@ function clean_service_on_systemd() {
...
@@ -87,20 +93,27 @@ function clean_service_on_systemd() {
}
}
function
clean_service_on_sysvinit
()
{
function
clean_service_on_sysvinit
()
{
restart_config_str
=
"taos:2345:respawn:
${
service_config_dir
}
/taosd start"
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
#${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
if
pidof taosd &> /dev/null
;
then
if
pidof taosd &> /dev/null
;
then
echo
"TDengine taosd is running, stopping it..."
${
csudo
}
service taosd stop
||
:
${
csudo
}
service taosd stop
||
:
fi
fi
${
csudo
}
sed
-i
"
\|
${
restart_config_str
}
|d"
/etc/inittab
||
:
${
csudo
}
rm
-f
${
service_config_dir
}
/taosd
||
:
if
((
${
initd_mod
}
==
1
))
;
then
if
((
${
initd_mod
}
==
1
))
;
then
${
csudo
}
grep
-q
-F
"taos"
/etc/inittab
&&
${
csudo
}
insserv
-r
taosd
||
:
${
csudo
}
chkconfig
--del
taosd
||
:
elif
((
${
initd_mod
}
==
2
))
;
then
elif
((
${
initd_mod
}
==
2
))
;
then
${
csudo
}
grep
-q
-F
"taos"
/etc/inittab
&&
${
csudo
}
update-rc.d
-f
taosd remove
||
:
${
csudo
}
insserv
-r
taosd
||
:
elif
((
${
initd_mod
}
==
3
))
;
then
${
csudo
}
update-rc.d
-f
taosd remove
||
:
fi
${
csudo
}
rm
-f
${
service_config_dir
}
/taosd
||
:
if
$(
which init &> /dev/null
)
;
then
${
csudo
}
init q
||
:
fi
fi
# ${csudo} update-rc.d -f taosd remove || :
${
csudo
}
init q
||
:
}
}
function
clean_service
()
{
function
clean_service
()
{
...
@@ -109,7 +122,7 @@ function clean_service() {
...
@@ -109,7 +122,7 @@ function clean_service() {
elif
((
${
service_mod
}
==
1
))
;
then
elif
((
${
service_mod
}
==
1
))
;
then
clean_service_on_sysvinit
clean_service_on_sysvinit
else
else
# must manual st
art
taosd
# must manual st
op
taosd
kill_taosd
kill_taosd
fi
fi
}
}
...
@@ -140,4 +153,4 @@ elif echo $osinfo | grep -qwi "centos" ; then
...
@@ -140,4 +153,4 @@ elif echo $osinfo | grep -qwi "centos" ; then
${
csudo
}
rpm
-e
--noscripts
tdengine
||
:
${
csudo
}
rpm
-e
--noscripts
tdengine
||
:
fi
fi
echo
-e
"
${
GREEN
}
TD
E
ngine is removed successfully!
${
NC
}
"
echo
-e
"
${
GREEN
}
TD
e
ngine is removed successfully!
${
NC
}
"
packaging/tools/remove_client.sh
0 → 100755
浏览文件 @
ccfd17df
#!/bin/bash
#
# Script to stop the client and uninstall database, but retain the config and log files.
set
-e
# set -x
RED
=
'\033[0;31m'
GREEN
=
'\033[1;32m'
NC
=
'\033[0m'
#install main path
install_main_dir
=
"/usr/local/taos"
log_link_dir
=
"/usr/local/taos/log"
cfg_link_dir
=
"/usr/local/taos/cfg"
bin_link_dir
=
"/usr/bin"
lib_link_dir
=
"/usr/lib"
inc_link_dir
=
"/usr/include"
csudo
=
""
if
command
-v
sudo
>
/dev/null
;
then
csudo
=
"sudo"
fi
function
kill_client
()
{
#pid=$(ps -ef | grep "taos" | grep -v "grep" | awk '{print $2}')
if
[
-n
"
$(
pidof taos
)
"
]
;
then
${
csudo
}
kill
-9
$pid
||
:
fi
}
function
clean_bin
()
{
# Remove link
${
csudo
}
rm
-f
${
bin_link_dir
}
/taos
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosump
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/rmtaos
||
:
}
function
clean_lib
()
{
# Remove link
${
csudo
}
rm
-f
${
lib_link_dir
}
/libtaos.
*
||
:
}
function
clean_header
()
{
# Remove link
${
csudo
}
rm
-f
${
inc_link_dir
}
/taos.h
||
:
${
csudo
}
rm
-f
${
inc_link_dir
}
/taoserror.h
||
:
}
function
clean_config
()
{
# Remove link
${
csudo
}
rm
-f
${
cfg_link_dir
}
/
*
||
:
}
function
clean_log
()
{
# Remove link
${
csudo
}
rm
-rf
${
log_link_dir
}
||
:
}
# Stop client.
kill_client
# Remove binary file and links
clean_bin
# Remove header file.
clean_header
# Remove lib file
clean_lib
# Remove link log directory
clean_log
# Remove link configuration file
clean_config
${
csudo
}
rm
-rf
${
install_main_dir
}
echo
-e
"
${
GREEN
}
TDengine client is removed successfully!
${
NC
}
"
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录