未验证 提交 d05b134a 编写于 作者: wafwerar's avatar wafwerar 提交者: GitHub

os: Mac package (#17201)

* os: Mac package

* os: Mac package

* os: Mac package

* os: Mac package

* os: Mac package

* os: Mac package

* os: Mac package

* os: Mac package

* os: Mac package

* os: Mac package

* os: Mac package

* os: Mac package
上级 0575cc26
...@@ -104,6 +104,12 @@ sudo yum install -y zlib-devel xz-devel snappy-devel jansson jansson-devel pkgco ...@@ -104,6 +104,12 @@ sudo yum install -y zlib-devel xz-devel snappy-devel jansson jansson-devel pkgco
sudo yum config-manager --set-enabled Powertools sudo yum config-manager --set-enabled Powertools
``` ```
### MacOS
```
sudo brew install argp-standalone pkgconfig
```
### 设置 golang 开发环境 ### 设置 golang 开发环境
TDengine 包含数个使用 Go 语言开发的组件,比如taosAdapter, 请参考 golang.org 官方文档设置 go 开发环境。 TDengine 包含数个使用 Go 语言开发的组件,比如taosAdapter, 请参考 golang.org 官方文档设置 go 开发环境。
...@@ -210,14 +216,14 @@ cmake .. -G "NMake Makefiles" ...@@ -210,14 +216,14 @@ cmake .. -G "NMake Makefiles"
nmake nmake
``` ```
<!-- ### macOS 系统 ### macOS 系统
安装 Xcode 命令行工具和 cmake. 在 Catalina 和 Big Sur 操作系统上,需要安装 XCode 11.4+ 版本。 安装 Xcode 命令行工具和 cmake. 在 Catalina 和 Big Sur 操作系统上,需要安装 XCode 11.4+ 版本。
```bash ```bash
mkdir debug && cd debug mkdir debug && cd debug
cmake .. && cmake --build . cmake .. && cmake --build .
``` --> ```
# 安装 # 安装
...@@ -263,6 +269,24 @@ nmake install ...@@ -263,6 +269,24 @@ nmake install
sudo make install sudo make install
``` ```
用户可以在[文件目录结构](https://docs.taosdata.com/reference/directory/)中了解更多在操作系统中生成的目录或文件。
从源代码安装也会为 TDengine 配置服务管理 ,用户也可以选择[从安装包中安装](https://docs.taosdata.com/get-started/package/)
安装成功后,可以在应用程序中双击 TDengine 图标启动服务,或者在终端中启动 TDengine 服务:
```bash
launchctl start taosd
```
用户可以使用 TDengine CLI 来连接 TDengine 服务,在终端中,输入:
```bash
taos
```
如果 TDengine CLI 连接服务成功,将会打印出欢迎消息和版本信息。如果失败,则会打印出错误消息。
## 快速运行 ## 快速运行
如果不希望以服务方式运行 TDengine,也可以在终端中直接运行它。也即在生成完成后,执行以下命令(在 Windows 下,生成的可执行文件会带有 .exe 后缀,例如会名为 taosd.exe ): 如果不希望以服务方式运行 TDengine,也可以在终端中直接运行它。也即在生成完成后,执行以下命令(在 Windows 下,生成的可执行文件会带有 .exe 后缀,例如会名为 taosd.exe ):
......
...@@ -105,6 +105,12 @@ If the PowerTools installation fails, you can try to use: ...@@ -105,6 +105,12 @@ If the PowerTools installation fails, you can try to use:
sudo yum config-manager --set-enabled powertools sudo yum config-manager --set-enabled powertools
``` ```
### MacOS
```
sudo brew install argp-standalone pkgconfig
```
### Setup golang environment ### Setup golang environment
TDengine includes a few components like taosAdapter developed by Go language. Please refer to golang.org official documentation for golang environment setup. TDengine includes a few components like taosAdapter developed by Go language. Please refer to golang.org official documentation for golang environment setup.
...@@ -213,14 +219,14 @@ cmake .. -G "NMake Makefiles" ...@@ -213,14 +219,14 @@ cmake .. -G "NMake Makefiles"
nmake nmake
``` ```
<!-- ### On macOS platform ### On macOS platform
Please install XCode command line tools and cmake. Verified with XCode 11.4+ on Catalina and Big Sur. Please install XCode command line tools and cmake. Verified with XCode 11.4+ on Catalina and Big Sur.
```shell ```shell
mkdir debug && cd debug mkdir debug && cd debug
cmake .. && cmake --build . cmake .. && cmake --build .
``` --> ```
# Installing # Installing
...@@ -258,7 +264,7 @@ After building successfully, TDengine can be installed by: ...@@ -258,7 +264,7 @@ After building successfully, TDengine can be installed by:
nmake install nmake install
``` ```
<!--
## On macOS platform ## On macOS platform
After building successfully, TDengine can be installed by: After building successfully, TDengine can be installed by:
...@@ -266,7 +272,24 @@ After building successfully, TDengine can be installed by: ...@@ -266,7 +272,24 @@ After building successfully, TDengine can be installed by:
```bash ```bash
sudo make install sudo make install
``` ```
-->
Users can find more information about directories installed on the system in the [directory and files](https://docs.tdengine.com/reference/directory/) section.
Installing from source code will also configure service management for TDengine.Users can also choose to [install from packages](https://docs.tdengine.com/get-started/package/) for it.
To start the service after installation, double-click the /applications/TDengine to start the program, or in a terminal, use:
```bash
launchctl start taosd
```
Then users can use the TDengine CLI to connect the TDengine server. In a terminal, use:
```bash
taos
```
If TDengine CLI connects the server successfully, welcome messages and version info are printed. Otherwise, an error message is shown.
## Quick Run ## Quick Run
......
...@@ -111,6 +111,13 @@ Note: TDengine only supports Windows Server 2016/2019 and Windows 10/11 on the W ...@@ -111,6 +111,13 @@ Note: TDengine only supports Windows Server 2016/2019 and Windows 10/11 on the W
<PkgListV3 type={3}/> <PkgListV3 type={3}/>
2. Run the downloaded package to install TDengine. 2. Run the downloaded package to install TDengine.
</TabItem>
<TabItem label="Mac" value="macos">
1. Download the Mac installation package.
<PkgListV3 type={7}/>
2. Run the downloaded package to install TDengine.
</TabItem> </TabItem>
</Tabs> </Tabs>
...@@ -178,6 +185,12 @@ The following `systemctl` commands can help you manage TDengine service: ...@@ -178,6 +185,12 @@ The following `systemctl` commands can help you manage TDengine service:
After the installation is complete, run `C:\TDengine\taosd.exe` to start TDengine Server. After the installation is complete, run `C:\TDengine\taosd.exe` to start TDengine Server.
</TabItem>
<TabItem label="Mac" value="macos">
After the installation is complete, double-click the /applications/TDengine to start the program, or run `launchctl start taosd` to start TDengine Server.
</TabItem> </TabItem>
</Tabs> </Tabs>
......
...@@ -110,6 +110,13 @@ apt-get 方式只适用于 Debian 或 Ubuntu 系统。 ...@@ -110,6 +110,13 @@ apt-get 方式只适用于 Debian 或 Ubuntu 系统。
<PkgListV3 type={3}/> <PkgListV3 type={3}/>
2. 运行可执行程序来安装 TDengine。 2. 运行可执行程序来安装 TDengine。
</TabItem>
<TabItem label="Mac 安装" value="macos">
1. 从列表中下载获得 pkg 安装程序;
<PkgListV3 type={7}/>
2. 运行可执行程序来安装 TDengine。
</TabItem> </TabItem>
</Tabs> </Tabs>
...@@ -177,6 +184,12 @@ Active: inactive (dead) ...@@ -177,6 +184,12 @@ Active: inactive (dead)
安装后,在 `C:\TDengine` 目录下,运行 `taosd.exe` 来启动 TDengine 服务进程。 安装后,在 `C:\TDengine` 目录下,运行 `taosd.exe` 来启动 TDengine 服务进程。
</TabItem>
<TabItem label="Mac 系统" value="macos">
安装后,在应用程序目录下,双击 TDengine 来启动程序,也可以运行 `launchctl start taosd` 来启动 TDengine 服务进程。
</TabItem> </TabItem>
</Tabs> </Tabs>
......
...@@ -38,9 +38,9 @@ extern "C" { ...@@ -38,9 +38,9 @@ extern "C" {
#define TD_LOG_DIR_PATH "C:\\TDengine\\log\\" #define TD_LOG_DIR_PATH "C:\\TDengine\\log\\"
#elif defined(_TD_DARWIN_64) #elif defined(_TD_DARWIN_64)
#define TD_TMP_DIR_PATH "/tmp/taosd/" #define TD_TMP_DIR_PATH "/tmp/taosd/"
#define TD_CFG_DIR_PATH "/usr/local/etc/taos/" #define TD_CFG_DIR_PATH "/etc/taos/"
#define TD_DATA_DIR_PATH "/usr/local/var/lib/taos/" #define TD_DATA_DIR_PATH "/var/lib/taos/"
#define TD_LOG_DIR_PATH "/usr/local/var/log/taos/" #define TD_LOG_DIR_PATH "/var/log/taos/"
#else #else
#define TD_TMP_DIR_PATH "/tmp/" #define TD_TMP_DIR_PATH "/tmp/"
#define TD_CFG_DIR_PATH "/etc/taos/" #define TD_CFG_DIR_PATH "/etc/taos/"
......
#!/usr/bin/env bash
function showAlertMessage(){
osascript <<EOF
set buttonStr to "${3}"
set oldDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to ","
set buttonList to every text item of buttonStr
set AppleScript's text item delimiters to oldDelimiters
get buttonList
set btns to buttonList
display dialog "${1}" with title "${2}" buttons btns with icon ${4}
get result
EOF
}
taosd_status=`Launchctl list | grep taosd | head -n 1 | awk '{print $1}'`
if [ "$taosd_status"x = "-"x ]; then
launchctl start taosd
showAlertMessage "Taosd is running!" "TDengine" "ok" "note"
else
choose_result=`showAlertMessage "Taosd is running!\nDo you want to close it?" "TDengine" "yes,cancel" "stop"`
if [ "$choose_result"x = "button returned:yes"x ]; then
launchctl stop taosd
fi
fi
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>taosd</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/taosd</string>
</array>
<key>ProcessType</key>
<string>Interactive</string>
<key>Disabled</key>
<false/>
<key>RunAtLoad</key>
<false/>
<key>LaunchOnlyOnce</key>
<false/>
<key>SessionCreate</key>
<true/>
<key>ExitTimeOut</key>
<integer>600</integer>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
<key>AfterInitialDemand</key>
<true/>
</dict>
<key>Program</key>
<string>/usr/local/bin/taosd</string>
</dict>
</plist>
\ No newline at end of file
TDengine is a high-efficient, scalable, high-available distributed time-series database, which makes a lot of optimizations on inserting and querying data, which is far more efficient than normal regular databases. So TDengine can meet the high requirements of IOT and other areas on storing and querying a large amount of data.
To configure TDengine : edit /etc/taos/taos.cfg
To start service : launchctl start taosd
To access TDengine : use taos in shell
\ No newline at end of file
此差异已折叠。
...@@ -7,27 +7,52 @@ ...@@ -7,27 +7,52 @@
iplist="" iplist=""
serverFqdn="" serverFqdn=""
# -----------------------Variables definition--------------------- osType=`uname`
script_dir=$(dirname $(readlink -f "$0"))
# Dynamic directory # Dynamic directory
data_dir="/var/lib/taos" data_dir="/var/lib/taos"
log_dir="/var/log/taos" log_dir="/var/log/taos"
data_link_dir="/usr/local/taos/data" cfg_install_dir="/etc/taos"
log_link_dir="/usr/local/taos/log"
install_main_dir="/usr/local/taos"
# static directory if [ "$osType" != "Darwin" ]; then
cfg_dir="/usr/local/taos/cfg" script_dir=$(dirname $(readlink -f "$0"))
bin_dir="/usr/local/taos/bin" verNumber=""
lib_dir="/usr/local/taos/driver" lib_file_ext="so"
init_d_dir="/usr/local/taos/init.d"
inc_dir="/usr/local/taos/include" bin_link_dir="/usr/bin"
lib_link_dir="/usr/lib"
lib64_link_dir="/usr/lib64"
inc_link_dir="/usr/include"
install_main_dir="/usr/local/taos"
else
script_dir=${source_dir}/packaging/tools
verNumber=`ls tdengine/driver | grep -E "libtaos\.[0-9]\.[0-9]" | sed "s/libtaos.//g" | sed "s/.dylib//g" | head -n 1`
lib_file_ext="dylib"
bin_link_dir="/usr/local/bin"
lib_link_dir="/usr/local/lib"
lib64_link_dir="/usr/local/lib"
inc_link_dir="/usr/local/include"
if [ -d "/usr/local/Cellar/" ];then
install_main_dir="/usr/local/Cellar/tdengine/${verNumber}"
elif [ -d "/opt/homebrew/Cellar/" ];then
install_main_dir="/opt/homebrew/Cellar/tdengine/${verNumber}"
else
install_main_dir="/usr/local/taos"
fi
fi
cfg_install_dir="/etc/taos" data_link_dir="${install_main_dir}/data"
bin_link_dir="/usr/bin" log_link_dir="${install_main_dir}/log"
lib_link_dir="/usr/lib"
lib64_link_dir="/usr/lib64" # static directory
inc_link_dir="/usr/include" cfg_dir="${install_main_dir}/cfg"
bin_dir="${install_main_dir}/bin"
lib_dir="${install_main_dir}/driver"
init_d_dir="${install_main_dir}/init.d"
inc_dir="${install_main_dir}/include"
service_config_dir="/etc/systemd/system" service_config_dir="/etc/systemd/system"
...@@ -40,8 +65,10 @@ GREEN_UNDERLINE='\033[4;32m' ...@@ -40,8 +65,10 @@ GREEN_UNDERLINE='\033[4;32m'
NC='\033[0m' NC='\033[0m'
csudo="" csudo=""
csudouser=""
if command -v sudo > /dev/null; then if command -v sudo > /dev/null; then
csudo="sudo " csudo="sudo "
csudouser="sudo -u ${USER} "
fi fi
initd_mod=0 initd_mod=0
...@@ -63,6 +90,14 @@ elif $(which service &> /dev/null); then ...@@ -63,6 +90,14 @@ elif $(which service &> /dev/null); then
else else
service_mod=2 service_mod=2
fi fi
if [ "$osType" = "Darwin" ]; then
if [ -d "${install_main_dir}" ];then
${csudo}rm -rf ${install_main_dir}
fi
${csudo}mkdir -p ${install_main_dir}
${csudo}rm -rf ${install_main_dir}
${csudo}cp -rf tdengine ${install_main_dir}
fi
function kill_taosadapter() { function kill_taosadapter() {
# ${csudo}pkill -f taosadapter || : # ${csudo}pkill -f taosadapter || :
...@@ -96,22 +131,24 @@ function install_lib() { ...@@ -96,22 +131,24 @@ function install_lib() {
${csudo}rm -f ${lib_link_dir}/libtaos* || : ${csudo}rm -f ${lib_link_dir}/libtaos* || :
${csudo}rm -f ${lib64_link_dir}/libtaos* || : ${csudo}rm -f ${lib64_link_dir}/libtaos* || :
[ -f ${lib_link_dir}/libtaosws.so ] && ${csudo}rm -f ${lib_link_dir}/libtaosws.so || : [ -f ${lib_link_dir}/libtaosws.${lib_file_ext} ] && ${csudo}rm -f ${lib_link_dir}/libtaosws.${lib_file_ext} || :
[ -f ${lib64_link_dir}/libtaosws.so ] && ${csudo}rm -f ${lib64_link_dir}/libtaosws.so || : [ -f ${lib64_link_dir}/libtaosws.${lib_file_ext} ] && ${csudo}rm -f ${lib64_link_dir}/libtaosws.${lib_file_ext} || :
${csudo}ln -s ${lib_dir}/libtaos.* ${lib_link_dir}/libtaos.so.1 ${csudo}ln -s ${lib_dir}/libtaos.* ${lib_link_dir}/libtaos.so.1
${csudo}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
[ -f ${lib_dir}/libtaosws.so ] && ${csudo}ln -sf ${lib_dir}/libtaosws.so ${lib_link_dir}/libtaosws.so ||: [ -f ${lib_dir}/libtaosws.${lib_file_ext} ] && ${csudo}ln -sf ${lib_dir}/libtaosws.${lib_file_ext} ${lib_link_dir}/libtaosws.${lib_file_ext} ||:
if [[ -d ${lib64_link_dir} && ! -e ${lib64_link_dir}/libtaos.so ]]; then if [[ -d ${lib64_link_dir} && ! -e ${lib64_link_dir}/libtaos.so ]]; then
${csudo}ln -s ${lib_dir}/libtaos.* ${lib64_link_dir}/libtaos.so.1 || : ${csudo}ln -s ${lib_dir}/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || : ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
[ -f ${lib_dir}/libtaosws.so ] && ${csudo}ln -sf ${lib_dir}/libtaosws.so ${lib64_link_dir}/libtaosws.so || : [ -f ${lib_dir}/libtaosws.${lib_file_ext} ] && ${csudo}ln -sf ${lib_dir}/libtaosws.${lib_file_ext} ${lib64_link_dir}/libtaosws.${lib_file_ext} || :
fi fi
${csudo}ldconfig if [ "$osType" != "Darwin" ]; then
${csudo}ldconfig
fi
} }
function install_bin() { function install_bin() {
...@@ -138,6 +175,7 @@ function install_bin() { ...@@ -138,6 +175,7 @@ function install_bin() {
[ -x ${bin_dir}/TDinsight.sh ] && ${csudo}ln -sf ${bin_dir}/TDinsight.sh ${bin_link_dir}/TDinsight.sh || : [ -x ${bin_dir}/TDinsight.sh ] && ${csudo}ln -sf ${bin_dir}/TDinsight.sh ${bin_link_dir}/TDinsight.sh || :
[ -x ${bin_dir}/taosdump ] && ${csudo}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}/set_core.sh ] && ${csudo}ln -s ${bin_dir}/set_core.sh ${bin_link_dir}/set_core || : [ -x ${bin_dir}/set_core.sh ] && ${csudo}ln -s ${bin_dir}/set_core.sh ${bin_link_dir}/set_core || :
[ -x ${bin_dir}/remove.sh ] && ${csudo}ln -s ${bin_dir}/remove.sh ${bin_link_dir}/rmtaos || :
} }
function add_newHostname_to_hosts() { function add_newHostname_to_hosts() {
...@@ -466,6 +504,14 @@ function install_service_on_systemd() { ...@@ -466,6 +504,14 @@ function install_service_on_systemd() {
${csudo}systemctl enable taosd ${csudo}systemctl enable taosd
} }
function install_service_on_launchctl() {
if [ -f ${install_main_dir}/service/com.taosdata.taosd.plist ]; then
${csudouser}launchctl unload -w /Library/LaunchDaemons/com.taosdata.taosd.plist > /dev/null 2>&1 || :
${csudo}cp ${install_main_dir}/service/com.taosdata.taosd.plist /Library/LaunchDaemons/com.taosdata.taosd.plist || :
${csudouser}launchctl load -w /Library/LaunchDaemons/com.taosdata.taosd.plist || :
fi
}
function install_taosadapter_service() { function install_taosadapter_service() {
if ((${service_mod}==0)); then if ((${service_mod}==0)); then
[ -f ${script_dir}/../cfg/taosadapter.service ] &&\ [ -f ${script_dir}/../cfg/taosadapter.service ] &&\
...@@ -476,6 +522,7 @@ function install_taosadapter_service() { ...@@ -476,6 +522,7 @@ function install_taosadapter_service() {
} }
function install_service() { function install_service() {
if [ "$osType" != "Darwin" ]; then
if ((${service_mod}==0)); then if ((${service_mod}==0)); then
install_service_on_systemd install_service_on_systemd
elif ((${service_mod}==1)); then elif ((${service_mod}==1)); then
...@@ -485,6 +532,25 @@ function install_service() { ...@@ -485,6 +532,25 @@ function install_service() {
kill_taosadapter kill_taosadapter
kill_taosd kill_taosd
fi fi
else
install_service_on_launchctl
fi
}
function install_app() {
if [ "$osType" = "Darwin" ]; then
if [ -f ${install_main_dir}/service/TDengine ]; then
${csudo}rm -rf /Applications/TDengine.app &&
${csudo}mkdir -p /Applications/TDengine.app/Contents/MacOS/ &&
${csudo}cp ${install_main_dir}/service/TDengine /Applications/TDengine.app/Contents/MacOS/ &&
echo "<plist><dict></dict></plist>" | ${csudo}tee /Applications/TDengine.app/Contents/Info.plist > /dev/null &&
${csudo}sips -i ${install_main_dir}/service/logo.png > /dev/null &&
DeRez -only icns ${install_main_dir}/service/logo.png | ${csudo}tee /Applications/TDengine.app/mac_logo.rsrc > /dev/null &&
${csudo}rez -append /Applications/TDengine.app/mac_logo.rsrc -o $'/Applications/TDengine.app/Icon\r' &&
${csudo}SetFile -a C /Applications/TDengine.app/ &&
${csudo}rm /Applications/TDengine.app/mac_logo.rsrc
fi
fi
} }
function install_TDengine() { function install_TDengine() {
...@@ -492,7 +558,7 @@ function install_TDengine() { ...@@ -492,7 +558,7 @@ function install_TDengine() {
#install log and data dir , then ln to /usr/local/taos #install log and data dir , then ln to /usr/local/taos
${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir} ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
${csudo}mkdir -p ${data_dir} ${csudo}mkdir -p ${data_dir} && ${csudo}chmod 777 ${data_dir}
${csudo}rm -rf ${log_link_dir} || : ${csudo}rm -rf ${log_link_dir} || :
${csudo}rm -rf ${data_link_dir} || : ${csudo}rm -rf ${data_link_dir} || :
...@@ -508,6 +574,7 @@ function install_TDengine() { ...@@ -508,6 +574,7 @@ function install_TDengine() {
install_taosadapter_config install_taosadapter_config
install_taosadapter_service install_taosadapter_service
install_service install_service
install_app
# Ask if to start the service # Ask if to start the service
#echo #echo
......
...@@ -6,12 +6,31 @@ set -e ...@@ -6,12 +6,31 @@ set -e
#set -x #set -x
verMode=edge verMode=edge
osType=`uname`
RED='\033[0;31m' RED='\033[0;31m'
GREEN='\033[1;32m' GREEN='\033[1;32m'
NC='\033[0m' NC='\033[0m'
installDir="/usr/local/taos" if [ "$osType" != "Darwin" ]; then
installDir="/usr/local/taos"
bin_link_dir="/usr/bin"
lib_link_dir="/usr/lib"
lib64_link_dir="/usr/lib64"
inc_link_dir="/usr/include"
else
if [ -d "/usr/local/Cellar/" ];then
installDir="/usr/local/Cellar/tdengine/${verNumber}"
elif [ -d "/opt/homebrew/Cellar/" ];then
installDir="/opt/homebrew/Cellar/tdengine/${verNumber}"
else
installDir="/usr/local/taos"
fi
bin_link_dir="/usr/local/bin"
lib_link_dir="/usr/local/lib"
lib64_link_dir="/usr/local/lib"
inc_link_dir="/usr/local/include"
fi
serverName="taosd" serverName="taosd"
clientName="taos" clientName="taos"
uninstallScript="rmtaos" uninstallScript="rmtaos"
...@@ -22,11 +41,8 @@ install_main_dir=${installDir} ...@@ -22,11 +41,8 @@ install_main_dir=${installDir}
data_link_dir=${installDir}/data data_link_dir=${installDir}/data
log_link_dir=${installDir}/log log_link_dir=${installDir}/log
cfg_link_dir=${installDir}/cfg cfg_link_dir=${installDir}/cfg
bin_link_dir="/usr/bin"
local_bin_link_dir="/usr/local/bin" local_bin_link_dir="/usr/local/bin"
lib_link_dir="/usr/lib"
lib64_link_dir="/usr/lib64"
inc_link_dir="/usr/include"
service_config_dir="/etc/systemd/system" service_config_dir="/etc/systemd/system"
taos_service_name=${serverName} taos_service_name=${serverName}
...@@ -82,6 +98,7 @@ function clean_bin() { ...@@ -82,6 +98,7 @@ function clean_bin() {
# Remove link # Remove link
${csudo}rm -f ${bin_link_dir}/${clientName} || : ${csudo}rm -f ${bin_link_dir}/${clientName} || :
${csudo}rm -f ${bin_link_dir}/${serverName} || : ${csudo}rm -f ${bin_link_dir}/${serverName} || :
${csudo}rm -f ${bin_link_dir}/udfd || :
${csudo}rm -f ${bin_link_dir}/taosadapter || : ${csudo}rm -f ${bin_link_dir}/taosadapter || :
${csudo}rm -f ${bin_link_dir}/taosBenchmark || : ${csudo}rm -f ${bin_link_dir}/taosBenchmark || :
${csudo}rm -f ${bin_link_dir}/taosdemo || : ${csudo}rm -f ${bin_link_dir}/taosdemo || :
...@@ -103,7 +120,7 @@ function clean_lib() { ...@@ -103,7 +120,7 @@ function clean_lib() {
[ -f ${lib_link_dir}/libtaosws.so ] && ${csudo}rm -f ${lib_link_dir}/libtaosws.so || : [ -f ${lib_link_dir}/libtaosws.so ] && ${csudo}rm -f ${lib_link_dir}/libtaosws.so || :
${csudo}rm -f ${lib64_link_dir}/libtaos.* || : ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
[ -f ${lib64_link_dir}/libtaosws.so ] && ${csudo}rm -f ${lib64_link_dir}/libtaosws.so || : [ -f ${lib64_link_dir}/libtaosws.* ] && ${csudo}rm -f ${lib64_link_dir}/libtaosws.* || :
#${csudo}rm -rf ${v15_java_app_dir} || : #${csudo}rm -rf ${v15_java_app_dir} || :
} }
...@@ -195,12 +212,20 @@ function clean_service_on_sysvinit() { ...@@ -195,12 +212,20 @@ function clean_service_on_sysvinit() {
fi fi
} }
function clean_service_on_launchctl() {
${csudouser}launchctl unload -w /Library/LaunchDaemons/com.taosdata.taosd.plist > /dev/null 2>&1 || :
${csudo}rm /Library/LaunchDaemons/com.taosdata.taosd.plist > /dev/null 2>&1 || :
}
function clean_service() { function clean_service() {
if ((${service_mod} == 0)); then if ((${service_mod} == 0)); then
clean_service_on_systemd clean_service_on_systemd
elif ((${service_mod} == 1)); then elif ((${service_mod} == 1)); then
clean_service_on_sysvinit clean_service_on_sysvinit
else else
if [ "$osType" = "Darwin" ]; then
clean_service_on_launchctl
fi
kill_taosadapter kill_taosadapter
kill_taosd kill_taosd
kill_tarbitrator kill_tarbitrator
...@@ -241,6 +266,9 @@ elif echo $osinfo | grep -qwi "centos"; then ...@@ -241,6 +266,9 @@ elif echo $osinfo | grep -qwi "centos"; then
# echo "this is centos system" # echo "this is centos system"
${csudo}rpm -e --noscripts tdengine >/dev/null 2>&1 || : ${csudo}rpm -e --noscripts tdengine >/dev/null 2>&1 || :
fi fi
if [ "$osType" = "Darwin" ]; then
${csudo}rm -rf /Applications/TDengine.app
fi
echo -e "${GREEN}${productName} is removed successfully!${NC}" echo -e "${GREEN}${productName} is removed successfully!${NC}"
echo echo
...@@ -32,7 +32,7 @@ SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskExpand expandF ...@@ -32,7 +32,7 @@ SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskExpand expandF
} }
sprintf(streamPath, "%s/%s", pMeta->path, "checkpoints"); sprintf(streamPath, "%s/%s", pMeta->path, "checkpoints");
mkdir(streamPath, 0755); taosMulModeMkDir(streamPath, 0755);
taosMemoryFree(streamPath); taosMemoryFree(streamPath);
if (tdbTbOpen("task.db", sizeof(int32_t), -1, NULL, pMeta->db, &pMeta->pTaskDb) < 0) { if (tdbTbOpen("task.db", sizeof(int32_t), -1, NULL, pMeta->db, &pMeta->pTaskDb) < 0) {
......
...@@ -62,7 +62,7 @@ int32_t tdbOpen(const char *dbname, int32_t szPage, int32_t pages, TDB **ppDb) { ...@@ -62,7 +62,7 @@ int32_t tdbOpen(const char *dbname, int32_t szPage, int32_t pages, TDB **ppDb) {
} }
memset(pDb->pgrHash, 0, tsize); memset(pDb->pgrHash, 0, tsize);
mkdir(dbname, 0755); taosMulModeMkDir(dbname, 0755);
#ifdef USE_MAINDB #ifdef USE_MAINDB
// open main db // open main db
......
...@@ -121,6 +121,8 @@ int32_t taosMkDir(const char *dirname) { ...@@ -121,6 +121,8 @@ int32_t taosMkDir(const char *dirname) {
if (taosDirExist(dirname)) return 0; if (taosDirExist(dirname)) return 0;
#ifdef WINDOWS #ifdef WINDOWS
int32_t code = _mkdir(dirname, 0755); int32_t code = _mkdir(dirname, 0755);
#elif defined(DARWIN)
int32_t code = mkdir(dirname, 0777);
#else #else
int32_t code = mkdir(dirname, 0755); int32_t code = mkdir(dirname, 0755);
#endif #endif
...@@ -156,6 +158,8 @@ int32_t taosMulMkDir(const char *dirname) { ...@@ -156,6 +158,8 @@ int32_t taosMulMkDir(const char *dirname) {
*pos = '\0'; *pos = '\0';
#ifdef WINDOWS #ifdef WINDOWS
code = _mkdir(temp, 0755); code = _mkdir(temp, 0755);
#elif defined(DARWIN)
code = mkdir(dirname, 0777);
#else #else
code = mkdir(temp, 0755); code = mkdir(temp, 0755);
#endif #endif
...@@ -170,6 +174,8 @@ int32_t taosMulMkDir(const char *dirname) { ...@@ -170,6 +174,8 @@ int32_t taosMulMkDir(const char *dirname) {
if (*(pos - 1) != TD_DIRSEP[0]) { if (*(pos - 1) != TD_DIRSEP[0]) {
#ifdef WINDOWS #ifdef WINDOWS
code = _mkdir(temp, 0755); code = _mkdir(temp, 0755);
#elif defined(DARWIN)
code = mkdir(dirname, 0777);
#else #else
code = mkdir(temp, 0755); code = mkdir(temp, 0755);
#endif #endif
...@@ -179,7 +185,6 @@ int32_t taosMulMkDir(const char *dirname) { ...@@ -179,7 +185,6 @@ int32_t taosMulMkDir(const char *dirname) {
} }
} }
// int32_t code = mkdir(dirname, 0755);
if (code < 0 && errno == EEXIST) { if (code < 0 && errno == EEXIST) {
return 0; return 0;
} }
...@@ -215,6 +220,8 @@ int32_t taosMulModeMkDir(const char *dirname, int mode) { ...@@ -215,6 +220,8 @@ int32_t taosMulModeMkDir(const char *dirname, int mode) {
*pos = '\0'; *pos = '\0';
#ifdef WINDOWS #ifdef WINDOWS
code = _mkdir(temp, mode); code = _mkdir(temp, mode);
#elif defined(DARWIN)
code = mkdir(dirname, 0777);
#else #else
code = mkdir(temp, mode); code = mkdir(temp, mode);
#endif #endif
...@@ -229,6 +236,8 @@ int32_t taosMulModeMkDir(const char *dirname, int mode) { ...@@ -229,6 +236,8 @@ int32_t taosMulModeMkDir(const char *dirname, int mode) {
if (*(pos - 1) != TD_DIRSEP[0]) { if (*(pos - 1) != TD_DIRSEP[0]) {
#ifdef WINDOWS #ifdef WINDOWS
code = _mkdir(temp, mode); code = _mkdir(temp, mode);
#elif defined(DARWIN)
code = mkdir(dirname, 0777);
#else #else
code = mkdir(temp, mode); code = mkdir(temp, mode);
#endif #endif
......
...@@ -59,34 +59,18 @@ void osDefaultInit() { ...@@ -59,34 +59,18 @@ void osDefaultInit() {
if (tmpDir != NULL) { if (tmpDir != NULL) {
strcpy(tsTempDir, tmpDir); strcpy(tsTempDir, tmpDir);
} }
if (configDir[0] == 0) {
strcpy(configDir, "C:\\TDengine\\cfg");
}
strcpy(tsDataDir, "C:\\TDengine\\data");
strcpy(tsLogDir, "C:\\TDengine\\log");
strcpy(tsTempDir, "C:\\Windows\\Temp");
strcpy(tsOsName, "Windows"); strcpy(tsOsName, "Windows");
#elif defined(_TD_DARWIN_64) #elif defined(_TD_DARWIN_64)
if (configDir[0] == 0) {
strcpy(configDir, "/usr/local/etc/taos");
}
strcpy(tsDataDir, "/usr/local/var/lib/taos");
strcpy(tsLogDir, "/usr/local/var/log/taos");
strcpy(tsTempDir, "/tmp/taosd");
strcpy(tsOsName, "Darwin"); strcpy(tsOsName, "Darwin");
#else #else
if (configDir[0] == 0) {
strcpy(configDir, "/etc/taos");
}
strcpy(tsDataDir, "/var/lib/taos");
strcpy(tsLogDir, "/var/log/taos");
strcpy(tsTempDir, "/tmp");
strcpy(tsOsName, "Linux"); strcpy(tsOsName, "Linux");
#endif #endif
if (configDir[0] == 0) {
strcpy(configDir, TD_CFG_DIR_PATH);
}
strcpy(tsDataDir, TD_DATA_DIR_PATH);
strcpy(tsLogDir, TD_LOG_DIR_PATH);
strcpy(tsTempDir, TD_TMP_DIR_PATH);
} }
void osUpdate() { void osUpdate() {
......
IF (TD_WEBSOCKET) IF (TD_WEBSOCKET)
IF (TD_LINUX)
SET(websocket_lib_file "libtaosws.so")
ELSEIF (TD_DARWIN)
SET(websocket_lib_file "libtaosws.dylib")
ENDIF ()
MESSAGE("${Green} use libtaos-ws${ColourReset}") MESSAGE("${Green} use libtaos-ws${ColourReset}")
IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/taosws-rs/target/release/libtaosws.so" OR "${CMAKE_CURRENT_SOURCE_DIR}/taosws-rs/target/release/libtaosws.so" IS_NEWER_THAN "${CMAKE_SOURCE_DIR}/.git/modules/tools/taosws-rs/FETCH_HEAD") IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/taosws-rs/target/release/${websocket_lib_file}" OR "${CMAKE_CURRENT_SOURCE_DIR}/taosws-rs/target/release/${websocket_lib_file}" IS_NEWER_THAN "${CMAKE_SOURCE_DIR}/.git/modules/tools/taosws-rs/FETCH_HEAD")
include(ExternalProject) include(ExternalProject)
ExternalProject_Add(taosws-rs ExternalProject_Add(taosws-rs
PREFIX "taosws-rs" PREFIX "taosws-rs"
...@@ -15,7 +20,7 @@ IF (TD_WEBSOCKET) ...@@ -15,7 +20,7 @@ IF (TD_WEBSOCKET)
COMMAND cargo build --release -p taos-ws-sys COMMAND cargo build --release -p taos-ws-sys
COMMAND ./taos-ws-sys/ci/package.sh COMMAND ./taos-ws-sys/ci/package.sh
INSTALL_COMMAND INSTALL_COMMAND
COMMAND cmake -E copy target/libtaosws/libtaosws.so ${CMAKE_BINARY_DIR}/build/lib COMMAND cmake -E copy target/libtaosws/${websocket_lib_file} ${CMAKE_BINARY_DIR}/build/lib
COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/build/include COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/build/include
COMMAND cmake -E copy target/libtaosws/taosws.h ${CMAKE_BINARY_DIR}/build/include COMMAND cmake -E copy target/libtaosws/taosws.h ${CMAKE_BINARY_DIR}/build/include
) )
...@@ -34,7 +39,7 @@ IF (TD_WEBSOCKET) ...@@ -34,7 +39,7 @@ IF (TD_WEBSOCKET)
COMMAND cargo build --release -p taos-ws-sys COMMAND cargo build --release -p taos-ws-sys
COMMAND ./taos-ws-sys/ci/package.sh COMMAND ./taos-ws-sys/ci/package.sh
INSTALL_COMMAND INSTALL_COMMAND
COMMAND cmake -E copy target/libtaosws/libtaosws.so ${CMAKE_BINARY_DIR}/build/lib COMMAND cmake -E copy target/libtaosws/${websocket_lib_file} ${CMAKE_BINARY_DIR}/build/lib
COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/build/include COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/build/include
COMMAND cmake -E copy target/libtaosws/taosws.h ${CMAKE_BINARY_DIR}/build/include COMMAND cmake -E copy target/libtaosws/taosws.h ${CMAKE_BINARY_DIR}/build/include
) )
......
...@@ -6,6 +6,10 @@ IF (TD_LINUX AND TD_WEBSOCKET) ...@@ -6,6 +6,10 @@ IF (TD_LINUX AND TD_WEBSOCKET)
ADD_DEFINITIONS(-DWEBSOCKET -I${CMAKE_BINARY_DIR}/build/include -ltaosws) ADD_DEFINITIONS(-DWEBSOCKET -I${CMAKE_BINARY_DIR}/build/include -ltaosws)
SET(LINK_WEBSOCKET "-L${CMAKE_BINARY_DIR}/build/lib -ltaosws") SET(LINK_WEBSOCKET "-L${CMAKE_BINARY_DIR}/build/lib -ltaosws")
ADD_DEPENDENCIES(shell taosws-rs) ADD_DEPENDENCIES(shell taosws-rs)
ELSEIF (TD_DARWIN AND TD_WEBSOCKET)
ADD_DEFINITIONS(-DWEBSOCKET -I${CMAKE_BINARY_DIR}/build/include)
SET(LINK_WEBSOCKET "${CMAKE_BINARY_DIR}/build/lib/libtaosws.dylib")
ADD_DEPENDENCIES(shell taosws-rs)
ELSE () ELSE ()
SET(LINK_WEBSOCKET "") SET(LINK_WEBSOCKET "")
ENDIF () ENDIF ()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册