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

Fix unable to uninstall data-protected apps like Clash Party

Previously, apps matching DATA_PROTECTED_BUNDLES patterns (VPNs, dev tools, etc.)
could not be uninstalled because should_protect_path blocked their deletion.
Now use MOLE_UNINSTALL_MODE to distinguish between cleanup and explicit uninstall,
allowing users to remove these apps when they choose to while still protecting
their data during normal cleanup operations.

Also allow deletion of installer receipts in /private/var/db/receipts/.
This commit is contained in:
Tw93
2026-01-20 11:53:45 +08:00
parent 6d041a22e1
commit d044b2876e
3 changed files with 37 additions and 12 deletions

View File

@@ -169,8 +169,8 @@ remove_file_list() {
batch_uninstall_applications() {
local total_size_freed=0
# Trap to clean up spinner on interrupt
trap 'stop_inline_spinner 2>/dev/null; echo ""; return 130' INT TERM
# Trap to clean up spinner and uninstall mode on interrupt
trap 'stop_inline_spinner 2>/dev/null; unset MOLE_UNINSTALL_MODE; echo ""; return 130' INT TERM
# shellcheck disable=SC2154
if [[ ${#selected_apps[@]} -eq 0 ]]; then
@@ -360,6 +360,10 @@ batch_uninstall_applications() {
;;
esac
# Enable uninstall mode - allows deletion of data-protected apps (VPNs, dev tools, etc.)
# that user explicitly chose to uninstall. System-critical components remain protected.
export MOLE_UNINSTALL_MODE=1
# Request sudo if needed.
if [[ ${#sudo_apps[@]} -gt 0 ]]; then
if ! sudo -n true 2> /dev/null; then
@@ -635,6 +639,9 @@ batch_uninstall_applications() {
sudo_keepalive_pid=""
fi
# Disable uninstall mode
unset MOLE_UNINSTALL_MODE
# Invalidate cache if any apps were successfully uninstalled.
if [[ $success_count -gt 0 ]]; then
local cache_file="$HOME/.cache/mole/app_scan_cache"