From ab19aadea5a190963be7b533b594d7290098ba42 Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Mon, 25 Sep 2023 15:02:46 +0800 Subject: [PATCH] update packaging script --- packaging/tools/install.sh | 35 +++++++++++++++++++++++++--- packaging/tools/remove.sh | 47 ++++++++++++++++++++------------------ 2 files changed, 57 insertions(+), 25 deletions(-) diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 19efa7b169..0a11ef3a53 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -33,14 +33,17 @@ adapterName="taosadapter" benchmarkName="taosBenchmark" dumpName="taosdump" demoName="taosdemo" +xname="taosx" clientName2="taos" serverName2="${clientName2}d" configFile2="${clientName2}.cfg" productName2="TDengine" emailName2="taosdata.com" +xname2="${clientName2}x" adapterName2="${clientName2}adapter" +explorerName="${clientName2}-explorer" benchmarkName2="${clientName2}Benchmark" demoName2="${clientName2}demo" dumpName2="${clientName2}dump" @@ -235,6 +238,12 @@ function install_bin() { [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || : if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then + ${csudo}rm -f ${bin_link_dir}/${xname2} || : + ${csudo}rm -f ${bin_link_dir}/${explorerName} || : + + #Make link + [ -x ${install_main_dir}/bin/${xname2} ] && ${csudo}ln -sf ${install_main_dir}/bin/${xname2} ${bin_link_dir}/${xname2} || : + [ -x ${install_main_dir}/bin/${explorerName} ] && ${csudo}ln -sf ${install_main_dir}/bin/${explorerName} ${bin_link_dir}/${explorerName} || : [ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript2} || : fi } @@ -693,9 +702,29 @@ function clean_service_on_systemd() { fi ${csudo}systemctl disable tarbitratord &>/dev/null || echo &>/dev/null ${csudo}rm -f ${tarbitratord_service_config} - # if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then - # ${csudo}rm -f ${service_config_dir}/${serverName2}.service - # fi + + if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then + x_service_config="${service_config_dir}/${xName2}.service" + if [ -e "$x_service_config" ]; then + if systemctl is-active --quiet ${xName2}; then + echo "${productName2} ${xName2} is running, stopping it..." + ${csudo}systemctl stop ${xName2} &>/dev/null || echo &>/dev/null + fi + ${csudo}systemctl disable ${xName2} &>/dev/null || echo &>/dev/null + ${csudo}rm -f ${x_service_config} + fi + + explorer_service_config="${service_config_dir}/${explorerName2}.service" + if [ -e "$explorer_service_config" ]; then + if systemctl is-active --quiet ${explorerName2}; then + echo "${productName2} ${explorerName2} is running, stopping it..." + ${csudo}systemctl stop ${explorerName2} &>/dev/null || echo &>/dev/null + fi + ${csudo}systemctl disable ${explorerName2} &>/dev/null || echo &>/dev/null + ${csudo}rm -f ${explorer_service_config} + ${csudo}rm -f /etc/${clientName2}/explorer.toml + fi + fi } function install_service_on_systemd() { diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index 0e8b036f28..97bffb0535 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -123,10 +123,11 @@ function clean_bin() { ${csudo}rm -f ${bin_link_dir}/set_core || : ${csudo}rm -f ${bin_link_dir}/TDinsight.sh || : ${csudo}rm -f ${bin_link_dir}/${keeperName2} || : - # ${csudo}rm -f ${bin_link_dir}/${xName2} || : - # ${csudo}rm -f ${bin_link_dir}/${explorerName2} || : + if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then + ${csudo}rm -f ${bin_link_dir}/${xName2} || : + ${csudo}rm -f ${bin_link_dir}/${explorerName2} || : ${csudo}rm -f ${bin_link_dir}/${clientName2} || : ${csudo}rm -f ${bin_link_dir}/${benchmarkName2} || : ${csudo}rm -f ${bin_link_dir}/${dumpName2} || : @@ -194,27 +195,29 @@ function clean_service_on_systemd() { ${csudo}systemctl stop ${tarbitrator_service_name} &>/dev/null || echo &>/dev/null fi ${csudo}systemctl disable ${tarbitrator_service_name} &>/dev/null || echo &>/dev/null + + if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then + x_service_config="${service_config_dir}/${xName2}.service" + if [ -e "$x_service_config" ]; then + if systemctl is-active --quiet ${xName2}; then + echo "${productName2} ${xName2} is running, stopping it..." + ${csudo}systemctl stop ${xName2} &>/dev/null || echo &>/dev/null + fi + ${csudo}systemctl disable ${xName2} &>/dev/null || echo &>/dev/null + ${csudo}rm -f ${x_service_config} + fi - # x_service_config="${service_config_dir}/${xName2}.service" - # if [ -e "$x_service_config" ]; then - # if systemctl is-active --quiet ${xName2}; then - # echo "${productName2} ${xName2} is running, stopping it..." - # ${csudo}systemctl stop ${xName2} &>/dev/null || echo &>/dev/null - # fi - # ${csudo}systemctl disable ${xName2} &>/dev/null || echo &>/dev/null - # ${csudo}rm -f ${x_service_config} - # fi - - # explorer_service_config="${service_config_dir}/${explorerName2}.service" - # if [ -e "$explorer_service_config" ]; then - # if systemctl is-active --quiet ${explorerName2}; then - # echo "${productName2} ${explorerName2} is running, stopping it..." - # ${csudo}systemctl stop ${explorerName2} &>/dev/null || echo &>/dev/null - # fi - # ${csudo}systemctl disable ${explorerName2} &>/dev/null || echo &>/dev/null - # ${csudo}rm -f ${explorer_service_config} - # ${csudo}rm -f /etc/${clientName2}/explorer.toml - # fi + explorer_service_config="${service_config_dir}/${explorerName2}.service" + if [ -e "$explorer_service_config" ]; then + if systemctl is-active --quiet ${explorerName2}; then + echo "${productName2} ${explorerName2} is running, stopping it..." + ${csudo}systemctl stop ${explorerName2} &>/dev/null || echo &>/dev/null + fi + ${csudo}systemctl disable ${explorerName2} &>/dev/null || echo &>/dev/null + ${csudo}rm -f ${explorer_service_config} + ${csudo}rm -f /etc/${clientName2}/explorer.toml + fi + fi } function clean_service_on_sysvinit() {