1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 13:16:47 +00:00

refine sudo requirement checks for uninstallation.

This commit is contained in:
Tw93
2025-12-17 10:37:03 +08:00
parent b843cde0fd
commit be1027f9c3
5 changed files with 206 additions and 23 deletions

View File

@@ -130,9 +130,10 @@ batch_uninstall_applications() {
running_apps+=("$app_name")
fi
# Check if app requires sudo to delete
# Check if app requires sudo to delete (either app bundle or system files)
local needs_sudo=false
if [[ ! -w "$(dirname "$app_path")" ]] || [[ "$(get_file_owner "$app_path")" == "root" ]]; then
sudo_apps+=("$app_name")
needs_sudo=true
fi
# Calculate size for summary (including system files)
@@ -150,6 +151,10 @@ batch_uninstall_applications() {
# Check if system files require sudo
# shellcheck disable=SC2128
if [[ -n "$system_files" ]]; then
needs_sudo=true
fi
if [[ "$needs_sudo" == "true" ]]; then
sudo_apps+=("$app_name")
fi