1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-24 09:00:06 +00:00

fix: skip Time Machine checks when not configured, close #510

Use a fast `defaults read` pre-check before spawning any tmutil
process. On machines without Time Machine configured the check
returns instantly, avoiding the spinner and the 2-3s tmutil timeout.

Affected locations:
- lib/clean/system.sh: clean_time_machine_failed_backups()
- lib/clean/system.sh: clean_local_snapshots()
- lib/clean/user.sh: local snapshot hint in system hints
This commit is contained in:
tw93
2026-02-28 09:35:08 +08:00
parent 922f5f1fc9
commit 5710679809
2 changed files with 12 additions and 5 deletions

View File

@@ -215,6 +215,11 @@ clean_time_machine_failed_backups() {
echo -e " ${GREEN}${ICON_SUCCESS}${NC} No incomplete backups found"
return 0
fi
# Fast pre-check: skip entirely if Time Machine is not configured (no tmutil needed)
if ! defaults read /Library/Preferences/com.apple.TimeMachine AutoBackup 2> /dev/null | grep -qE '^[01]$'; then
echo -e " ${GREEN}${ICON_SUCCESS}${NC} No incomplete backups found"
return 0
fi
start_section_spinner "Checking Time Machine configuration..."
local spinner_active=true
local tm_info
@@ -396,6 +401,10 @@ clean_local_snapshots() {
if ! command -v tmutil > /dev/null 2>&1; then
return 0
fi
# Fast pre-check: skip entirely if Time Machine is not configured (no tmutil needed)
if ! defaults read /Library/Preferences/com.apple.TimeMachine AutoBackup 2> /dev/null | grep -qE '^[01]$'; then
return 0
fi
start_section_spinner "Checking Time Machine status..."
local rc_running=0