From 89adf377248c51c16d888346370201e62cbfa661 Mon Sep 17 00:00:00 2001 From: Feng Chao Date: Tue, 18 Mar 2025 14:48:44 +0800 Subject: [PATCH 1/6] ci: remove if condition for invoking the test workflow --- .github/workflows/tdengine-test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/tdengine-test.yml b/.github/workflows/tdengine-test.yml index 9c7a35f8dc..436eedd0e2 100644 --- a/.github/workflows/tdengine-test.yml +++ b/.github/workflows/tdengine-test.yml @@ -44,7 +44,6 @@ env: jobs: run-tests-on-linux: uses: taosdata/.github/.github/workflows/run-tests-on-linux.yml@main - if: ${{ github.event_name == 'pull_request' }} with: tdinternal: false specified_source_branch: ${{ github.event_name == 'pull_request' && 'unavailable' || inputs.specified_source_branch }} @@ -53,7 +52,6 @@ jobs: run-tests-on-mac: uses: taosdata/.github/.github/workflows/run-tests-on-macos.yml@main - if: ${{ github.event_name == 'pull_request' }} with: tdinternal: false specified_source_branch: ${{ github.event_name == 'pull_request' && 'unavailable' || inputs.specified_source_branch }} @@ -62,7 +60,6 @@ jobs: run-tests-on-windows: uses: taosdata/.github/.github/workflows/run-tests-on-windows.yml@main - if: ${{ github.event_name == 'pull_request' }} with: tdinternal: false specified_source_branch: ${{ github.event_name == 'pull_request' && 'unavailable' || inputs.specified_source_branch }} From 8de0b9a31d2abfab71ec048f7c3f608610209235 Mon Sep 17 00:00:00 2001 From: WANG Xu Date: Tue, 18 Mar 2025 18:30:53 +0800 Subject: [PATCH 2/6] fix: tdengine test badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 42538519bc..5e768b36ea 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@

