mirror of
https://github.com/tw93/Mole.git
synced 2026-03-22 20:15:07 +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:
@@ -215,6 +215,11 @@ clean_time_machine_failed_backups() {
|
|||||||
echo -e " ${GREEN}${ICON_SUCCESS}${NC} No incomplete backups found"
|
echo -e " ${GREEN}${ICON_SUCCESS}${NC} No incomplete backups found"
|
||||||
return 0
|
return 0
|
||||||
fi
|
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..."
|
start_section_spinner "Checking Time Machine configuration..."
|
||||||
local spinner_active=true
|
local spinner_active=true
|
||||||
local tm_info
|
local tm_info
|
||||||
@@ -396,6 +401,10 @@ clean_local_snapshots() {
|
|||||||
if ! command -v tmutil > /dev/null 2>&1; then
|
if ! command -v tmutil > /dev/null 2>&1; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
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..."
|
start_section_spinner "Checking Time Machine status..."
|
||||||
local rc_running=0
|
local rc_running=0
|
||||||
|
|||||||
@@ -421,10 +421,7 @@ clean_support_app_data() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Clean old aerial wallpaper videos (can be large, safe to remove).
|
# Clean old aerial wallpaper videos (can be large, safe to remove).
|
||||||
local wallpaper_videos_dir="$HOME/Library/Application Support/com.apple.wallpaper/aerials/videos"
|
safe_clean ~/Library/Application\ Support/com.apple.wallpaper/aerials/videos/* "Aerial wallpaper videos"
|
||||||
if [[ -d "$wallpaper_videos_dir" && ! -L "$wallpaper_videos_dir" ]]; then
|
|
||||||
safe_find_delete "$wallpaper_videos_dir" "*" "$support_age_days" "f" || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Do not touch Messages attachments, only preview/sticker caches.
|
# Do not touch Messages attachments, only preview/sticker caches.
|
||||||
if pgrep -x "Messages" > /dev/null 2>&1; then
|
if pgrep -x "Messages" > /dev/null 2>&1; then
|
||||||
@@ -1034,7 +1031,8 @@ check_large_file_candidates() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${SYSTEM_CLEAN:-false}" != "true" ]] && command -v tmutil > /dev/null 2>&1; then
|
if [[ "${SYSTEM_CLEAN:-false}" != "true" ]] && command -v tmutil > /dev/null 2>&1 \
|
||||||
|
&& defaults read /Library/Preferences/com.apple.TimeMachine AutoBackup 2> /dev/null | grep -qE '^[01]$'; then
|
||||||
local snapshot_list snapshot_count
|
local snapshot_list snapshot_count
|
||||||
snapshot_list=$(run_with_timeout 3 tmutil listlocalsnapshots / 2> /dev/null || true)
|
snapshot_list=$(run_with_timeout 3 tmutil listlocalsnapshots / 2> /dev/null || true)
|
||||||
if [[ -n "$snapshot_list" ]]; then
|
if [[ -n "$snapshot_list" ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user