From 592588bb371322199bbbba85d6b4ea98786079b5 Mon Sep 17 00:00:00 2001 From: zyyang Date: Tue, 7 Jun 2022 13:46:46 +0800 Subject: [PATCH] other: release script modify --- packaging/deb/taosd | 16 -- packaging/release.bat | 41 +++- packaging/release.sh | 7 +- packaging/tools/install_arbi.sh | 23 ++- packaging/tools/install_client.sh | 316 +++++++++++++++--------------- packaging/tools/make_install.sh | 111 ++++++----- packaging/tools/makearbi.sh | 2 - packaging/tools/makeclient.sh | 32 +-- packaging/tools/remove.sh | 50 ++--- packaging/tools/remove_client.sh | 43 ++-- 10 files changed, 321 insertions(+), 320 deletions(-) diff --git a/packaging/deb/taosd b/packaging/deb/taosd index fe356ca656..8f8ab2f1ea 100644 --- a/packaging/deb/taosd +++ b/packaging/deb/taosd @@ -1,20 +1,4 @@ #!/bin/bash -# -# Modified from original source: Elastic Search -# https://github.com/elasticsearch/elasticsearch -# Thank you to the Elastic Search authors -# -# chkconfig: 2345 99 01 -# -### BEGIN INIT INFO -# Provides: TDengine -# Required-Start: $local_fs $network $syslog -# Required-Stop: $local_fs $network $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Starts TDengine taosd -# Description: Starts TDengine taosd, a time-series database engine -### END INIT INFO set -e diff --git a/packaging/release.bat b/packaging/release.bat index c1cf7875a5..6a25026f62 100644 --- a/packaging/release.bat +++ b/packaging/release.bat @@ -6,9 +6,10 @@ cd %community_dir% git checkout -- . cd %community_dir%\packaging -:: %1 name %2 version +:: %1 name %2 version %3 cpuType if !%1==! GOTO USAGE if !%2==! GOTO USAGE +if !%3==! GOTO USAGE if %1 == taos GOTO TAOS if %1 == power GOTO POWER if %1 == tq GOTO TQ @@ -21,42 +22,66 @@ GOTO USAGE goto RELEASE :POWER +cd %internal_dir%\enterprise\packaging\oem call sed_power.bat %community_dir% +cd %community_dir%\packaging goto RELEASE :TQ +cd %internal_dir%\enterprise\packaging\oem call sed_tq.bat %community_dir% +cd %community_dir%\packaging goto RELEASE :PRO +cd %internal_dir%\enterprise\packaging\oem call sed_pro.bat %community_dir% +cd %community_dir%\packaging goto RELEASE :KH +cd %internal_dir%\enterprise\packaging\oem call sed_kh.bat %community_dir% +cd %community_dir%\packaging goto RELEASE :JH +cd %internal_dir%\enterprise\packaging\oem call sed_jh.bat %community_dir% +cd %community_dir%\packaging goto RELEASE :RELEASE -echo release windows-client-64 for %1, version: %2 -if not exist %internal_dir%\debug\ver-%2-64bit-%1 ( - md %internal_dir%\debug\ver-%2-64bit-%1 +echo release windows-client for %1, version: %2, cpyType: %3 +if not exist %internal_dir%\debug\ver-%2-%1-%3 ( + md %internal_dir%\debug\ver-%2-%1-%3 ) else ( - rd /S /Q %internal_dir%\debug\ver-%2-64bit-%1 - md %internal_dir%\debug\ver-%2-64bit-%1 + rd /S /Q %internal_dir%\debug\ver-%2-%1-%3 + md %internal_dir%\debug\ver-%2-%1-%3 ) -cd %internal_dir%\debug\ver-%2-64bit-%1 +cd %internal_dir%\debug\ver-%2-%1-%3 + +if %3% == x64 GOTO X64 +if %3% == x86 GOTO X86 +GOTO USAGE + +:X86 +call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 +cmake ../../ -G "NMake Makefiles" -DVERNUMBER=%2 -DCPUTYPE=x86 +GOTO MAKE_AND_INSTALL + +:X64 call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 cmake ../../ -G "NMake Makefiles" -DVERNUMBER=%2 -DCPUTYPE=x64 +GOTO MAKE_AND_INSTALL + +:MAKE_AND_INSTALL set CL=/MP4 nmake install goto EXIT0 :USAGE -echo Usage: release.bat $productName $version +echo Usage: release.bat $productName $version $cpuType goto EXIT0 :EXIT0 \ No newline at end of file diff --git a/packaging/release.sh b/packaging/release.sh index a96b312999..354d713e28 100755 --- a/packaging/release.sh +++ b/packaging/release.sh @@ -101,13 +101,13 @@ echo "verMode=${verMode} verType=${verType} cpuType=${cpuType} osType=${osType} curr_dir=$(pwd) if [ "$osType" == "Darwin" ]; then + script_dir="$(dirname $(readlink -f $0))" + top_dir="$(readlink -f ${script_dir}/..)" +else script_dir=$(dirname $0) cd ${script_dir} script_dir="$(pwd)" top_dir=${script_dir}/.. -else - script_dir="$(dirname $(readlink -f $0))" - top_dir="$(readlink -f ${script_dir}/..)" fi csudo="" @@ -198,6 +198,7 @@ else allocator_macro="" fi +# 3. replace product info if [[ "$dbName" != "taos" ]]; then source ${enterprise_dir}/packaging/oem/sed_$dbName.sh replace_community_$dbName diff --git a/packaging/tools/install_arbi.sh b/packaging/tools/install_arbi.sh index e3c63965d4..6e9be8489b 100755 --- a/packaging/tools/install_arbi.sh +++ b/packaging/tools/install_arbi.sh @@ -7,6 +7,9 @@ set -e #set -x # -----------------------Variables definition--------------------- +productName="TDengine" +emailName="taosdata.com" + script_dir=$(dirname $(readlink -f "$0")) bin_link_dir="/usr/bin" @@ -83,7 +86,7 @@ else echo " osinfo: ${osinfo}" echo " This is an officially unverified linux system," echo " if there are any problems with the installation and operation, " - echo " please feel free to contact taosdata.com for support." + echo " please feel free to contact ${emailName} for support." os_type=1 fi @@ -241,7 +244,7 @@ function install_service_on_systemd() { tarbitratord_service_config="${service_config_dir}/tarbitratord.service" ${csudo}bash -c "echo '[Unit]' >> ${tarbitratord_service_config}" - ${csudo}bash -c "echo 'Description=TDengine arbitrator service' >> ${tarbitratord_service_config}" + ${csudo}bash -c "echo 'Description=${productName} arbitrator service' >> ${tarbitratord_service_config}" ${csudo}bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}" ${csudo}bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}" ${csudo}bash -c "echo >> ${tarbitratord_service_config}" @@ -273,9 +276,9 @@ function install_service() { fi } -function update_TDengine() { +function update_Product() { # Start to update - echo -e "${GREEN}Start to update TDengine's arbitrator ...${NC}" + echo -e "${GREEN}Start to update ${productName}'s arbitrator ...${NC}" # Stop the service if running if pidof tarbitrator &>/dev/null; then if ((${service_mod} == 0)); then @@ -303,12 +306,12 @@ function update_TDengine() { echo -e "${GREEN_DARK}To start arbitrator ${NC}: ./tarbitrator${NC}" fi echo - echo -e "\033[44;32;1mTDengine's arbitrator is updated successfully!${NC}" + echo -e "\033[44;32;1m${productName}'s arbitrator is updated successfully!${NC}" } -function install_TDengine() { +function install_Product() { # Start to install - echo -e "${GREEN}Start to install TDengine's arbitrator ...${NC}" + echo -e "${GREEN}Start to install ${productName}'s arbitrator ...${NC}" install_main_path #install_header @@ -325,7 +328,7 @@ function install_TDengine() { echo -e "${GREEN_DARK}To start arbitrator ${NC}: tarbitrator${NC}" fi - echo -e "\033[44;32;1mTDengine's arbitrator is installed successfully!${NC}" + echo -e "\033[44;32;1m${productName}'s arbitrator is installed successfully!${NC}" echo } @@ -333,7 +336,7 @@ function install_TDengine() { # Install server and client if [ -x ${bin_dir}/tarbitrator ]; then update_flag=1 - update_TDengine + update_Product else - install_TDengine + install_Product fi diff --git a/packaging/tools/install_client.sh b/packaging/tools/install_client.sh index 28001fb769..844ac16a26 100755 --- a/packaging/tools/install_client.sh +++ b/packaging/tools/install_client.sh @@ -18,22 +18,23 @@ clientName="taos" uninstallScript="rmtaos" configFile="taos.cfg" tarName="taos.tar.gz" +demoName="taosdemo" osType=Linux pagMode=full verMode=edge if [ "$osType" != "Darwin" ]; then - script_dir=$(dirname $(readlink -f "$0")) - # Dynamic directory - data_dir=${dataDir} - log_dir=${logDir} + script_dir=$(dirname $(readlink -f "$0")) + # Dynamic directory + data_dir=${dataDir} + log_dir=${logDir} else - script_dir=`dirname $0` - cd ${script_dir} - script_dir="$(pwd)" - data_dir=${dataDir} - log_dir=~/${productName}/log + script_dir=$(dirname $0) + cd ${script_dir} + script_dir="$(pwd)" + data_dir=${dataDir} + log_dir=~/${productName}/log fi log_link_dir="${installDir}/log" @@ -41,14 +42,14 @@ log_link_dir="${installDir}/log" cfg_install_dir=${configDir} if [ "$osType" != "Darwin" ]; then - bin_link_dir="/usr/bin" - lib_link_dir="/usr/lib" - lib64_link_dir="/usr/lib64" - inc_link_dir="/usr/include" + bin_link_dir="/usr/bin" + lib_link_dir="/usr/lib" + lib64_link_dir="/usr/lib64" + inc_link_dir="/usr/include" else - bin_link_dir="/usr/local/bin" - lib_link_dir="/usr/local/lib" - inc_link_dir="/usr/local/include" + bin_link_dir="/usr/local/bin" + lib_link_dir="/usr/local/lib" + inc_link_dir="/usr/local/include" fi #install main path @@ -65,8 +66,8 @@ GREEN_UNDERLINE='\033[4;32m' NC='\033[0m' csudo="" -if command -v sudo > /dev/null; then - csudo="sudo " +if command -v sudo >/dev/null; then + csudo="sudo " fi update_flag=0 @@ -74,7 +75,7 @@ update_flag=0 function kill_client() { pid=$(ps -ef | grep "${clientName}" | grep -v "grep" | awk '{print $2}') if [ -n "$pid" ]; then - ${csudo}kill -9 $pid || : + ${csudo}kill -9 $pid || : fi } @@ -96,186 +97,184 @@ function install_main_path() { function install_bin() { # Remove links - ${csudo}rm -f ${bin_link_dir}/${clientName} || : + ${csudo}rm -f ${bin_link_dir}/${clientName} || : if [ "$osType" != "Darwin" ]; then - ${csudo}rm -f ${bin_link_dir}/taosdemo || : + ${csudo}rm -f ${bin_link_dir}/${demoName} || : fi - ${csudo}rm -f ${bin_link_dir}/${uninstallScript} || : - ${csudo}rm -f ${bin_link_dir}/set_core || : + ${csudo}rm -f ${bin_link_dir}/${uninstallScript} || : + ${csudo}rm -f ${bin_link_dir}/set_core || : ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/* #Make link - [ -x ${install_main_dir}/bin/${clientName} ] && ${csudo}ln -s ${install_main_dir}/bin/${clientName} ${bin_link_dir}/${clientName} || : + [ -x ${install_main_dir}/bin/${clientName} ] && ${csudo}ln -s ${install_main_dir}/bin/${clientName} ${bin_link_dir}/${clientName} || : if [ "$osType" != "Darwin" ]; then - [ -x ${install_main_dir}/bin/taosdemo ] && ${csudo}ln -s ${install_main_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || : + [ -x ${install_main_dir}/bin/${demoName} ] && ${csudo}ln -s ${install_main_dir}/bin/${demoName} ${bin_link_dir}/${demoName} || : fi [ -x ${install_main_dir}/bin/remove_client.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_client.sh ${bin_link_dir}/${uninstallScript} || : [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || : } function clean_lib() { - sudo rm -f /usr/lib/libtaos.* || : - sudo rm -rf ${lib_dir} || : + sudo rm -f /usr/lib/libtaos.* || : + sudo rm -rf ${lib_dir} || : } function install_lib() { - # Remove links - ${csudo}rm -f ${lib_link_dir}/libtaos.* || : - ${csudo}rm -f ${lib64_link_dir}/libtaos.* || : - #${csudo}rm -rf ${v15_java_app_dir} || : + # Remove links + ${csudo}rm -f ${lib_link_dir}/libtaos.* || : + ${csudo}rm -f ${lib64_link_dir}/libtaos.* || : - ${csudo}cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo}chmod 777 ${install_main_dir}/driver/* + ${csudo}cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo}chmod 777 ${install_main_dir}/driver/* - if [ "$osType" != "Darwin" ]; then - ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1 - ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so + if [ "$osType" != "Darwin" ]; then + ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1 + ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so - if [ -d "${lib64_link_dir}" ]; then - ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || : - ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || : - fi - else - ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib - ${csudo}ln -s ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib + if [ -d "${lib64_link_dir}" ]; then + ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || : + ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || : fi + else + ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib + ${csudo}ln -s ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib + fi - if [ "$osType" != "Darwin" ]; then - ${csudo}ldconfig - else - ${csudo}update_dyld_shared_cache - fi + if [ "$osType" != "Darwin" ]; then + ${csudo}ldconfig + else + ${csudo}update_dyld_shared_cache + fi } function install_header() { - ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || : - ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/* - ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h - ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h - ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h + ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || : + ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/* + ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h + ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h + ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h } function install_jemalloc() { - jemalloc_dir=${script_dir}/jemalloc - - if [ -d ${jemalloc_dir} ]; then - ${csudo}/usr/bin/install -c -d /usr/local/bin - - if [ -f ${jemalloc_dir}/bin/jemalloc-config ]; then - ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin - fi - if [ -f ${jemalloc_dir}/bin/jemalloc.sh ]; then - ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin - fi - if [ -f ${jemalloc_dir}/bin/jeprof ]; then - ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin - fi - if [ -f ${jemalloc_dir}/include/jemalloc/jemalloc.h ]; then - ${csudo}/usr/bin/install -c -d /usr/local/include/jemalloc - ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc - fi - if [ -f ${jemalloc_dir}/lib/libjemalloc.so.2 ]; then - ${csudo}/usr/bin/install -c -d /usr/local/lib - ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib - ${csudo}ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so - ${csudo}/usr/bin/install -c -d /usr/local/lib - if [ -f ${jemalloc_dir}/lib/libjemalloc.a ]; then - ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib - fi - if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then - ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib - fi - if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then - ${csudo}/usr/bin/install -c -d /usr/local/lib/pkgconfig - ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig - fi - fi - if [ -f ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html ]; then - ${csudo}/usr/bin/install -c -d /usr/local/share/doc/jemalloc - ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc - fi - if [ -f ${jemalloc_dir}/share/man/man3/jemalloc.3 ]; then - ${csudo}/usr/bin/install -c -d /usr/local/share/man/man3 - ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3 - fi - - if [ -d /etc/ld.so.conf.d ]; then - echo "/usr/local/lib" | ${csudo}tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf" - ${csudo}ldconfig - else - echo "/etc/ld.so.conf.d not found!" - fi + jemalloc_dir=${script_dir}/jemalloc + + if [ -d ${jemalloc_dir} ]; then + ${csudo}/usr/bin/install -c -d /usr/local/bin + + if [ -f ${jemalloc_dir}/bin/jemalloc-config ]; then + ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin + fi + if [ -f ${jemalloc_dir}/bin/jemalloc.sh ]; then + ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin + fi + if [ -f ${jemalloc_dir}/bin/jeprof ]; then + ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin + fi + if [ -f ${jemalloc_dir}/include/jemalloc/jemalloc.h ]; then + ${csudo}/usr/bin/install -c -d /usr/local/include/jemalloc + ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc + fi + if [ -f ${jemalloc_dir}/lib/libjemalloc.so.2 ]; then + ${csudo}/usr/bin/install -c -d /usr/local/lib + ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib + ${csudo}ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so + ${csudo}/usr/bin/install -c -d /usr/local/lib + if [ -f ${jemalloc_dir}/lib/libjemalloc.a ]; then + ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib + fi + if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then + ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib + fi + if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then + ${csudo}/usr/bin/install -c -d /usr/local/lib/pkgconfig + ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig + fi fi + if [ -f ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html ]; then + ${csudo}/usr/bin/install -c -d /usr/local/share/doc/jemalloc + ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc + fi + if [ -f ${jemalloc_dir}/share/man/man3/jemalloc.3 ]; then + ${csudo}/usr/bin/install -c -d /usr/local/share/man/man3 + ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3 + fi + + if [ -d /etc/ld.so.conf.d ]; then + echo "/usr/local/lib" | ${csudo}tee /etc/ld.so.conf.d/jemalloc.conf >/dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf" + ${csudo}ldconfig + else + echo "/etc/ld.so.conf.d not found!" + fi + fi } function install_config() { - if [ ! -f ${cfg_install_dir}/${configFile} ]; then - ${csudo}mkdir -p ${cfg_install_dir} - [ -f ${script_dir}/cfg/${configFile} ] && ${csudo}cp ${script_dir}/cfg/${configFile} ${cfg_install_dir} - ${csudo}chmod 644 ${cfg_install_dir}/* - fi + if [ ! -f ${cfg_install_dir}/${configFile} ]; then + ${csudo}mkdir -p ${cfg_install_dir} + [ -f ${script_dir}/cfg/${configFile} ] && ${csudo}cp ${script_dir}/cfg/${configFile} ${cfg_install_dir} + ${csudo}chmod 644 ${cfg_install_dir}/* + fi - ${csudo}cp -f ${script_dir}/cfg/${configFile} ${install_main_dir}/cfg/${configFile}.org - ${csudo}ln -s ${cfg_install_dir}/${configFile} ${install_main_dir}/cfg + ${csudo}cp -f ${script_dir}/cfg/${configFile} ${install_main_dir}/cfg/${configFile}.org + ${csudo}ln -s ${cfg_install_dir}/${configFile} ${install_main_dir}/cfg } - function install_log() { - ${csudo}rm -rf ${log_dir} || : + ${csudo}rm -rf ${log_dir} || : - if [ "$osType" != "Darwin" ]; then - ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir} - else - mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir} - fi - ${csudo}ln -s ${log_dir} ${install_main_dir}/log + if [ "$osType" != "Darwin" ]; then + ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir} + else + mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir} + fi + ${csudo}ln -s ${log_dir} ${install_main_dir}/log } function install_connector() { - ${csudo}cp -rf ${script_dir}/connector/ ${install_main_dir}/ + ${csudo}cp -rf ${script_dir}/connector/ ${install_main_dir}/ } function install_examples() { - if [ -d ${script_dir}/examples ]; then - ${csudo}cp -rf ${script_dir}/examples/* ${install_main_dir}/examples - fi + if [ -d ${script_dir}/examples ]; then + ${csudo}cp -rf ${script_dir}/examples/* ${install_main_dir}/examples + fi } -function update_TDengine() { - # Start to update - if [ ! -e ${tarName} ]; then - echo "File ${tarName} does not exist" - exit 1 - fi - tar -zxf ${tarName} +function update_Product() { + # Start to update + if [ ! -e ${tarName} ]; then + echo "File ${tarName} does not exist" + exit 1 + fi + tar -zxf ${tarName} - echo -e "${GREEN}Start to update ${productName} client...${NC}" - # Stop the client shell if running - if pidof ${clientName} &> /dev/null; then - kill_client - sleep 1 - fi + echo -e "${GREEN}Start to update ${productName} client...${NC}" + # Stop the client shell if running + if pidof ${clientName} &>/dev/null; then + kill_client + sleep 1 + fi - install_main_path + install_main_path - install_log - install_header - install_lib - install_jemalloc - if [ "$verMode" == "cluster" ]; then - install_connector - fi - install_examples - install_bin - install_config + install_log + install_header + install_lib + install_jemalloc + if [ "$verMode" == "cluster" ]; then + install_connector + fi + install_examples + install_bin + install_config - echo - echo -e "\033[44;32;1m${productName} client is updated successfully!${NC}" + echo + echo -e "\033[44;32;1m${productName} client is updated successfully!${NC}" - rm -rf $(tar -tf ${tarName}) + rm -rf $(tar -tf ${tarName}) } -function install_TDengine() { +function install_Product() { # Start to install if [ ! -e ${tarName} ]; then echo "File ${tarName} does not exist" @@ -303,18 +302,17 @@ function install_TDengine() { rm -rf $(tar -tf ${tarName}) } - ## ==============================Main program starts from here============================ # Install or updata client and client # if server is already install, don't install client - if [ -e ${bin_dir}/${serverName} ]; then - echo -e "\033[44;32;1mThere are already installed ${productName} server, so don't need install client!${NC}" - exit 0 - fi +if [ -e ${bin_dir}/${serverName} ]; then + echo -e "\033[44;32;1mThere are already installed ${productName} server, so don't need install client!${NC}" + exit 0 +fi - if [ -x ${bin_dir}/${clientName} ]; then - update_flag=1 - update_TDengine - else - install_TDengine - fi +if [ -x ${bin_dir}/${clientName} ]; then + update_flag=1 + update_Product +else + install_Product +fi diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index dc5d9f1bc6..bcb3664c29 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -29,7 +29,11 @@ installDir="/usr/local/taos" productName="TDengine" emailName="taosdata.com" uninstallScript="rmtaos" +adapterName="taosadapter" +demoName="taosdemo" +benchmarkName="taosBenchmark" +# Dynamic directory if [ "$osType" != "Darwin" ]; then data_dir=${dataDir} log_dir=${logDir} @@ -125,14 +129,14 @@ if [ "$osType" != "Darwin" ]; then fi fi -function kill_taosadapter() { - pid=$(ps -ef | grep "taosadapter" | grep -v "grep" | awk '{print $2}') +function kill_adapter() { + pid=$(ps -ef | grep "${adapterName}" | grep -v "grep" | awk '{print $2}') if [ -n "$pid" ]; then ${csudo}kill -9 $pid || : fi } -function kill_taosd() { +function kill_server() { ps -ef | grep ${serverName} pid=$(ps -ef | grep -w ${serverName} | grep -v "grep" | awk '{print $2}') if [ -n "$pid" ]; then @@ -168,40 +172,39 @@ function install_bin() { # Remove links ${csudo}rm -f ${bin_link_dir}/${clientName} || : ${csudo}rm -f ${bin_link_dir}/${serverName} || : - ${csudo}rm -f ${bin_link_dir}/taosadapter || : - ${csudo}rm -f ${bin_link_dir}/taosdemo || : - ${csudo}rm -f ${bin_link_dir}/taosdump || : + ${csudo}rm -f ${bin_link_dir}/${adapterName} || : + ${csudo}rm -f ${bin_link_dir}/${demoName} || : if [ "$osType" != "Darwin" ]; then ${csudo}rm -f ${bin_link_dir}/perfMonitor || : ${csudo}rm -f ${bin_link_dir}/set_core || : - ${csudo}rm -f ${bin_link_dir}/run_taosd_and_taosadapter.sh || : + ${csudo}rm -f ${bin_link_dir}/run_${serverName}_and_${adapterName}.sh || : ${csudo}rm -f ${bin_link_dir}/${uninstallScript} || : ${csudo}cp -r ${binary_dir}/build/bin/${clientName} ${install_main_dir}/bin || : - [ -f ${binary_dir}/build/bin/taosBenchmark ] && ${csudo}cp -r ${binary_dir}/build/bin/taosBenchmark ${install_main_dir}/bin || : - [ -f ${install_main_dir}/bin/taosBenchmark ] && ${csudo}ln -sf ${install_main_dir}/bin/taosBenchmark ${install_main_dir}/bin/taosdemo || : - [ -f ${binary_dir}/build/bin/taosdump ] && ${csudo}cp -r ${binary_dir}/build/bin/taosdump ${install_main_dir}/bin || : - [ -f ${binary_dir}/build/bin/taosadapter ] && ${csudo}cp -r ${binary_dir}/build/bin/taosadapter ${install_main_dir}/bin || : + [ -f ${binary_dir}/build/bin/${benchmarkName} ] && ${csudo}cp -r ${binary_dir}/build/bin/${benchmarkName} ${install_main_dir}/bin || : + [ -f ${install_main_dir}/bin/${benchmarkName} ] && ${csudo}ln -sf ${install_main_dir}/bin/${benchmarkName} ${install_main_dir}/bin/${demoName} || : + # [ -f ${binary_dir}/build/bin/taosdump ] && ${csudo}cp -r ${binary_dir}/build/bin/taosdump ${install_main_dir}/bin || : + [ -f ${binary_dir}/build/bin/${adapterName} ] && ${csudo}cp -r ${binary_dir}/build/bin/${adapterName} ${install_main_dir}/bin || : ${csudo}cp -r ${binary_dir}/build/bin/${serverName} ${install_main_dir}/bin || : ${csudo}cp -r ${binary_dir}/build/bin/tarbitrator ${install_main_dir}/bin || : ${csudo}cp -r ${script_dir}/taosd-dump-cfg.gdb ${install_main_dir}/bin ${csudo}cp -r ${script_dir}/remove.sh ${install_main_dir}/bin ${csudo}cp -r ${script_dir}/set_core.sh ${install_main_dir}/bin - ${csudo}cp -r ${script_dir}/run_taosd_and_taosadapter.sh ${install_main_dir}/bin + ${csudo}cp -r ${script_dir}/run_${serverName}_and_${adapterName}.sh ${install_main_dir}/bin ${csudo}cp -r ${script_dir}/startPre.sh ${install_main_dir}/bin ${csudo}chmod 0555 ${install_main_dir}/bin/* #Make link [ -x ${install_main_dir}/bin/${clientName} ] && ${csudo}ln -s ${install_main_dir}/bin/${clientName} ${bin_link_dir}/${clientName} || : [ -x ${install_main_dir}/bin/${serverName} ] && ${csudo}ln -s ${install_main_dir}/bin/${serverName} ${bin_link_dir}/${serverName} || : - [ -x ${install_main_dir}/bin/taosadapter ] && ${csudo}ln -s ${install_main_dir}/bin/taosadapter ${bin_link_dir}/taosadapter || : - [ -x ${install_main_dir}/bin/taosdump ] && ${csudo}ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump || : - [ -x ${install_main_dir}/bin/taosdemo ] && ${csudo}ln -s ${install_main_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || : + [ -x ${install_main_dir}/bin/${adapterName} ] && ${csudo}ln -s ${install_main_dir}/bin/${adapterName} ${bin_link_dir}/${adapterName} || : + # [ -x ${install_main_dir}/bin/taosdump ] && ${csudo}ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump || : + [ -x ${install_main_dir}/bin/${demoName} ] && ${csudo}ln -s ${install_main_dir}/bin/${demoName} ${bin_link_dir}/${demoName} || : [ -x ${install_main_dir}/bin/perfMonitor ] && ${csudo}ln -s ${install_main_dir}/bin/perfMonitor ${bin_link_dir}/perfMonitor || : [ -x ${install_main_dir}/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || : - [ -x ${install_main_dir}/run_taosd_and_taosadapter.sh ] && ${csudo}ln -s ${install_main_dir}/bin/run_taosd_and_taosadapter.sh ${bin_link_dir}/run_taosd_and_taosadapter.sh || : + [ -x ${install_main_dir}/run_${serverName}_and_${adapterName}.sh ] && ${csudo}ln -s ${install_main_dir}/bin/run_${serverName}_and_${adapterName}.sh ${bin_link_dir}/run_${serverName}_and_${adapterName}.sh || : [ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript} || : else @@ -212,9 +215,9 @@ function install_bin() { #Make link [ -x ${install_main_dir}/bin/${clientName} ] || [ -x ${install_main_2_dir}/bin/${clientName} ] && ${csudo}ln -s ${install_main_dir}/bin/${clientName} ${bin_link_dir}/${clientName} || ${csudo}ln -s ${install_main_2_dir}/bin/${clientName} || : [ -x ${install_main_dir}/bin/${serverName} ] || [ -x ${install_main_2_dir}/bin/${serverName} ] && ${csudo}ln -s ${install_main_dir}/bin/${serverName} ${bin_link_dir}/${serverName} || ${csudo}ln -s ${install_main_2_dir}/bin/${serverName} || : - [ -x ${install_main_dir}/bin/taosadapter ] || [ -x ${install_main_2_dir}/bin/taosadapter ] && ${csudo}ln -s ${install_main_dir}/bin/taosadapter ${bin_link_dir}/taosadapter || ${csudo}ln -s ${install_main_2_dir}/bin/taosadapter || : - [ -x ${install_main_dir}/bin/taosdump ] || [ -x ${install_main_2_dir}/bin/taosdump ] && ${csudo}ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump || ln -s ${install_main_2_dir}/bin/taosdump ${bin_link_dir}/taosdump || : - [ -x ${install_main_dir}/bin/taosdemo ] || [ -x ${install_main_2_dir}/bin/taosdemo ] && ${csudo}ln -s ${install_main_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || ln -s ${install_main_2_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || : + [ -x ${install_main_dir}/bin/${adapterName} ] || [ -x ${install_main_2_dir}/bin/${adapterName} ] && ${csudo}ln -s ${install_main_dir}/bin/${adapterName} ${bin_link_dir}/${adapterName} || ${csudo}ln -s ${install_main_2_dir}/bin/${adapterName} || : + # [ -x ${install_main_dir}/bin/taosdump ] || [ -x ${install_main_2_dir}/bin/taosdump ] && ${csudo}ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump || ln -s ${install_main_2_dir}/bin/taosdump ${bin_link_dir}/taosdump || : + [ -x ${install_main_dir}/bin/${demoName} ] || [ -x ${install_main_2_dir}/bin/${demoName} ] && ${csudo}ln -s ${install_main_dir}/bin/${demoName} ${bin_link_dir}/${demoName} || ln -s ${install_main_2_dir}/bin/${demoName} ${bin_link_dir}/${demoName} || : fi } @@ -380,23 +383,23 @@ function install_config() { fi } -function install_taosadapter_config() { - if [ ! -f "${cfg_install_dir}/taosadapter.toml" ]; then +function install_adapter_config() { + if [ ! -f "${cfg_install_dir}/${adapterName}.toml" ]; then ${csudo}mkdir -p ${cfg_install_dir} - [ -f ${binary_dir}/test/cfg/taosadapter.toml ] && - ${csudo}cp ${binary_dir}/test/cfg/taosadapter.toml ${cfg_install_dir} - [ -f ${cfg_install_dir}/taosadapter.toml ] && - ${csudo}chmod 644 ${cfg_install_dir}/taosadapter.toml - [ -f ${binary_dir}/test/cfg/taosadapter.toml ] && - ${csudo}cp -f ${binary_dir}/test/cfg/taosadapter.toml \ - ${cfg_install_dir}/taosadapter.toml.${verNumber} - [ -f ${cfg_install_dir}/taosadapter.toml ] && - ${csudo}ln -s ${cfg_install_dir}/taosadapter.toml \ - ${install_main_dir}/cfg/taosadapter.toml + [ -f ${binary_dir}/test/cfg/${adapterName}.toml ] && + ${csudo}cp ${binary_dir}/test/cfg/${adapterName}.toml ${cfg_install_dir} + [ -f ${cfg_install_dir}/${adapterName}.toml ] && + ${csudo}chmod 644 ${cfg_install_dir}/${adapterName}.toml + [ -f ${binary_dir}/test/cfg/${adapterName}.toml ] && + ${csudo}cp -f ${binary_dir}/test/cfg/${adapterName}.toml \ + ${cfg_install_dir}/${adapterName}.toml.${verNumber} + [ -f ${cfg_install_dir}/${adapterName}.toml ] && + ${csudo}ln -s ${cfg_install_dir}/${adapterName}.toml \ + ${install_main_dir}/cfg/${adapterName}.toml else - if [ -f "${binary_dir}/test/cfg/taosadapter.toml" ]; then - ${csudo}cp -f ${binary_dir}/test/cfg/taosadapter.toml \ - ${cfg_install_dir}/taosadapter.toml.${verNumber} + if [ -f "${binary_dir}/test/cfg/${adapterName}.toml" ]; then + ${csudo}cp -f ${binary_dir}/test/cfg/${adapterName}.toml \ + ${cfg_install_dir}/${adapterName}.toml.${verNumber} fi fi } @@ -529,10 +532,10 @@ function install_service_on_systemd() { ${csudo}systemctl enable ${serverName} } -function install_taosadapter_service() { +function install_adapter_service() { if ((${service_mod} == 0)); then - [ -f ${binary_dir}/test/cfg/taosadapter.service ] && - ${csudo}cp ${binary_dir}/test/cfg/taosadapter.service \ + [ -f ${binary_dir}/test/cfg/${adapterName}.service ] && + ${csudo}cp ${binary_dir}/test/cfg/${adapterName}.service \ ${service_config_dir}/ || : ${csudo}systemctl daemon-reload fi @@ -544,11 +547,11 @@ function install_service() { elif ((${service_mod} == 1)); then install_service_on_sysvinit else - kill_taosd + kill_server fi } -function update_TDengine() { +function update_Product() { echo -e "${GREEN}Start to update ${productName}...${NC}" # Stop the service if running @@ -558,8 +561,8 @@ function update_TDengine() { elif ((${service_mod} == 1)); then ${csudo}service ${serverName} stop || : else - kill_taosadapter - kill_taosd + kill_adapter + kill_server fi sleep 1 fi @@ -574,23 +577,23 @@ function update_TDengine() { install_bin install_service - install_taosadapter_service + install_adapter_service install_config - install_taosadapter_config + install_adapter_config echo echo -e "\033[44;32;1m${productName} is updated successfully!${NC}" echo echo -e "${GREEN_DARK}To configure ${productName} ${NC}: edit ${configDir}/${configFile}" - echo -e "${GREEN_DARK}To configure Taos Adapter (if has) ${NC}: edit ${configDir}/taosadapter.toml" + echo -e "${GREEN_DARK}To configure ${adapterName} (if has) ${NC}: edit ${configDir}/${adapterName}.toml" if ((${service_mod} == 0)); then echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${csudo}systemctl start ${serverName}${NC}" elif ((${service_mod} == 1)); then echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${csudo}service ${serverName} start${NC}" else - echo -e "${GREEN_DARK}To start Taos Adapter (if has)${NC}: taosadapter &${NC}" + echo -e "${GREEN_DARK}To start ${adapterName} (if has)${NC}: ${adapterName} &${NC}" echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${serverName}${NC}" fi @@ -599,7 +602,7 @@ function update_TDengine() { echo -e "\033[44;32;1m${productName} is updated successfully!${NC}" } -function install_TDengine() { +function install_Product() { # Start to install echo -e "${GREEN}Start to install ${productName}...${NC}" @@ -614,23 +617,23 @@ function install_TDengine() { install_bin install_service - install_taosadapter_service + install_adapter_service install_config - install_taosadapter_config + install_adapter_config # Ask if to start the service echo echo -e "\033[44;32;1m${productName} is installed successfully!${NC}" echo echo -e "${GREEN_DARK}To configure ${productName} ${NC}: edit ${configDir}/${configFile}" - echo -e "${GREEN_DARK}To configure taosadapter (if has) ${NC}: edit ${configDir}/taosadapter.toml" + echo -e "${GREEN_DARK}To configure ${adapterName} (if has) ${NC}: edit ${configDir}/${adapterName}.toml" if ((${service_mod} == 0)); then echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${csudo}systemctl start ${serverName}${NC}" elif ((${service_mod} == 1)); then echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${csudo}service ${serverName} start${NC}" else - echo -e "${GREEN_DARK}To start Taos Adapter (if has)${NC}: taosadapter &${NC}" + echo -e "${GREEN_DARK}To start ${adapterName} (if has)${NC}: ${adapterName} &${NC}" echo -e "${GREEN_DARK}To start ${productName} ${NC}: ./${serverName}${NC}" fi @@ -644,14 +647,14 @@ echo source directory: $1 echo binary directory: $2 if [ "$osType" != "Darwin" ]; then if [ -x ${bin_dir}/${clientName} ]; then - update_TDengine + update_Product else - install_TDengine + install_Product fi else if [ -x ${bin_dir}/${clientName} ] || [ -x ${bin_2_dir}/${clientName} ]; then - update_TDengine + update_Product else - install_TDengine + install_Product fi fi diff --git a/packaging/tools/makearbi.sh b/packaging/tools/makearbi.sh index 6dacfdd90d..4991dcb934 100755 --- a/packaging/tools/makearbi.sh +++ b/packaging/tools/makearbi.sh @@ -36,13 +36,11 @@ fi bin_files="${build_dir}/bin/tarbitrator ${script_dir}/remove_arbi.sh" install_files="${script_dir}/install_arbi.sh" -#header_files="${code_dir}/inc/taos.h ${code_dir}/inc/taosdef.h ${code_dir}/inc/taoserror.h" init_file_tarbitrator_deb=${script_dir}/../deb/tarbitratord init_file_tarbitrator_rpm=${script_dir}/../rpm/tarbitratord # make directories. mkdir -p ${install_dir} && cp ${install_files} ${install_dir} && chmod a+x ${install_dir}/install_arbi.sh || : -#mkdir -p ${install_dir}/inc && cp ${header_files} ${install_dir}/inc || : 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_file_tarbitrator_deb} ${install_dir}/init.d/tarbitratord.deb || : mkdir -p ${install_dir}/init.d && cp ${init_file_tarbitrator_rpm} ${install_dir}/init.d/tarbitratord.rpm || : diff --git a/packaging/tools/makeclient.sh b/packaging/tools/makeclient.sh index 89865ae54f..1b5a3f159d 100755 --- a/packaging/tools/makeclient.sh +++ b/packaging/tools/makeclient.sh @@ -44,7 +44,6 @@ else fi # Directories and files. - if [ "$osType" != "Darwin" ]; then if [ "$pagMode" == "lite" ]; then strip ${build_dir}/bin/${clientName} @@ -182,26 +181,27 @@ if [[ $productName == "TDengine" ]]; then fi fi fi + # Copy driver mkdir -p ${install_dir}/driver cp ${lib_files} ${install_dir}/driver # Copy connector -connector_dir="${code_dir}/connector" -mkdir -p ${install_dir}/connector - -if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then - if [ "$osType" != "Darwin" ]; then - cp ${build_dir}/lib/*.jar ${install_dir}/connector || : - 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 - cp -r ${connector_dir}/nodejs ${install_dir}/connector -fi +#connector_dir="${code_dir}/connector" +#mkdir -p ${install_dir}/connector +# +#if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then +# if [ "$osType" != "Darwin" ]; then +# cp ${build_dir}/lib/*.jar ${install_dir}/connector || : +# 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 +# cp -r ${connector_dir}/nodejs ${install_dir}/connector +#fi # Copy release note # cp ${script_dir}/release_note ${install_dir} diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index f886d08df0..db8a209747 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -16,12 +16,16 @@ serverName="taosd" clientName="taos" uninstallScript="rmtaos" productName="TDengine" +adapterName="taosadapter" +benchmarkName="taosBenchmark" +dumpName="taosdump" +demoName="taosdemo" #install main path install_main_dir=${installDir} -data_link_dir=${installDir}/data -log_link_dir=${installDir}/log -cfg_link_dir=${installDir}/cfg +data_link_dir="${installDir}/data" +log_link_dir="${installDir}/log" +cfg_link_dir="${installDir}/cfg" bin_link_dir="/usr/bin" local_bin_link_dir="/usr/local/bin" lib_link_dir="/usr/lib" @@ -31,7 +35,7 @@ install_nginxd_dir="/usr/local/nginxd" service_config_dir="/etc/systemd/system" taos_service_name=${serverName} -taosadapter_service_name="taosadapter" +taosadapter_service_name=${adapterName} tarbitrator_service_name="tarbitratord" nginx_service_name="nginxd" csudo="" @@ -59,22 +63,8 @@ else service_mod=2 fi -function kill_taosadapter() { - pid=$(ps -ef | grep "taosadapter" | grep -v "grep" | awk '{print $2}') - if [ -n "$pid" ]; then - ${csudo}kill -9 $pid || : - fi -} - -function kill_taosd() { - pid=$(ps -ef | grep ${serverName} | grep -v "grep" | awk '{print $2}') - if [ -n "$pid" ]; then - ${csudo}kill -9 $pid || : - fi -} - -function kill_tarbitrator() { - pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}') +function kill_process() { + pid=$(ps -ef | grep "$1" | grep -v "grep" | awk '{print $2}') if [ -n "$pid" ]; then ${csudo}kill -9 $pid || : fi @@ -84,14 +74,14 @@ function clean_bin() { # Remove link ${csudo}rm -f ${bin_link_dir}/${clientName} || : ${csudo}rm -f ${bin_link_dir}/${serverName} || : - ${csudo}rm -f ${bin_link_dir}/taosadapter || : - ${csudo}rm -f ${bin_link_dir}/taosBenchmark || : - ${csudo}rm -f ${bin_link_dir}/taosdemo || : - ${csudo}rm -f ${bin_link_dir}/taosdump || : + ${csudo}rm -f ${bin_link_dir}/${adapterName} || : + ${csudo}rm -f ${bin_link_dir}/${benchmarkName} || : + ${csudo}rm -f ${bin_link_dir}/${demoName} || : + ${csudo}rm -f ${bin_link_dir}/${dumpName} || : ${csudo}rm -f ${bin_link_dir}/${uninstallScript} || : ${csudo}rm -f ${bin_link_dir}/tarbitrator || : ${csudo}rm -f ${bin_link_dir}/set_core || : - ${csudo}rm -f ${bin_link_dir}/run_taosd_and_taosadapter.sh || : + ${csudo}rm -f ${bin_link_dir}/run_${serverName}_and_${adapterName}.sh || : ${csudo}rm -f ${bin_link_dir}/TDinsight.sh || : } @@ -133,9 +123,9 @@ function clean_service_on_systemd() { ${csudo}systemctl disable ${taos_service_name} &>/dev/null || echo &>/dev/null ${csudo}rm -f ${taosd_service_config} - taosadapter_service_config="${service_config_dir}/taosadapter.service" + taosadapter_service_config="${service_config_dir}/${adapterName}.service" if systemctl is-active --quiet ${taosadapter_service_name}; then - echo "${productName} taosAdapter is running, stopping it..." + echo "${productName} ${adapterName} is running, stopping it..." ${csudo}systemctl stop ${taosadapter_service_name} &>/dev/null || echo &>/dev/null fi ${csudo}systemctl disable ${taosadapter_service_name} &>/dev/null || echo &>/dev/null @@ -210,9 +200,9 @@ function clean_service() { elif ((${service_mod} == 1)); then clean_service_on_sysvinit else - kill_taosadapter - kill_taosd - kill_tarbitrator + kill_process ${adapterName} + kill_process ${serverName} + kill_process "tarbitrator" fi } diff --git a/packaging/tools/remove_client.sh b/packaging/tools/remove_client.sh index f2cbccb45f..701bfde273 100755 --- a/packaging/tools/remove_client.sh +++ b/packaging/tools/remove_client.sh @@ -23,47 +23,46 @@ lib64_link_dir="/usr/lib64" inc_link_dir="/usr/include" csudo="" -if command -v sudo > /dev/null; then - csudo="sudo " +if command -v sudo >/dev/null; then + csudo="sudo " fi function kill_client() { if [ -n "$(pidof ${clientName})" ]; then - ${csudo}kill -9 $pid || : + ${csudo}kill -9 $pid || : fi } function clean_bin() { - # Remove link - ${csudo}rm -f ${bin_link_dir}/${clientName} || : - ${csudo}rm -f ${bin_link_dir}/taosdemo || : - ${csudo}rm -f ${bin_link_dir}/taosdump || : - ${csudo}rm -f ${bin_link_dir}/${uninstallScript} || : - ${csudo}rm -f ${bin_link_dir}/set_core || : + # Remove link + ${csudo}rm -f ${bin_link_dir}/${clientName} || : + ${csudo}rm -f ${bin_link_dir}/taosdemo || : + ${csudo}rm -f ${bin_link_dir}/${uninstallScript} || : + ${csudo}rm -f ${bin_link_dir}/set_core || : } function clean_lib() { - # Remove link - ${csudo}rm -f ${lib_link_dir}/libtaos.* || : - ${csudo}rm -f ${lib64_link_dir}/libtaos.* || : - #${csudo}rm -rf ${v15_java_app_dir} || : + # Remove link + ${csudo}rm -f ${lib_link_dir}/libtaos.* || : + ${csudo}rm -f ${lib64_link_dir}/libtaos.* || : + #${csudo}rm -rf ${v15_java_app_dir} || : } function clean_header() { - # Remove link - ${csudo}rm -f ${inc_link_dir}/taos.h || : - ${csudo}rm -f ${inc_link_dir}/taosdef.h || : - ${csudo}rm -f ${inc_link_dir}/taoserror.h || : + # Remove link + ${csudo}rm -f ${inc_link_dir}/taos.h || : + ${csudo}rm -f ${inc_link_dir}/taosdef.h || : + ${csudo}rm -f ${inc_link_dir}/taoserror.h || : } function clean_config() { - # Remove link - ${csudo}rm -f ${cfg_link_dir}/* || : + # Remove link + ${csudo}rm -f ${cfg_link_dir}/* || : } function clean_log() { - # Remove link - ${csudo}rm -rf ${log_link_dir} || : + # Remove link + ${csudo}rm -rf ${log_link_dir} || : } # Stop client. @@ -82,4 +81,4 @@ clean_config ${csudo}rm -rf ${install_main_dir} echo -e "${GREEN}TDengine client is removed successfully!${NC}" -echo +echo -- GitLab