-[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/taosdata/tdengine/taosd-ci-build.yml)](https://github.com/taosdata/TDengine/actions/workflows/taosd-ci-build.yml) +[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/taosdata/tdengine/tdengine-test.yml)](https://github.com/taosdata/TDengine/actions/workflows/tdengine-test.yml) [![Coverage Status](https://coveralls.io/repos/github/taosdata/TDengine/badge.svg?branch=3.0)](https://coveralls.io/github/taosdata/TDengine?branch=3.0) [![GitHub commit activity](https://img.shields.io/github/commit-activity/m/taosdata/tdengine)](https://github.com/feici02/TDengine/commits/main/)
From 67b3e301636d86987791317e3d5991a53059a433 Mon Sep 17 00:00:00 2001 From: Linhe Huo Date: Tue, 18 Mar 2025 18:38:18 +0800 Subject: [PATCH 3/6] ci: fix ci error caused by taosws cargo update (#30251) Close [TD-33938](https://jira.taosdata.com:18080/browse/TD-33938) --- tools/CMakeLists.txt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 1ee2bc4ce6..110a644e90 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -19,8 +19,7 @@ IF(TD_WEBSOCKET) PATCH_COMMAND COMMAND git clean -f -d BUILD_COMMAND - COMMAND cargo update - COMMAND RUSTFLAGS=-Ctarget-feature=-crt-static cargo build --release -p taos-ws-sys --features rustls + COMMAND RUSTFLAGS=-Ctarget-feature=-crt-static cargo build --release --locked -p taos-ws-sys --features rustls INSTALL_COMMAND COMMAND cp target/release/${websocket_lib_file} ${CMAKE_BINARY_DIR}/build/lib COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/build/include @@ -38,8 +37,7 @@ IF(TD_WEBSOCKET) PATCH_COMMAND COMMAND git clean -f -d BUILD_COMMAND - COMMAND cargo update - COMMAND cargo build --release -p taos-ws-sys --features rustls + COMMAND cargo build --release --locked -p taos-ws-sys --features rustls INSTALL_COMMAND COMMAND cp target/release/taosws.dll ${CMAKE_BINARY_DIR}/build/lib COMMAND cp target/release/taosws.dll.lib ${CMAKE_BINARY_DIR}/build/lib/taosws.lib @@ -58,8 +56,7 @@ IF(TD_WEBSOCKET) PATCH_COMMAND COMMAND git clean -f -d BUILD_COMMAND - COMMAND cargo update - COMMAND cargo build --release -p taos-ws-sys --features rustls + COMMAND cargo build --release --locked -p taos-ws-sys --features rustls INSTALL_COMMAND COMMAND cp target/release/${websocket_lib_file} ${CMAKE_BINARY_DIR}/build/lib COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/build/include From c5478b15d3ccad93e048ecdaa2275d0b0a6527ab Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Mon, 17 Mar 2025 16:42:55 +0800 Subject: [PATCH 4/6] feat: add inspect tool to installation and removal scripts in packaging --- packaging/tools/install.sh | 71 ++++++++++++++++++++++++-------------- packaging/tools/remove.sh | 6 +++- 2 files changed, 50 insertions(+), 27 deletions(-) diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index a6fd69d16f..82c02e9066 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -37,6 +37,7 @@ demoName="${PREFIX}demo" xname="${PREFIX}x" explorerName="${PREFIX}-explorer" keeperName="${PREFIX}keeper" +inspect_name="${PREFIX}inspect" bin_link_dir="/usr/bin" lib_link_dir="/usr/lib" @@ -156,12 +157,13 @@ done #echo "verType=${verType} interactiveFqdn=${interactiveFqdn}" -tools=(${clientName} ${benchmarkName} ${dumpName} ${demoName} remove.sh udfd set_core.sh TDinsight.sh start_pre.sh start-all.sh stop-all.sh) +tools=(${clientName} ${benchmarkName} ${dumpName} ${demoName} ${inspect_name} remove.sh udfd set_core.sh TDinsight.sh start_pre.sh start-all.sh stop-all.sh) if [ "${verMode}" == "cluster" ]; then services=(${serverName} ${adapterName} ${xname} ${explorerName} ${keeperName}) elif [ "${verMode}" == "edge" ]; then if [ "${pagMode}" == "full" ]; then services=(${serverName} ${adapterName} ${keeperName} ${explorerName}) + tools=(${clientName} ${benchmarkName} ${dumpName} ${demoName} remove.sh taosudf set_core.sh TDinsight.sh start_pre.sh start-all.sh stop-all.sh) else services=(${serverName}) tools=(${clientName} ${benchmarkName} remove.sh start_pre.sh) @@ -225,6 +227,7 @@ function install_bin() { ${csudo}cp -r ${script_dir}/bin/${clientName} ${install_main_dir}/bin ${csudo}cp -r ${script_dir}/bin/${benchmarkName} ${install_main_dir}/bin ${csudo}cp -r ${script_dir}/bin/${dumpName} ${install_main_dir}/bin + ${csudo}cp -r ${script_dir}/bin/${inspect_name} ${install_main_dir}/bin ${csudo}cp -r ${script_dir}/bin/remove.sh ${install_main_dir}/bin else ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin @@ -521,14 +524,14 @@ function local_fqdn_check() { function install_taosx_config() { [ ! -z $1 ] && return 0 || : # only install client - fileName="${script_dir}/${xname}/etc/${PREFIX}/${xname}.toml" - if [ -f ${fileName} ]; then - ${csudo}sed -i -r "s/#*\s*(fqdn\s*=\s*).*/\1\"${serverFqdn}\"/" ${fileName} + file_name="${script_dir}/${xname}/etc/${PREFIX}/${xname}.toml" + if [ -f ${file_name} ]; then + ${csudo}sed -i -r "s/#*\s*(fqdn\s*=\s*).*/\1\"${serverFqdn}\"/" ${file_name} if [ -f "${configDir}/${xname}.toml" ]; then - ${csudo}cp ${fileName} ${configDir}/${xname}.toml.new + ${csudo}cp ${file_name} ${configDir}/${xname}.toml.new else - ${csudo}cp ${fileName} ${configDir}/${xname}.toml + ${csudo}cp ${file_name} ${configDir}/${xname}.toml fi fi } @@ -538,18 +541,18 @@ function install_explorer_config() { [ ! -z $1 ] && return 0 || : # only install client if [ "$verMode" == "cluster" ]; then - fileName="${script_dir}/${xname}/etc/${PREFIX}/explorer.toml" + file_name="${script_dir}/${xname}/etc/${PREFIX}/explorer.toml" else - fileName="${script_dir}/cfg/explorer.toml" + file_name="${script_dir}/cfg/explorer.toml" fi - if [ -f ${fileName} ]; then - ${csudo}sed -i "s/localhost/${serverFqdn}/g" ${fileName} + if [ -f ${file_name} ]; then + ${csudo}sed -i "s/localhost/${serverFqdn}/g" ${file_name} if [ -f "${configDir}/explorer.toml" ]; then - ${csudo}cp ${fileName} ${configDir}/explorer.toml.new + ${csudo}cp ${file_name} ${configDir}/explorer.toml.new else - ${csudo}cp ${fileName} ${configDir}/explorer.toml + ${csudo}cp ${file_name} ${configDir}/explorer.toml fi fi } @@ -557,14 +560,14 @@ function install_explorer_config() { function install_adapter_config() { [ ! -z $1 ] && return 0 || : # only install client - fileName="${script_dir}/cfg/${adapterName}.toml" - if [ -f ${fileName} ]; then - ${csudo}sed -i -r "s/localhost/${serverFqdn}/g" ${fileName} + file_name="${script_dir}/cfg/${adapterName}.toml" + if [ -f ${file_name} ]; then + ${csudo}sed -i -r "s/localhost/${serverFqdn}/g" ${file_name} if [ -f "${configDir}/${adapterName}.toml" ]; then - ${csudo}cp ${fileName} ${configDir}/${adapterName}.toml.new + ${csudo}cp ${file_name} ${configDir}/${adapterName}.toml.new else - ${csudo}cp ${fileName} ${configDir}/${adapterName}.toml + ${csudo}cp ${file_name} ${configDir}/${adapterName}.toml fi fi } @@ -572,21 +575,21 @@ function install_adapter_config() { function install_keeper_config() { [ ! -z $1 ] && return 0 || : # only install client - fileName="${script_dir}/cfg/${keeperName}.toml" - if [ -f ${fileName} ]; then - ${csudo}sed -i -r "s/127.0.0.1/${serverFqdn}/g" ${fileName} + file_name="${script_dir}/cfg/${keeperName}.toml" + if [ -f ${file_name} ]; then + ${csudo}sed -i -r "s/127.0.0.1/${serverFqdn}/g" ${file_name} if [ -f "${configDir}/${keeperName}.toml" ]; then - ${csudo}cp ${fileName} ${configDir}/${keeperName}.toml.new + ${csudo}cp ${file_name} ${configDir}/${keeperName}.toml.new else - ${csudo}cp ${fileName} ${configDir}/${keeperName}.toml + ${csudo}cp ${file_name} ${configDir}/${keeperName}.toml fi fi } function install_taosd_config() { - fileName="${script_dir}/cfg/${configFile}" - if [ -f ${fileName} ]; then + file_name="${script_dir}/cfg/${configFile}" + if [ -f ${file_name} ]; then ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$serverFqdn/" ${script_dir}/cfg/${configFile} ${csudo}echo "monitor 1" >>${script_dir}/cfg/${configFile} ${csudo}echo "monitorFQDN ${serverFqdn}" >>${script_dir}/cfg/${configFile} @@ -595,15 +598,27 @@ function install_taosd_config() { fi if [ -f "${configDir}/${configFile}" ]; then - ${csudo}cp ${fileName} ${configDir}/${configFile}.new + ${csudo}cp ${file_name} ${configDir}/${configFile}.new else - ${csudo}cp ${fileName} ${configDir}/${configFile} + ${csudo}cp ${file_name} ${configDir}/${configFile} fi fi ${csudo}ln -sf ${configDir}/${configFile} ${install_main_dir}/cfg } +function install_taosinspect_config() { + file_name="${script_dir}/cfg/inspect.cfg" + if [ -f ${file_name} ]; then + if [ -f "${configDir}/inspect.cfg" ]; then + ${csudo}cp ${file_name} ${configDir}/inspect.cfg.new + else + ${csudo}cp ${file_name} ${configDir}/inspect.cfg + fi + fi + + ${csudo}ln -sf ${configDir}/inspect.cfg ${install_main_dir}/cfg +} function install_config() { @@ -915,6 +930,10 @@ function updateProduct() { install_adapter_config install_taosx_config install_explorer_config + if [ "${verMode}" == "cluster" ]; then + install_taosinspect_config + fi + if [ "${verMode}" != "cloud" ]; then install_keeper_config fi diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index 43c2de4ba4..b40b94aa7b 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -44,6 +44,7 @@ dumpName="${PREFIX}dump" keeperName="${PREFIX}keeper" xName="${PREFIX}x" explorerName="${PREFIX}-explorer" +inspect_name="${PREFIX}inspect" tarbitratorName="tarbitratord" productName="TDengine" @@ -58,10 +59,13 @@ config_dir="/etc/${PREFIX}" if [ "${verMode}" == "cluster" ]; then services=(${PREFIX}"d" ${PREFIX}"adapter" ${PREFIX}"keeper") + tools=(${PREFIX} ${PREFIX}"Benchmark" ${PREFIX}"dump" ${PREFIX}"demo" ${PREFIX}"inspect" udfd set_core.sh TDinsight.sh $uninstallScript start-all.sh stop-all.sh) else + tools=(${PREFIX} ${PREFIX}"Benchmark" ${PREFIX}"dump" ${PREFIX}"demo" udfd set_core.sh TDinsight.sh $uninstallScript start-all.sh stop-all.sh) + services=(${PREFIX}"d" ${PREFIX}"adapter" ${PREFIX}"keeper" ${PREFIX}"-explorer") fi -tools=(${PREFIX} ${PREFIX}"Benchmark" ${PREFIX}"dump" ${PREFIX}"demo" udfd set_core.sh TDinsight.sh $uninstallScript start-all.sh stop-all.sh) + csudo="" if command -v sudo >/dev/null; then From 3c30345625719e7eace591b42beaf18bc1bcd401 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Mon, 17 Mar 2025 20:50:21 +0800 Subject: [PATCH 5/6] feat: add taosinspect configuration and cleanup for client installation --- packaging/tools/install.sh | 5 ++++ packaging/tools/install_client.sh | 38 ++++++++++++++++++++++++++----- packaging/tools/remove_client.sh | 7 +++++- 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 82c02e9066..39d1eb7c72 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -1026,6 +1026,11 @@ function installProduct() { install_adapter_config install_taosx_config install_explorer_config + + if [ "${verMode}" == "cluster" ]; then + install_taosinspect_config + fi + if [ "${verMode}" != "cloud" ]; then install_keeper_config fi diff --git a/packaging/tools/install_client.sh b/packaging/tools/install_client.sh index 9ba9529146..532838fd2b 100755 --- a/packaging/tools/install_client.sh +++ b/packaging/tools/install_client.sh @@ -32,6 +32,8 @@ benchmarkName2="${clientName2}Benchmark" dumpName2="${clientName2}dump" demoName2="${clientName2}demo" uninstallScript2="rm${clientName2}" +inspect_name="${clientName2}inspect" + if [ "$osType" != "Darwin" ]; then script_dir=$(dirname $(readlink -f "$0")) @@ -106,12 +108,15 @@ 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}/${inspect_name} || : 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}rm -f ${bin_link_dir}/${benchmarkName2} || : + ${csudo}rm -f ${bin_link_dir}/${dumpName2} || : ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/* @@ -119,6 +124,7 @@ function install_bin() { [ -x ${install_main_dir}/bin/${clientName2} ] && ${csudo}ln -s ${install_main_dir}/bin/${clientName2} ${bin_link_dir}/${clientName2} || : if [ "$osType" != "Darwin" ]; then [ -x ${install_main_dir}/bin/${demoName2} ] && ${csudo}ln -s ${install_main_dir}/bin/${demoName2} ${bin_link_dir}/${demoName2} || : + [ -x ${install_main_dir}/bin/${inspect_name} ] && ${csudo}ln -s ${install_main_dir}/bin/${inspect_name} ${bin_link_dir}/${inspect_name} || : 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 || : @@ -237,16 +243,34 @@ function install_jemalloc() { } function install_config() { - if [ ! -f ${cfg_install_dir}/${configFile} ]; then + file_name=${cfg_install_dir}/${configFile} + if [ -f ${file_name} ]; then + echo "The configuration file ${file_name} already exists" + ${csudo}cp ${file_name} ${cfg_install_dir}/${configFile}.new + else ${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}/* + ${csudo}ln -s ${cfg_install_dir}/${configFile} ${install_main_dir}/cfg 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 + } +function install_taosinspect_config() { + file_name="${script_dir}/cfg/inspect.cfg" + if [ -f ${file_name} ]; then + if [ -f "${cfg_install_dir}/inspect.cfg" ]; then + ${csudo}cp ${file_name} ${cfg_install_dir}/inspect.cfg.new + else + ${csudo}mkdir -p ${cfg_install_dir} + ${csudo}cp ${file_name} ${cfg_install_dir}/inspect.cfg + fi + ${csudo}ln -sf ${cfg_install_dir}/inspect.cfg ${install_main_dir}/cfg + fi + + +} function install_log() { ${csudo}rm -rf ${log_dir} || : @@ -293,6 +317,7 @@ function update_TDengine() { install_jemalloc if [ "$verMode" == "cluster" ]; then install_connector + install_taosinspect_config fi install_examples install_bin @@ -320,6 +345,7 @@ function install_TDengine() { install_jemalloc if [ "$verMode" == "cluster" ]; then install_connector + install_taosinspect_config fi install_examples install_bin diff --git a/packaging/tools/remove_client.sh b/packaging/tools/remove_client.sh index 1d2965f66b..33454d7512 100755 --- a/packaging/tools/remove_client.sh +++ b/packaging/tools/remove_client.sh @@ -7,6 +7,7 @@ set -e RED='\033[0;31m' GREEN='\033[1;32m' NC='\033[0m' +verMode=edge installDir="/usr/local/taos" clientName="taos" @@ -18,8 +19,10 @@ productName2="TDengine" benchmarkName2="${clientName2}Benchmark" demoName2="${clientName2}demo" dumpName2="${clientName2}dump" +inspect_name="${clientName2}inspect" uninstallScript2="rm${clientName2}" + installDir="/usr/local/${clientName2}" #install main path @@ -52,8 +55,9 @@ function clean_bin() { ${csudo}rm -f ${bin_link_dir}/${demoName2} || : ${csudo}rm -f ${bin_link_dir}/${benchmarkName2} || : ${csudo}rm -f ${bin_link_dir}/${dumpName2} || : - ${csudo}rm -f ${bin_link_dir}/${uninstallScript} || : + ${csudo}rm -f ${bin_link_dir}/${uninstallScript2} || : ${csudo}rm -f ${bin_link_dir}/set_core || : + [ -f ${bin_link_dir}/${inspect_name} ] && ${csudo}rm -f ${bin_link_dir}/${inspect_name} || : if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then ${csudo}rm -f ${bin_link_dir}/${clientName2} || : @@ -61,6 +65,7 @@ function clean_bin() { ${csudo}rm -f ${bin_link_dir}/${benchmarkName2} || : ${csudo}rm -f ${bin_link_dir}/${dumpName2} || : ${csudo}rm -f ${bin_link_dir}/${uninstallScript2} || : + [ -f ${bin_link_dir}/${inspect_name} ] && ${csudo}rm -f ${bin_link_dir}/${inspect_name} || : fi } From f4a1db9f6f900f046604a43009854d4d5eabf602 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Tue, 18 Mar 2025 18:59:49 +0800 Subject: [PATCH 6/6] enh: supports silent uninstallation of the tar package using the -e parameter --- packaging/tools/remove.sh | 63 +++++++++++++++++++++++++------- packaging/tools/remove_client.sh | 4 +- 2 files changed, 51 insertions(+), 16 deletions(-) diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index b40b94aa7b..a0a1c235c0 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -162,9 +162,9 @@ remove_service_of() { remove_tools_of() { _tool=$1 kill_service_of ${_tool} - [ -e "${bin_link_dir}/${_tool}" ] && ${csudo}rm -rf ${bin_link_dir}/${_tool} || : + [ -L "${bin_link_dir}/${_tool}" ] && ${csudo}rm -rf ${bin_link_dir}/${_tool} || : [ -e "${installDir}/bin/${_tool}" ] && ${csudo}rm -rf ${installDir}/bin/${_tool} || : - [ -e "${local_bin_link_dir}/${_tool}" ] && ${csudo}rm -rf ${local_bin_link_dir}/${_tool} || : + [ -L "${local_bin_link_dir}/${_tool}" ] && ${csudo}rm -rf ${local_bin_link_dir}/${_tool} || : } remove_bin() { @@ -236,21 +236,56 @@ function remove_data_and_config() { [ -d "${log_dir}" ] && ${csudo}rm -rf ${log_dir} } -echo -echo "Do you want to remove all the data, log and configuration files? [y/n]" -read answer -remove_flag=false -if [ X$answer == X"y" ] || [ X$answer == X"Y" ]; then - confirmMsg="I confirm that I would like to delete all data, log and configuration files" - echo "Please enter '${confirmMsg}' to continue" +function usage() { + echo -e "\nUsage: $(basename $0) [-e ]" + echo "-e: silent mode, specify whether to remove all the data, log and configuration files." + echo " yes: remove the data, log, and configuration files." + echo " no: don't remove the data, log, and configuration files." +} + +# main +interactive_remove="yes" +remove_flag="false" + +while getopts "e:h" opt; do + case $opt in + e) + interactive_remove="no" + + if [ "$OPTARG" == "yes" ]; then + remove_flag="true" + echo "Remove all the data, log, and configuration files." + elif [ "$OPTARG" == "no" ]; then + remove_flag="false" + echo "Do not remove the data, log, and configuration files." + else + echo "Invalid option for -e: $OPTARG" + usage + exit 1 + fi + ;; + h | *) + usage + exit 1 + ;; + esac +done + +if [ "$interactive_remove" == "yes" ]; then + echo -e "\nDo you want to remove all the data, log and configuration files? [y/n]" read answer - if [ X"$answer" == X"${confirmMsg}" ]; then - remove_flag=true - else - echo "answer doesn't match, skip this step" + if [ X$answer == X"y" ] || [ X$answer == X"Y" ]; then + confirmMsg="I confirm that I would like to delete all data, log and configuration files" + echo "Please enter '${confirmMsg}' to continue" + read answer + if [ X"$answer" == X"${confirmMsg}" ]; then + remove_flag="true" + else + echo "answer doesn't match, skip this step" + fi fi + echo fi -echo if [ -e ${install_main_dir}/uninstall_${PREFIX}x.sh ]; then if [ X$remove_flag == X"true" ]; then diff --git a/packaging/tools/remove_client.sh b/packaging/tools/remove_client.sh index 33454d7512..a7eb225704 100755 --- a/packaging/tools/remove_client.sh +++ b/packaging/tools/remove_client.sh @@ -57,7 +57,7 @@ function clean_bin() { ${csudo}rm -f ${bin_link_dir}/${dumpName2} || : ${csudo}rm -f ${bin_link_dir}/${uninstallScript2} || : ${csudo}rm -f ${bin_link_dir}/set_core || : - [ -f ${bin_link_dir}/${inspect_name} ] && ${csudo}rm -f ${bin_link_dir}/${inspect_name} || : + [ -L ${bin_link_dir}/${inspect_name} ] && ${csudo}rm -f ${bin_link_dir}/${inspect_name} || : if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then ${csudo}rm -f ${bin_link_dir}/${clientName2} || : @@ -65,7 +65,7 @@ function clean_bin() { ${csudo}rm -f ${bin_link_dir}/${benchmarkName2} || : ${csudo}rm -f ${bin_link_dir}/${dumpName2} || : ${csudo}rm -f ${bin_link_dir}/${uninstallScript2} || : - [ -f ${bin_link_dir}/${inspect_name} ] && ${csudo}rm -f ${bin_link_dir}/${inspect_name} || : + [ -L ${bin_link_dir}/${inspect_name} ] && ${csudo}rm -f ${bin_link_dir}/${inspect_name} || : fi }