From 53acdefc767cd50ee7781b61c641cadf83aa63ef Mon Sep 17 00:00:00 2001 From: Zhiyu Yang <69311263+zyyang-taosdata@users.noreply.github.com> Date: Mon, 11 Oct 2021 14:09:41 +0800 Subject: [PATCH] [TS-409]: OEM packaging scripts (#8173) --- packaging/release.sh | 5 ++ packaging/tools/install.sh | 1 + packaging/tools/install_pro.sh | 20 +++--- packaging/tools/makepkg_pro.sh | 119 +++++++++++++++++---------------- src/kit/shell/inc/shell.h | 7 +- 5 files changed, 83 insertions(+), 69 deletions(-) diff --git a/packaging/release.sh b/packaging/release.sh index 44887c6cf7..61fb2babc3 100755 --- a/packaging/release.sh +++ b/packaging/release.sh @@ -192,6 +192,11 @@ else allocator_macro="" fi +if [[ "$dbName" == "pro" ]]; then + sed -i "s/taos config/prodb config/g" ${top_dir}/src/util/src/tconfig.c +fi + + # check support cpu type if [[ "$cpuType" == "x64" ]] || [[ "$cpuType" == "aarch64" ]] || [[ "$cpuType" == "aarch32" ]] || [[ "$cpuType" == "mips64" ]] ; then if [ "$verMode" != "cluster" ]; then diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 9c6a6e62f5..0d7a7dd944 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -1002,6 +1002,7 @@ function install_TDengine() { echo echo -e "\033[44;32;1mTDengine client is installed successfully!${NC}" fi + touch ~/.taos_history rm -rf $(tar -tf taos.tar.gz) } diff --git a/packaging/tools/install_pro.sh b/packaging/tools/install_pro.sh index 5645614416..527f9a231e 100755 --- a/packaging/tools/install_pro.sh +++ b/packaging/tools/install_pro.sh @@ -154,9 +154,9 @@ function install_main_path() { ${csudo} mkdir -p ${install_main_dir} ${csudo} mkdir -p ${install_main_dir}/cfg ${csudo} mkdir -p ${install_main_dir}/bin - ${csudo} mkdir -p ${install_main_dir}/connector +# ${csudo} mkdir -p ${install_main_dir}/connector ${csudo} mkdir -p ${install_main_dir}/driver - ${csudo} mkdir -p ${install_main_dir}/examples +# ${csudo} mkdir -p ${install_main_dir}/examples ${csudo} mkdir -p ${install_main_dir}/include ${csudo} mkdir -p ${install_main_dir}/init.d if [ "$verMode" == "cluster" ]; then @@ -779,10 +779,10 @@ function update_prodb() { install_log install_header install_lib - if [ "$pagMode" != "lite" ]; then - install_connector - fi - install_examples +# if [ "$pagMode" != "lite" ]; then +# install_connector +# fi +# install_examples if [ -z $1 ]; then install_bin install_service @@ -853,10 +853,10 @@ function install_prodb() { install_header install_lib install_jemalloc - if [ "$pagMode" != "lite" ]; then - install_connector - fi - install_examples +# if [ "$pagMode" != "lite" ]; then +# install_connector +# fi +# install_examples if [ -z $1 ]; then # install service and client # For installing new diff --git a/packaging/tools/makepkg_pro.sh b/packaging/tools/makepkg_pro.sh index 8a351f2822..10cc4382a4 100755 --- a/packaging/tools/makepkg_pro.sh +++ b/packaging/tools/makepkg_pro.sh @@ -24,7 +24,7 @@ build_dir="${compile_dir}/build" code_dir="${top_dir}/src" release_dir="${top_dir}/release" -#package_name='linux' +# package_name='linux' if [ "$verMode" == "cluster" ]; then install_dir="${release_dir}/ProDB-enterprise-server-${version}" else @@ -45,19 +45,13 @@ nginx_dir="${code_dir}/../../enterprise/src/plugins/web" mkdir -p ${install_dir} mkdir -p ${install_dir}/inc && cp ${header_files} ${install_dir}/inc mkdir -p ${install_dir}/cfg && cp ${cfg_dir}/taos.cfg ${install_dir}/cfg/taos.cfg - -#mkdir -p ${install_dir}/bin && cp ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/* || : mkdir -p ${install_dir}/bin + +# bin if [ "$pagMode" == "lite" ]; then strip ${build_dir}/bin/taosd strip ${build_dir}/bin/taos - cp ${build_dir}/bin/taos ${install_dir}/bin/prodbc - cp ${build_dir}/bin/taosd ${install_dir}/bin/prodbs - cp ${script_dir}/remove_pro.sh ${install_dir}/bin else - cp ${build_dir}/bin/taos ${install_dir}/bin/prodbc - cp ${build_dir}/bin/taosd ${install_dir}/bin/prodbs - cp ${script_dir}/remove_pro.sh ${install_dir}/bin cp ${build_dir}/bin/taosdemo ${install_dir}/bin/prodemo cp ${build_dir}/bin/taosdump ${install_dir}/bin/prodump cp ${build_dir}/bin/tarbitrator ${install_dir}/bin @@ -66,13 +60,16 @@ else cp ${script_dir}/startPre.sh ${install_dir}/bin cp ${script_dir}/taosd-dump-cfg.gdb ${install_dir}/bin fi +cp ${build_dir}/bin/taos ${install_dir}/bin/prodbc +cp ${build_dir}/bin/taosd ${install_dir}/bin/prodbs +cp ${script_dir}/remove_pro.sh ${install_dir}/bin chmod a+x ${install_dir}/bin/* || : +# cluster if [ "$verMode" == "cluster" ]; then sed 's/verMode=edge/verMode=cluster/g' ${install_dir}/bin/remove_pro.sh >> remove_prodb_temp.sh mv remove_prodb_temp.sh ${install_dir}/bin/remove_pro.sh - mkdir -p ${install_dir}/nginxd && cp -r ${nginx_dir}/* ${install_dir}/nginxd cp ${nginx_dir}/png/taos.png ${install_dir}/nginxd/admin/images/taos.png rm -rf ${install_dir}/nginxd/png @@ -85,14 +82,9 @@ if [ "$verMode" == "cluster" ]; then sed -i -e 's/taosd<\/th>/prodbs<\/th>/g' ${install_dir}/nginxd/admin/monitor.html sed -i -e "s/data:\['taosd', 'system'\],/data:\['prodbs', 'system'\],/g" ${install_dir}/nginxd/admin/monitor.html sed -i -e "s/name: 'taosd',/name: 'prodbs',/g" ${install_dir}/nginxd/admin/monitor.html - sed -i "s/TDengine/ProDB/g" ${install_dir}/nginxd/admin/*.html sed -i "s/TDengine/ProDB/g" ${install_dir}/nginxd/admin/js/*.js - sed -i '/dataDir/ {s/taos/ProDB/g}' ${install_dir}/cfg/taos.cfg - sed -i '/logDir/ {s/taos/ProDB/g}' ${install_dir}/cfg/taos.cfg - sed -i "s/TDengine/ProDB/g" ${install_dir}/cfg/taos.cfg - if [ "$cpuType" == "aarch64" ]; then cp -f ${install_dir}/nginxd/sbin/arm/64bit/nginx ${install_dir}/nginxd/sbin/ elif [ "$cpuType" == "aarch32" ]; then @@ -101,6 +93,13 @@ if [ "$verMode" == "cluster" ]; then rm -rf ${install_dir}/nginxd/sbin/arm fi +sed -i '/dataDir/ {s/taos/ProDB/g}' ${install_dir}/cfg/taos.cfg +sed -i '/logDir/ {s/taos/ProDB/g}' ${install_dir}/cfg/taos.cfg +sed -i "s/TDengine/ProDB/g" ${install_dir}/cfg/taos.cfg +sed -i "s/support@taosdata.com/support@hanatech.com/g" ${install_dir}/cfg/taos.cfg +sed -i "s/taos client/prodbc/g" ${install_dir}/cfg/taos.cfg +sed -i "s/taosd/prodbs/g" ${install_dir}/cfg/taos.cfg + cd ${install_dir} tar -zcv -f prodb.tar.gz * --remove-files || : exitcode=$? @@ -116,58 +115,62 @@ if [ "$verMode" == "cluster" ]; then mv install_prodb_temp.sh ${install_dir}/install_pro.sh fi if [ "$pagMode" == "lite" ]; then - sed 's/pagMode=full/pagMode=lite/g' ${install_dir}/install.sh >> install_prodb_temp.sh + sed -e "s/pagMode=full/pagMode=lite/g" -e "s/taos_history/prodb_history/g" ${install_dir}/install.sh >> install_prodb_temp.sh mv install_prodb_temp.sh ${install_dir}/install_pro.sh fi + +sed -i "/install_connector$/d" ${install_dir}/install_pro.sh +sed -i "/install_examples$/d" ${install_dir}/install_pro.sh chmod a+x ${install_dir}/install_pro.sh # Copy example code -mkdir -p ${install_dir}/examples -examples_dir="${top_dir}/tests/examples" -cp -r ${examples_dir}/c ${install_dir}/examples -sed -i '/passwd/ {s/taosdata/prodb/g}' ${install_dir}/examples/c/*.c -sed -i '/root/ {s/taosdata/prodb/g}' ${install_dir}/examples/c/*.c - -if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then - cp -r ${examples_dir}/JDBC ${install_dir}/examples - cp -r ${examples_dir}/matlab ${install_dir}/examples - mv ${install_dir}/examples/matlab/TDengineDemo.m ${install_dir}/examples/matlab/ProDBDemo.m - sed -i '/password/ {s/taosdata/prodb/g}' ${install_dir}/examples/matlab/ProDBDemo.m - cp -r ${examples_dir}/python ${install_dir}/examples - sed -i '/password/ {s/taosdata/prodb/g}' ${install_dir}/examples/python/read_example.py - cp -r ${examples_dir}/R ${install_dir}/examples - sed -i '/password/ {s/taosdata/prodb/g}' ${install_dir}/examples/R/command.txt - cp -r ${examples_dir}/go ${install_dir}/examples - mv ${install_dir}/examples/go/taosdemo.go ${install_dir}/examples/go/prodemo.go - sed -i '/root/ {s/taosdata/prodb/g}' ${install_dir}/examples/go/prodemo.go -fi +#mkdir -p ${install_dir}/examples +#examples_dir="${top_dir}/tests/examples" +#cp -r ${examples_dir}/c ${install_dir}/examples +#sed -i '/passwd/ {s/taosdata/prodb/g}' ${install_dir}/examples/c/*.c +#sed -i '/root/ {s/taosdata/prodb/g}' ${install_dir}/examples/c/*.c +# +#if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then +# cp -r ${examples_dir}/JDBC ${install_dir}/examples +# cp -r ${examples_dir}/matlab ${install_dir}/examples +# mv ${install_dir}/examples/matlab/TDengineDemo.m ${install_dir}/examples/matlab/ProDBDemo.m +# sed -i '/password/ {s/taosdata/prodb/g}' ${install_dir}/examples/matlab/ProDBDemo.m +# cp -r ${examples_dir}/python ${install_dir}/examples +# sed -i '/password/ {s/taosdata/prodb/g}' ${install_dir}/examples/python/read_example.py +# cp -r ${examples_dir}/R ${install_dir}/examples +# sed -i '/password/ {s/taosdata/prodb/g}' ${install_dir}/examples/R/command.txt +# cp -r ${examples_dir}/go ${install_dir}/examples +# mv ${install_dir}/examples/go/taosdemo.go ${install_dir}/examples/go/prodemo.go +# sed -i '/root/ {s/taosdata/prodb/g}' ${install_dir}/examples/go/prodemo.go +#fi + # Copy driver mkdir -p ${install_dir}/driver && cp ${lib_files} ${install_dir}/driver && echo "${versionComp}" > ${install_dir}/driver/vercomp.txt # Copy connector -connector_dir="${code_dir}/connector" -mkdir -p ${install_dir}/connector -if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then - cp ${build_dir}/lib/*.jar ${install_dir}/connector ||: - - if [ -d "${connector_dir}/grafanaplugin/dist" ]; then - cp -r ${connector_dir}/grafanaplugin/dist ${install_dir}/connector/grafanaplugin - else - echo "WARNING: grafanaplugin bundled dir not found, please check if want to use it!" - fi - if find ${connector_dir}/go -mindepth 1 -maxdepth 1 | read; then - cp -r ${connector_dir}/go ${install_dir}/connector - else - echo "WARNING: go connector not found, please check if want to use it!" - fi - cp -r ${connector_dir}/python ${install_dir}/connector/ - mv ${install_dir}/connector/python/taos ${install_dir}/connector/python/prodb - sed -i '/password/ {s/taosdata/prodb/g}' ${install_dir}/connector/python/prodb/cinterface.py - - sed -i '/password/ {s/taosdata/prodb/g}' ${install_dir}/connector/python/prodb/subscription.py - - sed -i '/self._password/ {s/taosdata/prodb/g}' ${install_dir}/connector/python/prodb/connection.py -fi +#connector_dir="${code_dir}/connector" +#mkdir -p ${install_dir}/connector +#if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then +# cp ${build_dir}/lib/*.jar ${install_dir}/connector ||: + +# if [ -d "${connector_dir}/grafanaplugin/dist" ]; then +# cp -r ${connector_dir}/grafanaplugin/dist ${install_dir}/connector/grafanaplugin +# else +# echo "WARNING: grafanaplugin bundled dir not found, please check if want to use it!" +# fi +# if find ${connector_dir}/go -mindepth 1 -maxdepth 1 | read; then +# cp -r ${connector_dir}/go ${install_dir}/connector +# else +# echo "WARNING: go connector not found, please check if want to use it!" +# fi +# cp -r ${connector_dir}/python ${install_dir}/connector/ +# mv ${install_dir}/connector/python/taos ${install_dir}/connector/python/prodb +# sed -i '/password/ {s/taosdata/prodb/g}' ${install_dir}/connector/python/prodb/cinterface.py + +# sed -i '/password/ {s/taosdata/prodb/g}' ${install_dir}/connector/python/prodb/subscription.py + +# sed -i '/self._password/ {s/taosdata/prodb/g}' ${install_dir}/connector/python/prodb/connection.py +#fi cd ${release_dir} diff --git a/src/kit/shell/inc/shell.h b/src/kit/shell/inc/shell.h index f207a866dd..03ccfe2d57 100644 --- a/src/kit/shell/inc/shell.h +++ b/src/kit/shell/inc/shell.h @@ -27,7 +27,12 @@ #define MAX_IP_SIZE 20 #define MAX_HISTORY_SIZE 1000 #define MAX_COMMAND_SIZE 1048586 -#define HISTORY_FILE ".taos_history" + +#ifdef _TD_PRO_ + #define HISTORY_FILE ".prodb_history" +#else + #define HISTORY_FILE ".taos_history" +#endif #define DEFAULT_RES_SHOW_NUM 100 -- GitLab