Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e5edd507
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
e5edd507
编写于
7月 19, 2019
作者:
H
hjliao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
http://github.com/taosdata/TDengine
上级
b949b0ab
310c5a43
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
421 addition
and
329 deletion
+421
-329
packaging/deb/DEBIAN/postinst
packaging/deb/DEBIAN/postinst
+8
-2
packaging/deb/DEBIAN/preinst
packaging/deb/DEBIAN/preinst
+8
-3
packaging/deb/DEBIAN/prerm
packaging/deb/DEBIAN/prerm
+7
-4
packaging/release.sh
packaging/release.sh
+17
-12
packaging/rpm/makerpm.sh
packaging/rpm/makerpm.sh
+11
-6
packaging/rpm/tdengine.spec
packaging/rpm/tdengine.spec
+23
-7
packaging/tools/install.sh
packaging/tools/install.sh
+108
-91
packaging/tools/make_install.sh
packaging/tools/make_install.sh
+89
-84
packaging/tools/makepkg.sh
packaging/tools/makepkg.sh
+1
-1
packaging/tools/post.sh
packaging/tools/post.sh
+87
-67
packaging/tools/preun.sh
packaging/tools/preun.sh
+22
-17
packaging/tools/remove.sh
packaging/tools/remove.sh
+34
-29
src/connector/go/src/taosSql/result.go
src/connector/go/src/taosSql/result.go
+2
-2
src/connector/go/src/taosSql/rows.go
src/connector/go/src/taosSql/rows.go
+2
-2
src/connector/go/src/taosSql/taosSqlCgo.go
src/connector/go/src/taosSql/taosSqlCgo.go
+2
-2
未找到文件。
packaging/deb/DEBIAN/postinst
浏览文件 @
e5edd507
...
@@ -2,6 +2,12 @@
...
@@ -2,6 +2,12 @@
#set -x
#set -x
#path=`pwd`
#path=`pwd`
insmetaPath
=
"/usr/local/taos/script"
insmetaPath
=
"/usr/local/taos/script"
sudo chmod
-R
744
${
insmetaPath
}
csudo
=
""
if
command
-v
sudo
>
/dev/null
;
then
csudo
=
"sudo"
fi
${
csudo
}
chmod
-R
744
${
insmetaPath
}
cd
${
insmetaPath
}
cd
${
insmetaPath
}
sudo
./post.sh
${
csudo
}
./post.sh
packaging/deb/DEBIAN/preinst
浏览文件 @
e5edd507
#!/bin/bash
#!/bin/bash
csudo
=
""
if
command
-v
sudo
>
/dev/null
;
then
csudo
=
"sudo"
fi
function
is_using_systemd
()
{
function
is_using_systemd
()
{
if
pidof systemd &> /dev/null
;
then
if
pidof systemd &> /dev/null
;
then
return
0
return
0
...
@@ -11,9 +16,9 @@ function is_using_systemd() {
...
@@ -11,9 +16,9 @@ function is_using_systemd() {
# Stop the service if running
# Stop the service if running
if
pidof taosd &> /dev/null
;
then
if
pidof taosd &> /dev/null
;
then
if
is_using_systemd
;
then
if
is_using_systemd
;
then
sudo
systemctl stop taosd
||
:
${
csudo
}
systemctl stop taosd
||
:
else
else
sudo
service taosd stop
||
:
${
csudo
}
service taosd stop
||
:
fi
fi
echo
"Stop taosd service success!"
echo
"Stop taosd service success!"
sleep
1
sleep
1
...
@@ -23,6 +28,6 @@ fi
...
@@ -23,6 +28,6 @@ fi
cfg_install_dir
=
"/etc/taos"
cfg_install_dir
=
"/etc/taos"
install_main_dir
=
"/usr/local/taos"
install_main_dir
=
"/usr/local/taos"
if
[
-f
${
cfg_install_dir
}
/taos.cfg
]
;
then
if
[
-f
${
cfg_install_dir
}
/taos.cfg
]
;
then
sudo
rm
-f
${
install_main_dir
}
/cfg/taos.cfg
||
:
${
csudo
}
rm
-f
${
install_main_dir
}
/cfg/taos.cfg
||
:
fi
fi
packaging/deb/DEBIAN/prerm
浏览文件 @
e5edd507
#!/bin/bash
#!/bin/bash
#path=`pwd`
insmetaPath
=
"/usr/local/taos/script"
insmetaPath
=
"/usr/local/taos/script"
cd
${
insmetaPath
}
#sudo chmod -R 744 ${insmetaPath}
sudo
./preun.sh
csudo
=
""
if
command
-v
sudo
>
/dev/null
;
then
csudo
=
"sudo"
fi
${
csudo
}
chmod
-R
744
${
insmetaPath
}
cd
${
insmetaPath
}
${
csudo
}
./preun.sh
packaging/release.sh
浏览文件 @
e5edd507
...
@@ -10,6 +10,11 @@ script_dir="$(dirname $(readlink -f $0))"
...
@@ -10,6 +10,11 @@ script_dir="$(dirname $(readlink -f $0))"
top_dir
=
"
$(
readlink
-m
${
script_dir
}
/..
)
"
top_dir
=
"
$(
readlink
-m
${
script_dir
}
/..
)
"
versioninfo
=
"
${
top_dir
}
/src/util/src/version.c"
versioninfo
=
"
${
top_dir
}
/src/util/src/version.c"
csudo
=
""
if
command
-v
sudo
>
/dev/null
;
then
csudo
=
"sudo"
fi
function
is_valid_version
()
{
function
is_valid_version
()
{
[
-z
$1
]
&&
return
1
||
:
[
-z
$1
]
&&
return
1
||
:
...
@@ -113,13 +118,13 @@ fi
...
@@ -113,13 +118,13 @@ fi
compile_dir
=
"
${
top_dir
}
/
${
compile_mode
}
"
compile_dir
=
"
${
top_dir
}
/
${
compile_mode
}
"
if
[
-d
${
compile_dir
}
]
;
then
if
[
-d
${
compile_dir
}
]
;
then
rm
-rf
${
compile_dir
}
${
csudo
}
rm
-rf
${
compile_dir
}
fi
fi
mkdir
-p
${
compile_dir
}
${
csudo
}
mkdir
-p
${
compile_dir
}
cd
${
compile_dir
}
cd
${
compile_dir
}
cmake
-DCMAKE_BUILD_TYPE
=
${
compile_mode
}
${
top_dir
}
${
csudo
}
cmake
-DCMAKE_BUILD_TYPE
=
${
compile_mode
}
${
top_dir
}
make
${
csudo
}
make
cd
${
curr_dir
}
cd
${
curr_dir
}
...
@@ -132,29 +137,29 @@ if echo $osinfo | grep -qwi "ubuntu" ; then
...
@@ -132,29 +137,29 @@ if echo $osinfo | grep -qwi "ubuntu" ; then
echo
"this is ubuntu system"
echo
"this is ubuntu system"
output_dir
=
"
${
top_dir
}
/debs"
output_dir
=
"
${
top_dir
}
/debs"
if
[
-d
${
output_dir
}
]
;
then
if
[
-d
${
output_dir
}
]
;
then
rm
-rf
${
output_dir
}
${
csudo
}
rm
-rf
${
output_dir
}
fi
fi
mkdir
-p
${
output_dir
}
${
csudo
}
mkdir
-p
${
output_dir
}
cd
${
script_dir
}
/deb
cd
${
script_dir
}
/deb
./makedeb.sh
${
compile_dir
}
${
output_dir
}
${
version
}
${
csudo
}
./makedeb.sh
${
compile_dir
}
${
output_dir
}
${
version
}
elif
echo
$osinfo
|
grep
-qwi
"centos"
;
then
elif
echo
$osinfo
|
grep
-qwi
"centos"
;
then
echo
"this is centos system"
echo
"this is centos system"
output_dir
=
"
${
top_dir
}
/rpms"
output_dir
=
"
${
top_dir
}
/rpms"
if
[
-d
${
output_dir
}
]
;
then
if
[
-d
${
output_dir
}
]
;
then
rm
-rf
${
output_dir
}
${
csudo
}
rm
-rf
${
output_dir
}
fi
fi
mkdir
-p
${
output_dir
}
${
csudo
}
mkdir
-p
${
output_dir
}
cd
${
script_dir
}
/rpm
cd
${
script_dir
}
/rpm
./makerpm.sh
${
compile_dir
}
${
output_dir
}
${
version
}
${
csudo
}
./makerpm.sh
${
compile_dir
}
${
output_dir
}
${
version
}
else
else
echo
"this is other linux system"
echo
"this is other linux system"
fi
fi
cd
${
script_dir
}
/tools
cd
${
script_dir
}
/tools
./makepkg.sh
${
compile_dir
}
${
version
}
"
${
build_time
}
"
${
csudo
}
./makepkg.sh
${
compile_dir
}
${
version
}
"
${
build_time
}
"
# 4. Clean up temporary compile directories
# 4. Clean up temporary compile directories
#rm -rf ${compile_dir}
#
${csudo}
rm -rf ${compile_dir}
packaging/rpm/makerpm.sh
浏览文件 @
e5edd507
...
@@ -19,18 +19,23 @@ echo "compile_dir: ${compile_dir}"
...
@@ -19,18 +19,23 @@ echo "compile_dir: ${compile_dir}"
echo
"pkg_dir:
${
pkg_dir
}
"
echo
"pkg_dir:
${
pkg_dir
}
"
echo
"spec_file:
${
spec_file
}
"
echo
"spec_file:
${
spec_file
}
"
csudo
=
""
if
command
-v
sudo
>
/dev/null
;
then
csudo
=
"sudo"
fi
if
[
-d
${
pkg_dir
}
]
;
then
if
[
-d
${
pkg_dir
}
]
;
then
rm
-rf
${
pkg_dir
}
${
csudo
}
rm
-rf
${
pkg_dir
}
fi
fi
mkdir
-p
${
pkg_dir
}
${
csudo
}
mkdir
-p
${
pkg_dir
}
cd
${
pkg_dir
}
cd
${
pkg_dir
}
mkdir
-p
BUILD BUILDROOT RPMS SOURCES SPECS SRPMS
${
csudo
}
mkdir
-p
BUILD BUILDROOT RPMS SOURCES SPECS SRPMS
rpmbuild
--define
=
"_version
${
tdengine_ver
}
"
--define
=
"_topdir
${
pkg_dir
}
"
--define
=
"_compiledir
${
compile_dir
}
"
-bb
${
spec_file
}
${
csudo
}
rpmbuild
--define
=
"_version
${
tdengine_ver
}
"
--define
=
"_topdir
${
pkg_dir
}
"
--define
=
"_compiledir
${
compile_dir
}
"
-bb
${
spec_file
}
# copy rpm package to output_dir, then clean temp dir
# copy rpm package to output_dir, then clean temp dir
#echo "rmpbuild end, cur_dir: $(pwd) "
#echo "rmpbuild end, cur_dir: $(pwd) "
cp
-rf
RPMS/
*
${
output_dir
}
${
csudo
}
cp
-rf
RPMS/
*
${
output_dir
}
cd
..
cd
..
rm
-rf
${
pkg_dir
}
${
csudo
}
rm
-rf
${
pkg_dir
}
packaging/rpm/tdengine.spec
浏览文件 @
e5edd507
...
@@ -76,12 +76,17 @@ function is_using_systemd() {
...
@@ -76,12 +76,17 @@ function is_using_systemd() {
fi
fi
}
}
csudo=""
if command -v sudo > /dev/null; then
csudo="sudo"
fi
# Stop the service if running
# Stop the service if running
if pidof taosd &> /dev/null; then
if pidof taosd &> /dev/null; then
if is_using_systemd; then
if is_using_systemd; then
sudo
systemctl stop taosd || :
${csudo}
systemctl stop taosd || :
else
else
sudo
service taosd stop || :
${csudo}
service taosd stop || :
fi
fi
echo "Stop taosd service success!"
echo "Stop taosd service success!"
sleep 1
sleep 1
...
@@ -89,20 +94,28 @@ fi
...
@@ -89,20 +94,28 @@ 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
sudo
rm -f %{homepath}/cfg/taos.cfg || :
${csudo}
rm -f %{homepath}/cfg/taos.cfg || :
fi
fi
#Scripts executed after installation
#Scripts executed after installation
%post
%post
csudo=""
if command -v sudo > /dev/null; then
csudo="sudo"
fi
cd %{homepath}/script
cd %{homepath}/script
sudo
./post.sh
${csudo}
./post.sh
# Scripts executed before uninstall
# Scripts executed before uninstall
%preun
%preun
csudo=""
if command -v sudo > /dev/null; then
csudo="sudo"
fi
# only remove package to call preun.sh, not but update(2)
# only remove package to call preun.sh, not but update(2)
if [ $1 -eq 0 ];then
if [ $1 -eq 0 ];then
cd %{homepath}/script
cd %{homepath}/script
sudo
./preun.sh
${csudo}
./preun.sh
fi
fi
# Scripts executed after uninstall
# Scripts executed after uninstall
...
@@ -110,14 +123,17 @@ fi
...
@@ -110,14 +123,17 @@ fi
# clean build dir
# clean build dir
%clean
%clean
rm -rf %{buildroot}
csudo=""
if command -v sudo > /dev/null; then
csudo="sudo"
fi
${csudo} rm -rf %{buildroot}
#Specify the files to be packaged
#Specify the files to be packaged
%files
%files
/*
/*
#%doc
#%doc
#Setting default permissions
#Setting default permissions
%defattr (-,root,root,0755)
%defattr (-,root,root,0755)
#%{prefix}
#%{prefix}
...
...
packaging/tools/install.sh
浏览文件 @
e5edd507
...
@@ -36,106 +36,114 @@ GREEN_DARK='\033[0;32m'
...
@@ -36,106 +36,114 @@ GREEN_DARK='\033[0;32m'
GREEN_UNDERLINE
=
'\033[4;32m'
GREEN_UNDERLINE
=
'\033[4;32m'
NC
=
'\033[0m'
NC
=
'\033[0m'
function
is_using_systemd
()
{
csudo
=
""
if
pidof systemd &> /dev/null
;
then
if
command
-v
sudo
>
/dev/null
;
then
return
0
csudo
=
"sudo"
else
fi
return
1
fi
}
if
!
is_using_systemd
;
then
service_mod
=
2
if
pidof systemd &> /dev/null
;
then
service_mod
=
0
elif
$(
which update-rc.d &> /dev/null
)
;
then
service_mod
=
1
service_config_dir
=
"/etc/init.d"
service_config_dir
=
"/etc/init.d"
else
service_mod
=
2
fi
fi
function
kill_taosd
()
{
pid
=
$(
ps
-ef
|
grep
"taosd"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
${
csudo
}
kill
-9
pid
||
:
}
function
install_main_path
()
{
function
install_main_path
()
{
#create install main dir and all sub dir
#create install main dir and all sub dir
sudo
rm
-rf
${
install_main_dir
}
||
:
${
csudo
}
rm
-rf
${
install_main_dir
}
||
:
sudo
mkdir
-p
${
install_main_dir
}
${
csudo
}
mkdir
-p
${
install_main_dir
}
sudo
mkdir
-p
${
install_main_dir
}
/cfg
${
csudo
}
mkdir
-p
${
install_main_dir
}
/cfg
sudo
mkdir
-p
${
install_main_dir
}
/bin
${
csudo
}
mkdir
-p
${
install_main_dir
}
/bin
sudo
mkdir
-p
${
install_main_dir
}
/connector
${
csudo
}
mkdir
-p
${
install_main_dir
}
/connector
sudo
mkdir
-p
${
install_main_dir
}
/driver
${
csudo
}
mkdir
-p
${
install_main_dir
}
/driver
sudo
mkdir
-p
${
install_main_dir
}
/examples
${
csudo
}
mkdir
-p
${
install_main_dir
}
/examples
sudo
mkdir
-p
${
install_main_dir
}
/include
${
csudo
}
mkdir
-p
${
install_main_dir
}
/include
sudo
mkdir
-p
${
install_main_dir
}
/init.d
${
csudo
}
mkdir
-p
${
install_main_dir
}
/init.d
}
}
function
install_bin
()
{
function
install_bin
()
{
# Remove links
# Remove links
sudo
rm
-f
${
bin_link_dir
}
/taos
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taos
||
:
sudo
rm
-f
${
bin_link_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosd
||
:
sudo
rm
-f
${
bin_link_dir
}
/taosdump
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdump
||
:
sudo
rm
-f
${
bin_link_dir
}
/rmtaos
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/rmtaos
||
:
sudo cp
-r
${
script_dir
}
/bin/
*
${
install_main_dir
}
/bin
&&
sudo
chmod
0555
${
install_main_dir
}
/bin/
*
${
csudo
}
cp
-r
${
script_dir
}
/bin/
*
${
install_main_dir
}
/bin
&&
${
csudo
}
chmod
0555
${
install_main_dir
}
/bin/
*
#Make link
#Make link
[
-x
${
install_main_dir
}
/bin/taos
]
&&
sudo
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
]
&&
sudo
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
]
&&
sudo
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/remove.sh
]
&&
sudo
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
||
:
}
}
function
install_lib
()
{
function
install_lib
()
{
# Remove links
# Remove links
sudo
rm
-f
${
lib_link_dir
}
/libtaos.
*
||
:
${
csudo
}
rm
-f
${
lib_link_dir
}
/libtaos.
*
||
:
sudo cp
-rf
${
script_dir
}
/driver/
*
${
install_main_dir
}
/driver
&&
sudo
chmod
777
${
install_main_dir
}
/driver/
*
${
csudo
}
cp
-rf
${
script_dir
}
/driver/
*
${
install_main_dir
}
/driver
&&
${
csudo
}
chmod
777
${
install_main_dir
}
/driver/
*
sudo
ln
-s
${
install_main_dir
}
/driver/libtaos.
*
${
lib_link_dir
}
/libtaos.so.1
${
csudo
}
ln
-s
${
install_main_dir
}
/driver/libtaos.
*
${
lib_link_dir
}
/libtaos.so.1
sudo
ln
-s
${
lib_link_dir
}
/libtaos.so.1
${
lib_link_dir
}
/libtaos.so
${
csudo
}
ln
-s
${
lib_link_dir
}
/libtaos.so.1
${
lib_link_dir
}
/libtaos.so
}
}
function
install_header
()
{
function
install_header
()
{
sudo
rm
-f
${
inc_link_dir
}
/taos.h
||
:
${
csudo
}
rm
-f
${
inc_link_dir
}
/taos.h
||
:
sudo cp
-f
${
script_dir
}
/inc/
*
${
install_main_dir
}
/include
&&
sudo
chmod
644
${
install_main_dir
}
/include/
*
${
csudo
}
cp
-f
${
script_dir
}
/inc/
*
${
install_main_dir
}
/include
&&
${
csudo
}
chmod
644
${
install_main_dir
}
/include/
*
sudo
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
}
}
function
install_config
()
{
function
install_config
()
{
#
sudo
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
sudo sudo
mkdir
-p
${
cfg_install_dir
}
${
csudo
}
mkdir
-p
${
cfg_install_dir
}
[
-f
${
script_dir
}
/cfg/taos.cfg
]
&&
sudo
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
}
sudo
chmod
644
${
cfg_install_dir
}
/
*
${
csudo
}
chmod
644
${
cfg_install_dir
}
/
*
fi
fi
sudo
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
sudo
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
()
{
sudo
rm
-rf
${
log_dir
}
||
:
${
csudo
}
rm
-rf
${
log_dir
}
||
:
sudo mkdir
-p
${
log_dir
}
&&
sudo
chmod
777
${
log_dir
}
${
csudo
}
mkdir
-p
${
log_dir
}
&&
${
csudo
}
chmod
777
${
log_dir
}
sudo
ln
-s
${
log_dir
}
${
install_main_dir
}
/log
${
csudo
}
ln
-s
${
log_dir
}
${
install_main_dir
}
/log
}
}
function
install_data
()
{
function
install_data
()
{
sudo
mkdir
-p
${
data_dir
}
${
csudo
}
mkdir
-p
${
data_dir
}
sudo
ln
-s
${
data_dir
}
${
install_main_dir
}
/data
${
csudo
}
ln
-s
${
data_dir
}
${
install_main_dir
}
/data
}
}
function
install_connector
()
{
function
install_connector
()
{
sudo
cp
-rf
${
script_dir
}
/connector/
*
${
install_main_dir
}
/connector
${
csudo
}
cp
-rf
${
script_dir
}
/connector/
*
${
install_main_dir
}
/connector
}
}
function
install_examples
()
{
function
install_examples
()
{
sudo
cp
-rf
${
script_dir
}
/examples/
*
${
install_main_dir
}
/examples
${
csudo
}
cp
-rf
${
script_dir
}
/examples/
*
${
install_main_dir
}
/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"
if
pidof taosd &> /dev/null
;
then
if
pidof taosd &> /dev/null
;
then
sudo
service taosd stop
||
:
${
csudo
}
service taosd stop
||
:
fi
fi
sudo
sed
-i
"
\|
${
restart_config_str
}
|d"
/etc/inittab
||
:
${
csudo
}
sed
-i
"
\|
${
restart_config_str
}
|d"
/etc/inittab
||
:
sudo
rm
-f
${
service_config_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
service_config_dir
}
/taosd
||
:
sudo
update-rc.d
-f
taosd remove
||
:
${
csudo
}
update-rc.d
-f
taosd remove
||
:
sudo
init q
||
:
${
csudo
}
init q
||
:
}
}
function
install_service_on_sysvinit
()
{
function
install_service_on_sysvinit
()
{
...
@@ -144,13 +152,13 @@ function install_service_on_sysvinit() {
...
@@ -144,13 +152,13 @@ function install_service_on_sysvinit() {
sleep
1
sleep
1
# Install taosd service
# Install taosd service
sudo
cp
-f
${
script_dir
}
/init.d/taosd
${
install_main_dir
}
/init.d
${
csudo
}
cp
-f
${
script_dir
}
/init.d/taosd
${
install_main_dir
}
/init.d
sudo cp
${
script_dir
}
/init.d/taosd
${
service_config_dir
}
&&
sudo
chmod
a+x
${
service_config_dir
}
/taosd
${
csudo
}
cp
${
script_dir
}
/init.d/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"
sudo grep
-q
-F
"
$restart_config_str
"
/etc/inittab
||
sudo
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
# TODO: for centos, change here
sudo
update-rc.d taosd defaults
${
csudo
}
update-rc.d taosd defaults
# chkconfig mysqld on
# chkconfig mysqld on
}
}
...
@@ -159,11 +167,11 @@ function clean_service_on_systemd() {
...
@@ -159,11 +167,11 @@ function clean_service_on_systemd() {
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..."
sudo
systemctl stop taosd &> /dev/null
||
echo
&> /dev/null
${
csudo
}
systemctl stop taosd &> /dev/null
||
echo
&> /dev/null
fi
fi
sudo
systemctl disable taosd &> /dev/null
||
echo
&> /dev/null
${
csudo
}
systemctl disable taosd &> /dev/null
||
echo
&> /dev/null
sudo
rm
-f
${
taosd_service_config
}
${
csudo
}
rm
-f
${
taosd_service_config
}
}
}
# taos:2345:respawn:/etc/init.d/taosd start
# taos:2345:respawn:/etc/init.d/taosd start
...
@@ -173,33 +181,36 @@ function install_service_on_systemd() {
...
@@ -173,33 +181,36 @@ function install_service_on_systemd() {
taosd_service_config
=
"
${
service_config_dir
}
/taosd.service"
taosd_service_config
=
"
${
service_config_dir
}
/taosd.service"
sudo
bash
-c
"echo '[Unit]' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo '[Unit]' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'Description=TDengine server service' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'Description=TDengine server service' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'After=network-online.target' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'After=network-online.target' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'Wants=network-online.target' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'Wants=network-online.target' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo '[Service]' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo '[Service]' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'Type=simple' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'Type=simple' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'ExecStart=/usr/bin/taosd' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'ExecStart=/usr/bin/taosd' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'LimitNOFILE=infinity' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'LimitNOFILE=infinity' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'LimitNPROC=infinity' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'LimitNPROC=infinity' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'LimitCORE=infinity' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'LimitCORE=infinity' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'TimeoutStartSec=0' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'TimeoutStartSec=0' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'StandardOutput=null' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'StandardOutput=null' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'Restart=always' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'Restart=always' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'StartLimitBurst=3' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'StartLimitBurst=3' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'StartLimitInterval=60s' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'StartLimitInterval=60s' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo '[Install]' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo '[Install]' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'WantedBy=multi-user.target' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'WantedBy=multi-user.target' >>
${
taosd_service_config
}
"
sudo
systemctl
enable
taosd
${
csudo
}
systemctl
enable
taosd
}
}
function
install_service
()
{
function
install_service
()
{
if
is_using_systemd
;
then
if
((
${
service_mod
}
==
0
))
;
then
install_service_on_systemd
install_service_on_systemd
el
se
el
if
((
${
service_mod
}
==
1
))
;
then
install_service_on_sysvinit
install_service_on_sysvinit
else
# must manual start taosd
kill_taosd
fi
fi
}
}
...
@@ -263,10 +274,12 @@ function update_TDengine() {
...
@@ -263,10 +274,12 @@ function update_TDengine() {
echo
-e
"
${
GREEN
}
Start to update TDEngine...
${
NC
}
"
echo
-e
"
${
GREEN
}
Start to update TDEngine...
${
NC
}
"
# Stop the service if running
# Stop the service if running
if
pidof taosd &> /dev/null
;
then
if
pidof taosd &> /dev/null
;
then
if
is_using_systemd
;
then
if
((
${
service_mod
}
==
0
))
;
then
sudo
systemctl stop taosd
||
:
${
csudo
}
systemctl stop taosd
||
:
elif
((
${
service_mod
}
==
1
))
;
then
${
csudo
}
service taosd stop
||
:
else
else
sudo
service taosd stop
||
:
kill_taosd
fi
fi
sleep
1
sleep
1
fi
fi
...
@@ -287,11 +300,13 @@ function update_TDengine() {
...
@@ -287,11 +300,13 @@ function update_TDengine() {
echo
-e
"
\0
33[44;32;1mTDengine is updated successfully!
${
NC
}
"
echo
-e
"
\0
33[44;32;1mTDengine is updated successfully!
${
NC
}
"
echo
echo
echo
-e
"
${
GREEN_DARK
}
To configure TDengine
${
NC
}
: edit /etc/taos/taos.cfg"
echo
-e
"
${
GREEN_DARK
}
To configure TDengine
${
NC
}
: edit /etc/taos/taos.cfg"
if
is_using_systemd
;
then
if
((
${
service_mod
}
==
0
))
;
then
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
: sudo systemctl start taosd
${
NC
}
"
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
:
${
csudo
}
systemctl start taosd
${
NC
}
"
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
" :
${
csudo
}
service taosd start
${
RED
}
after
${
NC
}
"
else
else
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
: sudo update-rc.d taosd default
${
RED
}
for the first time
${
NC
}
"
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
: ./taosd
${
NC
}
"
echo
-e
" : sudo service taosd start
${
RED
}
after
${
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
}
"
...
@@ -341,11 +356,13 @@ function install_TDengine() {
...
@@ -341,11 +356,13 @@ function install_TDengine() {
echo
-e
"
\0
33[44;32;1mTDengine is installed successfully!
${
NC
}
"
echo
-e
"
\0
33[44;32;1mTDengine is installed successfully!
${
NC
}
"
echo
echo
echo
-e
"
${
GREEN_DARK
}
To configure TDengine
${
NC
}
: edit /etc/taos/taos.cfg"
echo
-e
"
${
GREEN_DARK
}
To configure TDengine
${
NC
}
: edit /etc/taos/taos.cfg"
if
is_using_systemd
;
then
if
((
${
service_mod
}
==
0
))
;
then
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
: sudo systemctl start taosd
${
NC
}
"
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
:
${
csudo
}
systemctl start taosd
${
NC
}
"
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
" :
${
csudo
}
service taosd start
${
RED
}
after
${
NC
}
"
else
else
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
: sudo update-rc.d taosd default
${
RED
}
for the first time
${
NC
}
"
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
: ./taosd
${
NC
}
"
echo
-e
" : sudo service taosd start
${
RED
}
after
${
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/make_install.sh
浏览文件 @
e5edd507
...
@@ -38,6 +38,11 @@ GREEN_DARK='\033[0;32m'
...
@@ -38,6 +38,11 @@ GREEN_DARK='\033[0;32m'
GREEN_UNDERLINE
=
'\033[4;32m'
GREEN_UNDERLINE
=
'\033[4;32m'
NC
=
'\033[0m'
NC
=
'\033[0m'
csudo
=
""
if
command
-v
sudo
>
/dev/null
;
then
csudo
=
"sudo"
fi
function
is_using_systemd
()
{
function
is_using_systemd
()
{
if
pidof systemd &> /dev/null
;
then
if
pidof systemd &> /dev/null
;
then
return
0
return
0
...
@@ -52,100 +57,100 @@ fi
...
@@ -52,100 +57,100 @@ fi
function
install_main_path
()
{
function
install_main_path
()
{
#create install main dir and all sub dir
#create install main dir and all sub dir
sudo
rm
-rf
${
install_main_dir
}
||
:
${
csudo
}
rm
-rf
${
install_main_dir
}
||
:
sudo
mkdir
-p
${
install_main_dir
}
${
csudo
}
mkdir
-p
${
install_main_dir
}
sudo
mkdir
-p
${
install_main_dir
}
/cfg
${
csudo
}
mkdir
-p
${
install_main_dir
}
/cfg
sudo
mkdir
-p
${
install_main_dir
}
/bin
${
csudo
}
mkdir
-p
${
install_main_dir
}
/bin
sudo
mkdir
-p
${
install_main_dir
}
/connector
${
csudo
}
mkdir
-p
${
install_main_dir
}
/connector
sudo
mkdir
-p
${
install_main_dir
}
/driver
${
csudo
}
mkdir
-p
${
install_main_dir
}
/driver
sudo
mkdir
-p
${
install_main_dir
}
/examples
${
csudo
}
mkdir
-p
${
install_main_dir
}
/examples
sudo
mkdir
-p
${
install_main_dir
}
/include
${
csudo
}
mkdir
-p
${
install_main_dir
}
/include
sudo
mkdir
-p
${
install_main_dir
}
/init.d
${
csudo
}
mkdir
-p
${
install_main_dir
}
/init.d
}
}
function
install_bin
()
{
function
install_bin
()
{
# Remove links
# Remove links
sudo
rm
-f
${
bin_link_dir
}
/taos
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taos
||
:
sudo
rm
-f
${
bin_link_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosd
||
:
sudo
rm
-f
${
bin_link_dir
}
/taosdump
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdump
||
:
sudo
rm
-f
${
bin_link_dir
}
/rmtaos
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/rmtaos
||
:
sudo
cp
-r
${
binary_dir
}
/build/bin/taos
${
install_main_dir
}
/bin
${
csudo
}
cp
-r
${
binary_dir
}
/build/bin/taos
${
install_main_dir
}
/bin
sudo
cp
-r
${
binary_dir
}
/build/bin/taosd
${
install_main_dir
}
/bin
${
csudo
}
cp
-r
${
binary_dir
}
/build/bin/taosd
${
install_main_dir
}
/bin
sudo
cp
-r
${
binary_dir
}
/build/bin/taosdump
${
install_main_dir
}
/bin
${
csudo
}
cp
-r
${
binary_dir
}
/build/bin/taosdump
${
install_main_dir
}
/bin
sudo
cp
-r
${
script_dir
}
/remove.sh
${
install_main_dir
}
/bin
${
csudo
}
cp
-r
${
script_dir
}
/remove.sh
${
install_main_dir
}
/bin
sudo
chmod
0555
${
install_main_dir
}
/bin/
*
${
csudo
}
chmod
0555
${
install_main_dir
}
/bin/
*
#Make link
#Make link
[
-x
${
install_main_dir
}
/bin/taos
]
&&
sudo
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
]
&&
sudo
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
]
&&
sudo
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/remove.sh
]
&&
sudo
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
||
:
}
}
function
install_lib
()
{
function
install_lib
()
{
# Remove links
# Remove links
sudo
rm
-f
${
lib_link_dir
}
/libtaos.so
||
:
${
csudo
}
rm
-f
${
lib_link_dir
}
/libtaos.so
||
:
versioninfo
=
$(
${
script_dir
}
/get_version.sh
)
versioninfo
=
$(
${
script_dir
}
/get_version.sh
)
sudo cp
${
binary_dir
}
/build/lib/libtaos.so.
${
versioninfo
}
${
install_main_dir
}
/driver
&&
sudo
chmod
777
${
install_main_dir
}
/driver/
*
${
csudo
}
cp
${
binary_dir
}
/build/lib/libtaos.so.
${
versioninfo
}
${
install_main_dir
}
/driver
&&
${
csudo
}
chmod
777
${
install_main_dir
}
/driver/
*
sudo
ln
-sf
${
install_main_dir
}
/driver/libtaos.so.
${
versioninfo
}
${
lib_link_dir
}
/libtaos.so.1
${
csudo
}
ln
-sf
${
install_main_dir
}
/driver/libtaos.so.
${
versioninfo
}
${
lib_link_dir
}
/libtaos.so.1
sudo
ln
-sf
${
lib_link_dir
}
/libtaos.so.1
${
lib_link_dir
}
/libtaos.so
${
csudo
}
ln
-sf
${
lib_link_dir
}
/libtaos.so.1
${
lib_link_dir
}
/libtaos.so
}
}
function
install_header
()
{
function
install_header
()
{
sudo
rm
-f
${
inc_link_dir
}
/taos.h
||
:
${
csudo
}
rm
-f
${
inc_link_dir
}
/taos.h
||
:
sudo cp
-f
${
source_dir
}
/src/inc/taos.h
${
install_main_dir
}
/include
&&
sudo
chmod
644
${
install_main_dir
}
/include/
*
${
csudo
}
cp
-f
${
source_dir
}
/src/inc/taos.h
${
install_main_dir
}
/include
&&
${
csudo
}
chmod
644
${
install_main_dir
}
/include/
*
sudo
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
}
}
function
install_config
()
{
function
install_config
()
{
#
sudo
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
sudo sudo
mkdir
-p
${
cfg_install_dir
}
${
csudo
}
mkdir
-p
${
cfg_install_dir
}
[
-f
${
script_dir
}
/../cfg/taos.cfg
]
&&
sudo
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
}
sudo
chmod
644
${
cfg_install_dir
}
/
*
${
csudo
}
chmod
644
${
cfg_install_dir
}
/
*
fi
fi
sudo
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
sudo
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
()
{
sudo
rm
-rf
${
log_dir
}
||
:
${
csudo
}
rm
-rf
${
log_dir
}
||
:
sudo mkdir
-p
${
log_dir
}
&&
sudo
chmod
777
${
log_dir
}
${
csudo
}
mkdir
-p
${
log_dir
}
&&
${
csudo
}
chmod
777
${
log_dir
}
sudo
ln
-s
${
log_dir
}
${
install_main_dir
}
/log
${
csudo
}
ln
-s
${
log_dir
}
${
install_main_dir
}
/log
}
}
function
install_data
()
{
function
install_data
()
{
sudo
mkdir
-p
${
data_dir
}
${
csudo
}
mkdir
-p
${
data_dir
}
sudo
ln
-s
${
data_dir
}
${
install_main_dir
}
/data
${
csudo
}
ln
-s
${
data_dir
}
${
install_main_dir
}
/data
}
}
function
install_connector
()
{
function
install_connector
()
{
sudo
cp
-rf
${
source_dir
}
/src/connector/grafana
${
install_main_dir
}
/connector
${
csudo
}
cp
-rf
${
source_dir
}
/src/connector/grafana
${
install_main_dir
}
/connector
sudo
cp
-rf
${
source_dir
}
/src/connector/python
${
install_main_dir
}
/connector
${
csudo
}
cp
-rf
${
source_dir
}
/src/connector/python
${
install_main_dir
}
/connector
sudo
cp
-rf
${
source_dir
}
/src/connector/go
${
install_main_dir
}
/connector
${
csudo
}
cp
-rf
${
source_dir
}
/src/connector/go
${
install_main_dir
}
/connector
sudo cp
${
binary_dir
}
/build/lib/
*
.jar
${
install_main_dir
}
/connector &> /dev/null
&&
sudo
chmod
777
${
install_main_dir
}
/connector/
*
.jar
||
echo
&> /dev/null
${
csudo
}
cp
${
binary_dir
}
/build/lib/
*
.jar
${
install_main_dir
}
/connector &> /dev/null
&&
${
csudo
}
chmod
777
${
install_main_dir
}
/connector/
*
.jar
||
echo
&> /dev/null
}
}
function
install_examples
()
{
function
install_examples
()
{
sudo
cp
-rf
${
source_dir
}
/tests/examples/
*
${
install_main_dir
}
/examples
${
csudo
}
cp
-rf
${
source_dir
}
/tests/examples/
*
${
install_main_dir
}
/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"
if
pidof taosd &> /dev/null
;
then
if
pidof taosd &> /dev/null
;
then
sudo
service taosd stop
||
:
${
csudo
}
service taosd stop
||
:
fi
fi
sudo
sed
-i
"
\|
${
restart_config_str
}
|d"
/etc/inittab
||
:
${
csudo
}
sed
-i
"
\|
${
restart_config_str
}
|d"
/etc/inittab
||
:
sudo
rm
-f
${
service_config_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
service_config_dir
}
/taosd
||
:
sudo
update-rc.d
-f
taosd remove
||
:
${
csudo
}
update-rc.d
-f
taosd remove
||
:
sudo
init q
||
:
${
csudo
}
init q
||
:
}
}
function
install_service_on_sysvinit
()
{
function
install_service_on_sysvinit
()
{
...
@@ -154,12 +159,12 @@ function install_service_on_sysvinit() {
...
@@ -154,12 +159,12 @@ function install_service_on_sysvinit() {
sleep
1
sleep
1
# Install taosd service
# Install taosd service
sudo cp
${
script_dir
}
/../rpm/init.d/taosd
${
service_config_dir
}
&&
sudo
chmod
a+x
${
service_config_dir
}
/taosd
${
csudo
}
cp
${
script_dir
}
/../rpm/init.d/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"
sudo grep
-q
-F
"
$restart_config_str
"
/etc/inittab
||
sudo
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
# TODO: for centos, change here
sudo
update-rc.d taosd defaults
${
csudo
}
update-rc.d taosd defaults
# chkconfig mysqld on
# chkconfig mysqld on
}
}
...
@@ -168,11 +173,11 @@ function clean_service_on_systemd() {
...
@@ -168,11 +173,11 @@ function clean_service_on_systemd() {
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..."
sudo
systemctl stop taosd &> /dev/null
||
echo
&> /dev/null
${
csudo
}
systemctl stop taosd &> /dev/null
||
echo
&> /dev/null
fi
fi
sudo
systemctl disable taosd &> /dev/null
||
echo
&> /dev/null
${
csudo
}
systemctl disable taosd &> /dev/null
||
echo
&> /dev/null
sudo
rm
-f
${
taosd_service_config
}
${
csudo
}
rm
-f
${
taosd_service_config
}
}
}
# taos:2345:respawn:/etc/init.d/taosd start
# taos:2345:respawn:/etc/init.d/taosd start
...
@@ -182,26 +187,26 @@ function install_service_on_systemd() {
...
@@ -182,26 +187,26 @@ function install_service_on_systemd() {
taosd_service_config
=
"
${
service_config_dir
}
/taosd.service"
taosd_service_config
=
"
${
service_config_dir
}
/taosd.service"
sudo
bash
-c
"echo '[Unit]' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo '[Unit]' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'Description=TDengine server service' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'Description=TDengine server service' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'After=network-online.target' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'After=network-online.target' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'Wants=network-online.target' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'Wants=network-online.target' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo '[Service]' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo '[Service]' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'Type=simple' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'Type=simple' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'ExecStart=/usr/bin/taosd' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'ExecStart=/usr/bin/taosd' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'LimitNOFILE=infinity' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'LimitNOFILE=infinity' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'LimitNPROC=infinity' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'LimitNPROC=infinity' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'LimitCORE=infinity' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'LimitCORE=infinity' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'TimeoutStartSec=0' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'TimeoutStartSec=0' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'StandardOutput=null' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'StandardOutput=null' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'Restart=always' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'Restart=always' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'StartLimitBurst=3' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'StartLimitBurst=3' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'StartLimitInterval=60s' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'StartLimitInterval=60s' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo '[Install]' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo '[Install]' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'WantedBy=multi-user.target' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'WantedBy=multi-user.target' >>
${
taosd_service_config
}
"
sudo
systemctl
enable
taosd
${
csudo
}
systemctl
enable
taosd
}
}
function
install_service
()
{
function
install_service
()
{
...
@@ -217,9 +222,9 @@ function update_TDengine() {
...
@@ -217,9 +222,9 @@ function update_TDengine() {
# Stop the service if running
# Stop the service if running
if
pidof taosd &> /dev/null
;
then
if
pidof taosd &> /dev/null
;
then
if
is_using_systemd
;
then
if
is_using_systemd
;
then
sudo
systemctl stop taosd
||
:
${
csudo
}
systemctl stop taosd
||
:
else
else
sudo
service taosd stop
||
:
${
csudo
}
service taosd stop
||
:
fi
fi
sleep
1
sleep
1
fi
fi
...
@@ -240,10 +245,10 @@ function update_TDengine() {
...
@@ -240,10 +245,10 @@ function update_TDengine() {
echo
echo
echo
-e
"
${
GREEN_DARK
}
To configure TDengine
${
NC
}
: edit /etc/taos/taos.cfg"
echo
-e
"
${
GREEN_DARK
}
To configure TDengine
${
NC
}
: edit /etc/taos/taos.cfg"
# if is_using_systemd; then
# if is_using_systemd; then
# echo -e "${GREEN_DARK}To start TDengine ${NC}:
sudo
systemctl start taosd${NC}"
# echo -e "${GREEN_DARK}To start TDengine ${NC}:
${csudo}
systemctl start taosd${NC}"
# else
# else
# echo -e "${GREEN_DARK}To start TDengine ${NC}:
sudo
update-rc.d taosd default ${RED} for the first time${NC}"
# echo -e "${GREEN_DARK}To start TDengine ${NC}:
${csudo}
update-rc.d taosd default ${RED} for the first time${NC}"
# echo -e " :
sudo
service taosd start ${RED} after${NC}"
# echo -e " :
${csudo}
service taosd start ${RED} after${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}"
...
@@ -272,10 +277,10 @@ function install_TDengine() {
...
@@ -272,10 +277,10 @@ function install_TDengine() {
echo
echo
echo
-e
"
${
GREEN_DARK
}
To configure TDengine
${
NC
}
: edit /etc/taos/taos.cfg"
echo
-e
"
${
GREEN_DARK
}
To configure TDengine
${
NC
}
: edit /etc/taos/taos.cfg"
# if is_using_systemd; then
# if is_using_systemd; then
# echo -e "${GREEN_DARK}To start TDengine ${NC}:
sudo
systemctl start taosd${NC}"
# echo -e "${GREEN_DARK}To start TDengine ${NC}:
${csudo}
systemctl start taosd${NC}"
# else
# else
# echo -e "${GREEN_DARK}To start TDengine ${NC}:
sudo
update-rc.d taosd default ${RED} for the first time${NC}"
# echo -e "${GREEN_DARK}To start TDengine ${NC}:
${csudo}
update-rc.d taosd default ${RED} for the first time${NC}"
# echo -e " :
sudo
service taosd start ${RED} after${NC}"
# echo -e " :
${csudo}
service taosd start ${RED} after${NC}"
#3 fi
#3 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/makepkg.sh
浏览文件 @
e5edd507
...
@@ -40,7 +40,7 @@ mkdir -p ${install_dir}
...
@@ -40,7 +40,7 @@ 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_files
}
${
install_dir
}
/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_files
}
${
install_dir
}
/init.d
cd
${
install_dir
}
cd
${
install_dir
}
tar
-zcv
-f
taos.tar.gz
*
--remove-files
||
:
tar
-zcv
-f
taos.tar.gz
*
--remove-files
||
:
...
...
packaging/tools/post.sh
浏览文件 @
e5edd507
...
@@ -33,6 +33,25 @@ GREEN_DARK='\033[0;32m'
...
@@ -33,6 +33,25 @@ GREEN_DARK='\033[0;32m'
GREEN_UNDERLINE
=
'\033[4;32m'
GREEN_UNDERLINE
=
'\033[4;32m'
NC
=
'\033[0m'
NC
=
'\033[0m'
csudo
=
""
if
command
-v
sudo
>
/dev/null
;
then
csudo
=
"sudo"
fi
service_mod
=
2
if
pidof systemd &> /dev/null
;
then
service_mod
=
0
elif
$(
which update-rc.d &> /dev/null
)
;
then
service_mod
=
1
service_config_dir
=
"/etc/init.d"
else
service_mod
=
2
fi
function
kill_taosd
()
{
${
csudo
}
pkill
-f
taosd
||
:
}
function
is_using_systemd
()
{
function
is_using_systemd
()
{
if
pidof systemd &> /dev/null
;
then
if
pidof systemd &> /dev/null
;
then
return
0
return
0
...
@@ -41,58 +60,54 @@ function is_using_systemd() {
...
@@ -41,58 +60,54 @@ function is_using_systemd() {
fi
fi
}
}
if
!
is_using_systemd
;
then
service_config_dir
=
"/etc/init.d"
fi
function
install_include
()
{
function
install_include
()
{
sudo
rm
-f
${
inc_link_dir
}
/taos.h
||
:
${
csudo
}
rm
-f
${
inc_link_dir
}
/taos.h
||
:
sudo
ln
-s
${
inc_dir
}
/taos.h
${
inc_link_dir
}
/taos.h
${
csudo
}
ln
-s
${
inc_dir
}
/taos.h
${
inc_link_dir
}
/taos.h
}
}
function
install_lib
()
{
function
install_lib
()
{
sudo
rm
-f
${
lib_link_dir
}
/libtaos.so
||
:
${
csudo
}
rm
-f
${
lib_link_dir
}
/libtaos.so
||
:
sudo
ln
-s
${
lib_dir
}
/libtaos.
*
${
lib_link_dir
}
/libtaos.so.1
${
csudo
}
ln
-s
${
lib_dir
}
/libtaos.
*
${
lib_link_dir
}
/libtaos.so.1
sudo
ln
-s
${
lib_link_dir
}
/libtaos.so.1
${
lib_link_dir
}
/libtaos.so
${
csudo
}
ln
-s
${
lib_link_dir
}
/libtaos.so.1
${
lib_link_dir
}
/libtaos.so
}
}
function
install_bin
()
{
function
install_bin
()
{
# Remove links
# Remove links
sudo
rm
-f
${
bin_link_dir
}
/taos
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taos
||
:
sudo
rm
-f
${
bin_link_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosd
||
:
sudo
rm
-f
${
bin_link_dir
}
/taosdump
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdump
||
:
sudo
rm
-f
${
bin_link_dir
}
/rmtaos
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/rmtaos
||
:
sudo
chmod
0555
${
bin_dir
}
/
*
${
csudo
}
chmod
0555
${
bin_dir
}
/
*
#Make link
#Make link
[
-x
${
bin_dir
}
/taos
]
&&
sudo
ln
-s
${
bin_dir
}
/taos
${
bin_link_dir
}
/taos
||
:
[
-x
${
bin_dir
}
/taos
]
&&
${
csudo
}
ln
-s
${
bin_dir
}
/taos
${
bin_link_dir
}
/taos
||
:
[
-x
${
bin_dir
}
/taosd
]
&&
sudo
ln
-s
${
bin_dir
}
/taosd
${
bin_link_dir
}
/taosd
||
:
[
-x
${
bin_dir
}
/taosd
]
&&
${
csudo
}
ln
-s
${
bin_dir
}
/taosd
${
bin_link_dir
}
/taosd
||
:
[
-x
${
bin_dir
}
/taosdump
]
&&
sudo
ln
-s
${
bin_dir
}
/taosdump
${
bin_link_dir
}
/taosdump
||
:
[
-x
${
bin_dir
}
/taosdump
]
&&
${
csudo
}
ln
-s
${
bin_dir
}
/taosdump
${
bin_link_dir
}
/taosdump
||
:
# [ -x ${bin_dir}/remove.sh ] &&
sudo
ln -s ${bin_dir}/remove.sh ${bin_link_dir}/rmtaos || :
# [ -x ${bin_dir}/remove.sh ] &&
${csudo}
ln -s ${bin_dir}/remove.sh ${bin_link_dir}/rmtaos || :
}
}
function
install_config
()
{
function
install_config
()
{
if
[
!
-f
${
cfg_install_dir
}
/taos.cfg
]
;
then
if
[
!
-f
${
cfg_install_dir
}
/taos.cfg
]
;
then
sudo sudo
mkdir
-p
${
cfg_install_dir
}
${
csudo
}
${
csudo
}
mkdir
-p
${
cfg_install_dir
}
[
-f
${
cfg_dir
}
/taos.cfg
]
&&
sudo
cp
${
cfg_dir
}
/taos.cfg
${
cfg_install_dir
}
[
-f
${
cfg_dir
}
/taos.cfg
]
&&
${
csudo
}
cp
${
cfg_dir
}
/taos.cfg
${
cfg_install_dir
}
sudo
chmod
644
${
cfg_install_dir
}
/
*
${
csudo
}
chmod
644
${
cfg_install_dir
}
/
*
fi
fi
sudo
mv
${
cfg_dir
}
/taos.cfg
${
cfg_dir
}
/taos.cfg.org
${
csudo
}
mv
${
cfg_dir
}
/taos.cfg
${
cfg_dir
}
/taos.cfg.org
sudo
ln
-s
${
cfg_install_dir
}
/taos.cfg
${
cfg_dir
}
${
csudo
}
ln
-s
${
cfg_install_dir
}
/taos.cfg
${
cfg_dir
}
}
}
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"
#if pidof taosd &> /dev/null; then
#if pidof taosd &> /dev/null; then
#
sudo
service taosd stop || :
#
${csudo}
service taosd stop || :
#fi
#fi
sudo
sed
-i
"
\|
${
restart_config_str
}
|d"
/etc/inittab
||
:
${
csudo
}
sed
-i
"
\|
${
restart_config_str
}
|d"
/etc/inittab
||
:
sudo
rm
-f
${
service_config_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
service_config_dir
}
/taosd
||
:
sudo
update-rc.d
-f
taosd remove
||
:
${
csudo
}
update-rc.d
-f
taosd remove
||
:
sudo
init q
||
:
${
csudo
}
init q
||
:
}
}
function
install_service_on_sysvinit
()
{
function
install_service_on_sysvinit
()
{
...
@@ -101,13 +116,13 @@ function install_service_on_sysvinit() {
...
@@ -101,13 +116,13 @@ function install_service_on_sysvinit() {
sleep
1
sleep
1
# Install taosd service
# Install taosd service
sudo cp
%
{
init_d_dir
}
/taosd
${
service_config_dir
}
&&
sudo
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"
sudo grep
-q
-F
"
$restart_config_str
"
/etc/inittab
||
sudo
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
# TODO: for centos, change here
sudo
update-rc.d taosd defaults
${
csudo
}
update-rc.d taosd defaults
# chkconfig mysqld on
# chkconfig mysqld on
}
}
...
@@ -117,11 +132,11 @@ function clean_service_on_systemd() {
...
@@ -117,11 +132,11 @@ function clean_service_on_systemd() {
# taosd service already is stoped before install
# taosd service already is stoped before install
#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..."
#
sudo
systemctl stop taosd &> /dev/null || echo &> /dev/null
#
${csudo}
systemctl stop taosd &> /dev/null || echo &> /dev/null
#fi
#fi
sudo
systemctl disable taosd &> /dev/null
||
echo
&> /dev/null
${
csudo
}
systemctl disable taosd &> /dev/null
||
echo
&> /dev/null
sudo
rm
-f
${
taosd_service_config
}
${
csudo
}
rm
-f
${
taosd_service_config
}
}
}
# taos:2345:respawn:/etc/init.d/taosd start
# taos:2345:respawn:/etc/init.d/taosd start
...
@@ -131,33 +146,36 @@ function install_service_on_systemd() {
...
@@ -131,33 +146,36 @@ function install_service_on_systemd() {
taosd_service_config
=
"
${
service_config_dir
}
/taosd.service"
taosd_service_config
=
"
${
service_config_dir
}
/taosd.service"
sudo
bash
-c
"echo '[Unit]' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo '[Unit]' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'Description=TDengine server service' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'Description=TDengine server service' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'After=network-online.target' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'After=network-online.target' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'Wants=network-online.target' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'Wants=network-online.target' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo '[Service]' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo '[Service]' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'Type=simple' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'Type=simple' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'ExecStart=/usr/bin/taosd' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'ExecStart=/usr/bin/taosd' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'LimitNOFILE=infinity' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'LimitNOFILE=infinity' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'LimitNPROC=infinity' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'LimitNPROC=infinity' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'LimitCORE=infinity' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'LimitCORE=infinity' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'TimeoutStartSec=0' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'TimeoutStartSec=0' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'StandardOutput=null' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'StandardOutput=null' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'Restart=always' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'Restart=always' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'StartLimitBurst=3' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'StartLimitBurst=3' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'StartLimitInterval=60s' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'StartLimitInterval=60s' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo '[Install]' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo '[Install]' >>
${
taosd_service_config
}
"
sudo
bash
-c
"echo 'WantedBy=multi-user.target' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'WantedBy=multi-user.target' >>
${
taosd_service_config
}
"
sudo
systemctl
enable
taosd
${
csudo
}
systemctl
enable
taosd
}
}
function
install_service
()
{
function
install_service
()
{
if
is_using_systemd
;
then
if
((
${
service_mod
}
==
0
))
;
then
install_service_on_systemd
install_service_on_systemd
el
se
el
if
((
${
service_mod
}
==
1
))
;
then
install_service_on_sysvinit
install_service_on_sysvinit
else
# manual start taosd
kill_taosd
fi
fi
}
}
...
@@ -165,14 +183,14 @@ function install_TDengine() {
...
@@ -165,14 +183,14 @@ function install_TDengine() {
echo
-e
"
${
GREEN
}
Start to install TDEngine...
${
NC
}
"
echo
-e
"
${
GREEN
}
Start to install TDEngine...
${
NC
}
"
#install log and data dir , then ln to /usr/local/taos
#install log and data dir , then ln to /usr/local/taos
sudo mkdir
-p
${
log_dir
}
&&
sudo
chmod
777
${
log_dir
}
${
csudo
}
mkdir
-p
${
log_dir
}
&&
${
csudo
}
chmod
777
${
log_dir
}
sudo
mkdir
-p
${
data_dir
}
${
csudo
}
mkdir
-p
${
data_dir
}
sudo
rm
-rf
${
log_link_dir
}
||
:
${
csudo
}
rm
-rf
${
log_link_dir
}
||
:
sudo
rm
-rf
${
data_link_dir
}
||
:
${
csudo
}
rm
-rf
${
data_link_dir
}
||
:
sudo
ln
-s
${
log_dir
}
${
log_link_dir
}
||
:
${
csudo
}
ln
-s
${
log_dir
}
${
log_link_dir
}
||
:
sudo
ln
-s
${
data_dir
}
${
data_link_dir
}
||
:
${
csudo
}
ln
-s
${
data_dir
}
${
data_link_dir
}
||
:
# Install include, lib, binary and service
# Install include, lib, binary and service
install_include
install_include
...
@@ -186,11 +204,13 @@ function install_TDengine() {
...
@@ -186,11 +204,13 @@ function install_TDengine() {
echo
-e
"
\0
33[44;32;1mTDengine is installed successfully!
${
NC
}
"
echo
-e
"
\0
33[44;32;1mTDengine is installed successfully!
${
NC
}
"
echo
echo
echo
-e
"
${
GREEN_DARK
}
To configure TDengine
${
NC
}
: edit /etc/taos/taos.cfg"
echo
-e
"
${
GREEN_DARK
}
To configure TDengine
${
NC
}
: edit /etc/taos/taos.cfg"
if
is_using_systemd
;
then
if
((
${
service_mod
}
==
0
))
;
then
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
: sudo systemctl start taosd
${
NC
}
"
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
:
${
csudo
}
systemctl start taosd
${
NC
}
"
else
elif
((
${
service_mod
}
==
1
))
;
then
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
: sudo update-rc.d taosd default
${
RED
}
for the first time
${
NC
}
"
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
:
${
csudo
}
update-rc.d taosd default
${
RED
}
for the first time
${
NC
}
"
echo
-e
" : sudo service taosd start
${
RED
}
after
${
NC
}
"
echo
-e
" :
${
csudo
}
service taosd start
${
RED
}
after
${
NC
}
"
else
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/preun.sh
浏览文件 @
e5edd507
...
@@ -17,6 +17,11 @@ cfg_link_dir="/usr/local/taos/cfg"
...
@@ -17,6 +17,11 @@ cfg_link_dir="/usr/local/taos/cfg"
service_config_dir
=
"/etc/systemd/system"
service_config_dir
=
"/etc/systemd/system"
taos_service_name
=
"taosd"
taos_service_name
=
"taosd"
csudo
=
""
if
command
-v
sudo
>
/dev/null
;
then
csudo
=
"sudo"
fi
function
is_using_systemd
()
{
function
is_using_systemd
()
{
if
pidof systemd &> /dev/null
;
then
if
pidof systemd &> /dev/null
;
then
return
0
return
0
...
@@ -34,11 +39,11 @@ function clean_service_on_systemd() {
...
@@ -34,11 +39,11 @@ function clean_service_on_systemd() {
if
systemctl is-active
--quiet
${
taos_service_name
}
;
then
if
systemctl is-active
--quiet
${
taos_service_name
}
;
then
echo
"TDengine taosd is running, stopping it..."
echo
"TDengine taosd is running, stopping it..."
sudo
systemctl stop
${
taos_service_name
}
&> /dev/null
||
echo
&> /dev/null
${
csudo
}
systemctl stop
${
taos_service_name
}
&> /dev/null
||
echo
&> /dev/null
fi
fi
sudo
systemctl disable
${
taos_service_name
}
&> /dev/null
||
echo
&> /dev/null
${
csudo
}
systemctl disable
${
taos_service_name
}
&> /dev/null
||
echo
&> /dev/null
sudo
rm
-f
${
taosd_service_config
}
${
csudo
}
rm
-f
${
taosd_service_config
}
}
}
function
clean_service_on_sysvinit
()
{
function
clean_service_on_sysvinit
()
{
...
@@ -46,13 +51,13 @@ function clean_service_on_sysvinit() {
...
@@ -46,13 +51,13 @@ function clean_service_on_sysvinit() {
if
pidof taosd &> /dev/null
;
then
if
pidof taosd &> /dev/null
;
then
echo
"TDengine taosd is running, stopping it..."
echo
"TDengine taosd is running, stopping it..."
sudo
service taosd stop
||
:
${
csudo
}
service taosd stop
||
:
fi
fi
sudo
sed
-i
"
\|
${
restart_config_str
}
|d"
/etc/inittab
||
:
${
csudo
}
sed
-i
"
\|
${
restart_config_str
}
|d"
/etc/inittab
||
:
sudo
rm
-f
${
service_config_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
service_config_dir
}
/taosd
||
:
sudo
update-rc.d
-f
taosd remove
||
:
${
csudo
}
update-rc.d
-f
taosd remove
||
:
sudo
init q
||
:
${
csudo
}
init q
||
:
}
}
function
clean_service
()
{
function
clean_service
()
{
...
@@ -67,14 +72,14 @@ function clean_service() {
...
@@ -67,14 +72,14 @@ function clean_service() {
clean_service
clean_service
# Remove all links
# Remove all links
sudo
rm
-f
${
bin_link_dir
}
/taos
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taos
||
:
sudo
rm
-f
${
bin_link_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosd
||
:
sudo
rm
-f
${
bin_link_dir
}
/taosdump
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdump
||
:
sudo
rm
-f
${
cfg_link_dir
}
/
*
||
:
${
csudo
}
rm
-f
${
cfg_link_dir
}
/
*
||
:
sudo
rm
-f
${
inc_link_dir
}
/taos.h
||
:
${
csudo
}
rm
-f
${
inc_link_dir
}
/taos.h
||
:
sudo
rm
-f
${
lib_link_dir
}
/libtaos.
*
||
:
${
csudo
}
rm
-f
${
lib_link_dir
}
/libtaos.
*
||
:
sudo
rm
-f
${
log_link_dir
}
||
:
${
csudo
}
rm
-f
${
log_link_dir
}
||
:
sudo
rm
-f
${
data_link_dir
}
||
:
${
csudo
}
rm
-f
${
data_link_dir
}
||
:
echo
-e
"
${
GREEN
}
TDEngine is removed successfully!
${
NC
}
"
echo
-e
"
${
GREEN
}
TDEngine is removed successfully!
${
NC
}
"
packaging/tools/remove.sh
浏览文件 @
e5edd507
...
@@ -29,6 +29,11 @@ service_config_dir="/etc/systemd/system"
...
@@ -29,6 +29,11 @@ service_config_dir="/etc/systemd/system"
taos_service_name
=
"taosd"
taos_service_name
=
"taosd"
nginx_service_name
=
"tdnginx"
nginx_service_name
=
"tdnginx"
csudo
=
""
if
command
-v
sudo
>
/dev/null
;
then
csudo
=
"sudo"
fi
function
is_using_systemd
()
{
function
is_using_systemd
()
{
if
pidof systemd &> /dev/null
;
then
if
pidof systemd &> /dev/null
;
then
return
0
return
0
...
@@ -43,45 +48,45 @@ fi
...
@@ -43,45 +48,45 @@ fi
function
clean_bin
()
{
function
clean_bin
()
{
# Remove link
# Remove link
sudo
rm
-f
${
bin_link_dir
}
/taos
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taos
||
:
sudo
rm
-f
${
bin_link_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosd
||
:
sudo
rm
-f
${
bin_link_dir
}
/taosdump
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdump
||
:
sudo
rm
-f
${
bin_link_dir
}
/rmtaos
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/rmtaos
||
:
# Remove binary files
# Remove binary files
#
sudo
rm -rf ${bin_dir} || :
#
${csudo}
rm -rf ${bin_dir} || :
}
}
function
clean_lib
()
{
function
clean_lib
()
{
# Remove link
# Remove link
sudo
rm
-f
${
lib_link_dir
}
/libtaos.
*
||
:
${
csudo
}
rm
-f
${
lib_link_dir
}
/libtaos.
*
||
:
#
sudo
rm -f /usr/lib/libtaos.so || :
#
${csudo}
rm -f /usr/lib/libtaos.so || :
#
sudo
rm -rf ${lib_dir} || :
#
${csudo}
rm -rf ${lib_dir} || :
}
}
function
clean_header
()
{
function
clean_header
()
{
# Remove link
# Remove link
sudo
rm
-f
${
inc_link_dir
}
/taos.h
||
:
${
csudo
}
rm
-f
${
inc_link_dir
}
/taos.h
||
:
#
sudo
rm -rf ${header_dir}
#
${csudo}
rm -rf ${header_dir}
}
}
function
clean_config
()
{
function
clean_config
()
{
# Remove link
# Remove link
sudo
rm
-f
${
cfg_link_dir
}
/
*
||
:
${
csudo
}
rm
-f
${
cfg_link_dir
}
/
*
||
:
#
sudo
rm -rf ${cfg_link_dir} || :
#
${csudo}
rm -rf ${cfg_link_dir} || :
}
}
function
clean_log
()
{
function
clean_log
()
{
if
grep
-e
'^\s*logDir.*$'
${
cfg_dir
}
/taos.cfg &> /dev/null
;
then
if
grep
-e
'^\s*logDir.*$'
${
cfg_dir
}
/taos.cfg &> /dev/null
;
then
config_log_dir
=
$(
cut
-d
' '
-f2
<<<
$(
grep
-e
'^\s*logDir.*$'
${
cfg_dir
}
/taos.cfg
))
config_log_dir
=
$(
cut
-d
' '
-f2
<<<
$(
grep
-e
'^\s*logDir.*$'
${
cfg_dir
}
/taos.cfg
))
# echo "Removing log dir ${config_log_dir}......"
# echo "Removing log dir ${config_log_dir}......"
sudo
rm
-rf
${
config_log_dir
}
||
:
${
csudo
}
rm
-rf
${
config_log_dir
}
||
:
fi
fi
# Remove link
# Remove link
sudo
rm
-rf
${
log_link_dir
}
||
:
${
csudo
}
rm
-rf
${
log_link_dir
}
||
:
sudo
rm
-rf
${
log_dir
}
||
:
${
csudo
}
rm
-rf
${
log_dir
}
||
:
}
}
function
clean_service_on_systemd
()
{
function
clean_service_on_systemd
()
{
...
@@ -89,11 +94,11 @@ function clean_service_on_systemd() {
...
@@ -89,11 +94,11 @@ function clean_service_on_systemd() {
if
systemctl is-active
--quiet
${
taos_service_name
}
;
then
if
systemctl is-active
--quiet
${
taos_service_name
}
;
then
echo
"TDengine taosd is running, stopping it..."
echo
"TDengine taosd is running, stopping it..."
sudo
systemctl stop
${
taos_service_name
}
&> /dev/null
||
echo
&> /dev/null
${
csudo
}
systemctl stop
${
taos_service_name
}
&> /dev/null
||
echo
&> /dev/null
fi
fi
sudo
systemctl disable
${
taos_service_name
}
&> /dev/null
||
echo
&> /dev/null
${
csudo
}
systemctl disable
${
taos_service_name
}
&> /dev/null
||
echo
&> /dev/null
sudo
rm
-f
${
taosd_service_config
}
${
csudo
}
rm
-f
${
taosd_service_config
}
}
}
function
clean_service_on_sysvinit
()
{
function
clean_service_on_sysvinit
()
{
...
@@ -101,13 +106,13 @@ function clean_service_on_sysvinit() {
...
@@ -101,13 +106,13 @@ function clean_service_on_sysvinit() {
if
pidof taosd &> /dev/null
;
then
if
pidof taosd &> /dev/null
;
then
echo
"TDengine taosd is running, stopping it..."
echo
"TDengine taosd is running, stopping it..."
sudo
service taosd stop
||
:
${
csudo
}
service taosd stop
||
:
fi
fi
sudo
sed
-i
"
\|
${
restart_config_str
}
|d"
/etc/inittab
||
:
${
csudo
}
sed
-i
"
\|
${
restart_config_str
}
|d"
/etc/inittab
||
:
sudo
rm
-f
${
service_config_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
service_config_dir
}
/taosd
||
:
sudo
update-rc.d
-f
taosd remove
||
:
${
csudo
}
update-rc.d
-f
taosd remove
||
:
sudo
init q
||
:
${
csudo
}
init q
||
:
}
}
function
clean_service
()
{
function
clean_service
()
{
...
@@ -141,16 +146,16 @@ clean_log
...
@@ -141,16 +146,16 @@ clean_log
# Remove configuration file
# Remove configuration file
clean_config
clean_config
# Remove data directory
# Remove data directory
sudo
rm
-rf
${
data_link_dir
}
||
:
${
csudo
}
rm
-rf
${
data_link_dir
}
||
:
[
"
$isAll
"
=
"false"
]
&&
exit
0
||
:
[
"
$isAll
"
=
"false"
]
&&
exit
0
||
:
echo
-e
-n
"
${
RED
}
Do you want to delete data stored in TDengine? [y/N]:
${
NC
}
"
echo
-e
-n
"
${
RED
}
Do you want to delete data stored in TDengine? [y/N]:
${
NC
}
"
read
is_delete
read
is_delete
while
true
;
do
while
true
;
do
if
[
"
${
is_delete
}
"
=
"y"
]
||
[
"
${
is_delete
}
"
=
"Y"
]
;
then
if
[
"
${
is_delete
}
"
=
"y"
]
||
[
"
${
is_delete
}
"
=
"Y"
]
;
then
sudo
rm
-rf
${
data_dir
}
${
csudo
}
rm
-rf
${
data_dir
}
# echo "Removing data file ${config_data_dir}..."
# echo "Removing data file ${config_data_dir}..."
[
-n
${
config_data_dir
}
]
&&
sudo
rm
-rf
${
config_data_dir
}
[
-n
${
config_data_dir
}
]
&&
${
csudo
}
rm
-rf
${
config_data_dir
}
break
break
elif
[
"
${
is_delete
}
"
=
"n"
]
||
[
"
${
is_delete
}
"
=
"N"
]
;
then
elif
[
"
${
is_delete
}
"
=
"n"
]
||
[
"
${
is_delete
}
"
=
"N"
]
;
then
break
break
...
@@ -159,15 +164,15 @@ while true; do
...
@@ -159,15 +164,15 @@ while true; do
fi
fi
done
done
sudo
rm
-rf
${
install_main_dir
}
${
csudo
}
rm
-rf
${
install_main_dir
}
osinfo
=
$(
awk
-F
=
'/^NAME/{print $2}'
/etc/os-release
)
osinfo
=
$(
awk
-F
=
'/^NAME/{print $2}'
/etc/os-release
)
if
echo
$osinfo
|
grep
-qwi
"ubuntu"
;
then
if
echo
$osinfo
|
grep
-qwi
"ubuntu"
;
then
# echo "this is ubuntu system"
# echo "this is ubuntu system"
sudo
rm
-f
/var/lib/dpkg/info/tdengine
*
||
:
${
csudo
}
rm
-f
/var/lib/dpkg/info/tdengine
*
||
:
elif
echo
$osinfo
|
grep
-qwi
"centos"
;
then
elif
echo
$osinfo
|
grep
-qwi
"centos"
;
then
echo
"this is centos system"
echo
"this is centos system"
sudo
rpm
-e
--noscripts
tdengine
||
:
${
csudo
}
rpm
-e
--noscripts
tdengine
||
:
fi
fi
echo
-e
"
${
GREEN
}
TDEngine is removed successfully!
${
NC
}
"
echo
-e
"
${
GREEN
}
TDEngine is removed successfully!
${
NC
}
"
src/connector/go/src/taosSql/result.go
浏览文件 @
e5edd507
...
@@ -15,8 +15,8 @@
...
@@ -15,8 +15,8 @@
package
taosSql
package
taosSql
/*
/*
#cgo CFLAGS : -I/usr/
local/include/taos/
#cgo CFLAGS : -I/usr/
include
#cgo LDFLAGS: -L/usr/l
ocal/lib/taos
-ltaos
#cgo LDFLAGS: -L/usr/l
ib
-ltaos
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
...
...
src/connector/go/src/taosSql/rows.go
浏览文件 @
e5edd507
...
@@ -14,8 +14,8 @@
...
@@ -14,8 +14,8 @@
*/
*/
package
taosSql
package
taosSql
/*
/*
#cgo CFLAGS : -I/usr/
local/include/taos/
#cgo CFLAGS : -I/usr/
include
#cgo LDFLAGS: -L/usr/l
ocal/lib/taos
-ltaos
#cgo LDFLAGS: -L/usr/l
ib
-ltaos
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
...
...
src/connector/go/src/taosSql/taosSqlCgo.go
浏览文件 @
e5edd507
...
@@ -15,8 +15,8 @@
...
@@ -15,8 +15,8 @@
package
taosSql
package
taosSql
/*
/*
#cgo CFLAGS : -I/usr/
local/include/taos/
#cgo CFLAGS : -I/usr/
include
#cgo LDFLAGS: -L/usr/l
ocal/lib/taos
-ltaos
#cgo LDFLAGS: -L/usr/l
ib
-ltaos
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录