fix: enhance removal logic to check for non-empty install directory before deletion (#32430)

This commit is contained in:
haoranchen 2025-08-01 15:10:19 +08:00 committed by GitHub
parent 462231f7f9
commit ee8e73fc93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -264,6 +264,8 @@ function remove_data_and_config() {
"${data_dir}/.udf"
"${data_dir}/.running"*
"${data_dir}/.taosudf"*
"${data_dir}/${PREFIX}x"*
"${data_dir}/explorer"*
)
batch_remove_paths_and_clean_dir "${data_dir}" "${data_remove_list[@]}"
fi
@ -361,7 +363,9 @@ if [ X$remove_flag == X"true" ]; then
remove_data_and_config
fi
${csudo}rm -rf ${install_main_dir} || :
if [ -d "${install_main_dir}" ] && [ -z "$(ls -A "${install_main_dir}")" ]; then
${csudo}rm -rf "${install_main_dir}" || :
fi
if [[ -e /etc/os-release ]]; then
osinfo=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
else