From 528f3c83df85bd5c1a932daf077bc388d5d12f29 Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Thu, 19 Oct 2023 16:59:45 +0800 Subject: [PATCH] TD-26786: update script --- packaging/tools/install.sh | 31 +++++++++++++++---------------- packaging/tools/remove.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 16 deletions(-) diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 449f6f6cdb..f731e8c280 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -154,7 +154,7 @@ interactiveFqdn=yes # [yes | no] verType=server # [server | client] initType=systemd # [systemd | service | ...] -while getopts "hv:e:i:" arg; do +while getopts "hv:e:" arg; do case $arg in e) #echo "interactiveFqdn=$OPTARG" @@ -164,10 +164,6 @@ while getopts "hv:e:i:" arg; do #echo "verType=$OPTARG" verType=$(echo $OPTARG) ;; - i) - #echo "initType=$OPTARG" - initType=$(echo $OPTARG) - ;; h) echo "Usage: $(basename $0) -v [server | client] -e [yes | no]" exit 0 @@ -385,7 +381,10 @@ function set_hostname() { echo -e -n "${GREEN}Enter the public accessible IP address or fully qualified domain name TDengine will expose to users or applications (must not be 'localhost') :${NC}" read newHostname while true; do - if [[ ! -z "$newHostname" && "$newHostname" != "localhost" ]]; then + if [ -z "$newHostname" ]; then + newHostname=$(hostname) + break + elif [ "$newHostname" != "localhost" ]; then break else echo -e -n "${GREEN}Enter the public accessible IP address or fully qualified domain name TDengine will expose to users or applications (must not be 'localhost') :${NC}" @@ -518,9 +517,7 @@ function install_adapter_config() { } -function install_config() { - - local_fqdn_check +function install_config() { if [ ! -f "${cfg_install_dir}/${configFile2}" ]; then ${csudo}mkdir -p ${cfg_install_dir} @@ -542,13 +539,15 @@ function install_config() { - # if ((${update_flag} == 1)); then - # return 0 - # fi + if ((${update_flag} == 1)); then + return 0 + fi - # if [ "$interactiveFqdn" == "no" ]; then - # return 0 - # fi + if [ "$interactiveFqdn" == "no" ]; then + return 0 + fi + + local_fqdn_check echo echo -e -n "${GREEN}Enter FQDN:port (like h1.${emailName2}:6030) of an existing ${productName2} cluster node to join${NC}" @@ -1073,7 +1072,7 @@ function installProduct() { echo -e "\033[44;32;1mTo access ${productName2} : ${clientName2} -h $serverFqdn${NC}" if [ "$verMode" == "cluster" ];then echo -e "\033[44;32;1mTo access the management system : http://$serverFqdn:6060${NC}" - echo -e "\033[44;32;1mTo read the user manual : http://$serverFqdn:6060/docs${NC}" + echo -e "\033[44;32;1mTo read the user manual : http://$serverFqdn:6060/docs-en${NC}" fi echo else # Only install client diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index b83e8d74c9..5b5a7d7c30 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -63,6 +63,10 @@ service_config_dir="/etc/systemd/system" taos_service_name=${serverName2} taosadapter_service_name="${clientName2}adapter" tarbitrator_service_name="tarbitratord" + +config_dir="/etc/${clientName2}" + + csudo="" if command -v sudo >/dev/null; then csudo="sudo " @@ -264,6 +268,20 @@ function clean_service() { fi } +function remove_data_and_config() { + data_dir=`grep dataDir /etc/taos/taos.cfg | grep -v '#' | tail -n 1 | awk {'print $2'}` + if [ X"$data_dir" == X"" ]; then + data_dir="/var/lib/taos" + fi + log_dir=`grep logDir /etc/taos/taos.cfg | grep -v '#' | tail -n 1 | awk {'print $2'}` + if [ X"$log_dir" == X"" ]; then + log_dir="/var/lib/taos" + fi + ${csudo}rm -rf ${config_dir}/* + ${csudo}rm -rf ${data_dir}/* + ${csudo}rm -rf ${log_dir}/* +} + function uninstall_taosx() { if [ -f /usr/local/taosx/uninstall.sh ]; then cd /usr/local/taosx @@ -374,6 +392,14 @@ remove_taoskeeper() { } remove_taoskeeper +echo +echo "Do you want to remove all the data, log and configuration files? [y/n]" +read answer +if [ X$answer == X"y" ] || [ X$answer == X"Y" ]; then + remove_data_and_config +fi + + if [ "$verMode" == "cluster" ]; then uninstall_taosx fi