fix: update removal scripts to check for symbolic links before deletion

This commit is contained in:
chenhaoran 2025-03-18 17:12:12 +08:00
parent e7e65a059d
commit f830d09e7f
2 changed files with 5 additions and 5 deletions

View File

@ -162,9 +162,9 @@ remove_service_of() {
remove_tools_of() { remove_tools_of() {
_tool=$1 _tool=$1
kill_service_of ${_tool} 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 "${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() { remove_bin() {
@ -257,7 +257,7 @@ while getopts "e:h" opt; do
echo "Remove all the data, log, and configuration files." echo "Remove all the data, log, and configuration files."
elif [ "$OPTARG" == "no" ]; then elif [ "$OPTARG" == "no" ]; then
remove_flag="false" remove_flag="false"
echo "Do NOT remove the data, log, and configuration files." echo "Do not remove the data, log, and configuration files."
else else
echo "Invalid option for -e: $OPTARG" echo "Invalid option for -e: $OPTARG"
usage usage

View File

@ -57,7 +57,7 @@ function clean_bin() {
${csudo}rm -f ${bin_link_dir}/${dumpName2} || : ${csudo}rm -f ${bin_link_dir}/${dumpName2} || :
${csudo}rm -f ${bin_link_dir}/${uninstallScript2} || : ${csudo}rm -f ${bin_link_dir}/${uninstallScript2} || :
${csudo}rm -f ${bin_link_dir}/set_core || : ${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 if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then
${csudo}rm -f ${bin_link_dir}/${clientName2} || : ${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}/${benchmarkName2} || :
${csudo}rm -f ${bin_link_dir}/${dumpName2} || : ${csudo}rm -f ${bin_link_dir}/${dumpName2} || :
${csudo}rm -f ${bin_link_dir}/${uninstallScript2} || : ${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 fi
} }