mirror of
https://github.com/tw93/Mole.git
synced 2026-03-22 19:40:07 +00:00
refactor: Update shell arithmetic increment syntax from ((var++)) || true to var=$((var + 1)) across various scripts.
This commit is contained in:
@@ -33,7 +33,7 @@ clean_ds_store_tree() {
|
|||||||
local size
|
local size
|
||||||
size=$(get_file_size "$ds_file")
|
size=$(get_file_size "$ds_file")
|
||||||
total_bytes=$((total_bytes + size))
|
total_bytes=$((total_bytes + size))
|
||||||
((file_count++)) || true
|
file_count=$((file_count + 1))
|
||||||
if [[ "$DRY_RUN" != "true" ]]; then
|
if [[ "$DRY_RUN" != "true" ]]; then
|
||||||
rm -f "$ds_file" 2> /dev/null || true
|
rm -f "$ds_file" 2> /dev/null || true
|
||||||
fi
|
fi
|
||||||
@@ -53,9 +53,9 @@ clean_ds_store_tree() {
|
|||||||
echo -e " ${GREEN}${ICON_SUCCESS}${NC} $label${NC}, ${GREEN}$file_count files, $size_human${NC}"
|
echo -e " ${GREEN}${ICON_SUCCESS}${NC} $label${NC}, ${GREEN}$file_count files, $size_human${NC}"
|
||||||
fi
|
fi
|
||||||
local size_kb=$(((total_bytes + 1023) / 1024))
|
local size_kb=$(((total_bytes + 1023) / 1024))
|
||||||
((files_cleaned += file_count)) || true
|
files_cleaned=$((files_cleaned + file_count))
|
||||||
((total_size_cleaned += size_kb)) || true
|
total_size_cleaned=$((total_size_cleaned + size_kb))
|
||||||
((total_items++)) || true
|
total_items=$((total_items + 1))
|
||||||
note_activity
|
note_activity
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -113,12 +113,12 @@ scan_installed_apps() {
|
|||||||
local bundle_id=$(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "$plist_path" 2> /dev/null || echo "")
|
local bundle_id=$(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "$plist_path" 2> /dev/null || echo "")
|
||||||
if [[ -n "$bundle_id" ]]; then
|
if [[ -n "$bundle_id" ]]; then
|
||||||
echo "$bundle_id"
|
echo "$bundle_id"
|
||||||
((count++)) || true
|
count=$((count + 1))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
) > "$scan_tmp_dir/apps_${dir_idx}.txt" &
|
) > "$scan_tmp_dir/apps_${dir_idx}.txt" &
|
||||||
pids+=($!)
|
pids+=($!)
|
||||||
((dir_idx++)) || true
|
dir_idx=$((dir_idx + 1))
|
||||||
done
|
done
|
||||||
# Collect running apps and LaunchAgents to avoid false orphan cleanup.
|
# Collect running apps and LaunchAgents to avoid false orphan cleanup.
|
||||||
(
|
(
|
||||||
@@ -300,7 +300,7 @@ clean_orphaned_app_data() {
|
|||||||
fi
|
fi
|
||||||
for match in "${matches[@]}"; do
|
for match in "${matches[@]}"; do
|
||||||
[[ -e "$match" ]] || continue
|
[[ -e "$match" ]] || continue
|
||||||
((iteration_count++)) || true
|
iteration_count=$((iteration_count + 1))
|
||||||
if [[ $iteration_count -gt $MOLE_MAX_ORPHAN_ITERATIONS ]]; then
|
if [[ $iteration_count -gt $MOLE_MAX_ORPHAN_ITERATIONS ]]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
@@ -314,8 +314,8 @@ clean_orphaned_app_data() {
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
if safe_clean "$match" "Orphaned $label: $bundle_id"; then
|
if safe_clean "$match" "Orphaned $label: $bundle_id"; then
|
||||||
((orphaned_count++)) || true
|
orphaned_count=$((orphaned_count + 1))
|
||||||
((total_orphaned_kb += size_kb)) || true
|
total_orphaned_kb=$((total_orphaned_kb + size_kb))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -430,8 +430,8 @@ clean_orphaned_system_services() {
|
|||||||
orphaned_files+=("$plist")
|
orphaned_files+=("$plist")
|
||||||
local size_kb
|
local size_kb
|
||||||
size_kb=$(sudo du -skP "$plist" 2> /dev/null | awk '{print $1}' || echo "0")
|
size_kb=$(sudo du -skP "$plist" 2> /dev/null | awk '{print $1}' || echo "0")
|
||||||
((total_orphaned_kb += size_kb)) || true
|
total_orphaned_kb=$((total_orphaned_kb + size_kb))
|
||||||
((orphaned_count++)) || true
|
orphaned_count=$((orphaned_count + 1))
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -461,8 +461,8 @@ clean_orphaned_system_services() {
|
|||||||
orphaned_files+=("$plist")
|
orphaned_files+=("$plist")
|
||||||
local size_kb
|
local size_kb
|
||||||
size_kb=$(sudo du -skP "$plist" 2> /dev/null | awk '{print $1}' || echo "0")
|
size_kb=$(sudo du -skP "$plist" 2> /dev/null | awk '{print $1}' || echo "0")
|
||||||
((total_orphaned_kb += size_kb)) || true
|
total_orphaned_kb=$((total_orphaned_kb + size_kb))
|
||||||
((orphaned_count++)) || true
|
orphaned_count=$((orphaned_count + 1))
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -491,8 +491,8 @@ clean_orphaned_system_services() {
|
|||||||
orphaned_files+=("$helper")
|
orphaned_files+=("$helper")
|
||||||
local size_kb
|
local size_kb
|
||||||
size_kb=$(sudo du -skP "$helper" 2> /dev/null | awk '{print $1}' || echo "0")
|
size_kb=$(sudo du -skP "$helper" 2> /dev/null | awk '{print $1}' || echo "0")
|
||||||
((total_orphaned_kb += size_kb)) || true
|
total_orphaned_kb=$((total_orphaned_kb + size_kb))
|
||||||
((orphaned_count++)) || true
|
orphaned_count=$((orphaned_count + 1))
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -673,7 +673,7 @@ clean_orphaned_launch_agents() {
|
|||||||
if is_launch_item_orphaned "$plist"; then
|
if is_launch_item_orphaned "$plist"; then
|
||||||
local size_kb=$(get_path_size_kb "$plist")
|
local size_kb=$(get_path_size_kb "$plist")
|
||||||
orphaned_items+=("$bundle_id|$plist")
|
orphaned_items+=("$bundle_id|$plist")
|
||||||
((total_orphaned_kb += size_kb)) || true
|
total_orphaned_kb=$((total_orphaned_kb + size_kb))
|
||||||
fi
|
fi
|
||||||
done < <(find "$launch_agents_dir" -maxdepth 1 -name "*.plist" -print0 2> /dev/null)
|
done < <(find "$launch_agents_dir" -maxdepth 1 -name "*.plist" -print0 2> /dev/null)
|
||||||
|
|
||||||
@@ -696,7 +696,7 @@ clean_orphaned_launch_agents() {
|
|||||||
IFS='|' read -r bundle_id plist_path <<< "$item"
|
IFS='|' read -r bundle_id plist_path <<< "$item"
|
||||||
|
|
||||||
if [[ "$is_dry_run" == "true" ]]; then
|
if [[ "$is_dry_run" == "true" ]]; then
|
||||||
((dry_run_count++)) || true
|
dry_run_count=$((dry_run_count + 1))
|
||||||
log_operation "clean" "DRY_RUN" "$plist_path" "orphaned launch agent"
|
log_operation "clean" "DRY_RUN" "$plist_path" "orphaned launch agent"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@@ -706,7 +706,7 @@ clean_orphaned_launch_agents() {
|
|||||||
|
|
||||||
# Remove the plist file
|
# Remove the plist file
|
||||||
if safe_remove "$plist_path" false; then
|
if safe_remove "$plist_path" false; then
|
||||||
((removed_count++)) || true
|
removed_count=$((removed_count + 1))
|
||||||
log_operation "clean" "REMOVED" "$plist_path" "orphaned launch agent"
|
log_operation "clean" "REMOVED" "$plist_path" "orphaned launch agent"
|
||||||
else
|
else
|
||||||
log_operation "clean" "FAILED" "$plist_path" "permission denied"
|
log_operation "clean" "FAILED" "$plist_path" "permission denied"
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ clean_project_caches() {
|
|||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
((grace_period++)) || true
|
grace_period=$((grace_period + 1))
|
||||||
done
|
done
|
||||||
if kill -0 "$pid" 2> /dev/null; then
|
if kill -0 "$pid" 2> /dev/null; then
|
||||||
kill -KILL "$pid" 2> /dev/null || true
|
kill -KILL "$pid" 2> /dev/null || true
|
||||||
|
|||||||
@@ -259,11 +259,11 @@ clean_xcode_documentation_cache() {
|
|||||||
local entry
|
local entry
|
||||||
for entry in "${sorted_entries[@]}"; do
|
for entry in "${sorted_entries[@]}"; do
|
||||||
if [[ $idx -eq 0 ]]; then
|
if [[ $idx -eq 0 ]]; then
|
||||||
((idx++)) || true
|
idx=$((idx + 1))
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
stale_entries+=("$entry")
|
stale_entries+=("$entry")
|
||||||
((idx++)) || true
|
idx=$((idx + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ ${#stale_entries[@]} -eq 0 ]]; then
|
if [[ ${#stale_entries[@]} -eq 0 ]]; then
|
||||||
@@ -729,12 +729,12 @@ clean_dev_jetbrains_toolbox() {
|
|||||||
local dir_path
|
local dir_path
|
||||||
for dir_path in "${sorted_dirs[@]}"; do
|
for dir_path in "${sorted_dirs[@]}"; do
|
||||||
if [[ $idx -lt $keep_previous ]]; then
|
if [[ $idx -lt $keep_previous ]]; then
|
||||||
((idx++)) || true
|
idx=$((idx + 1))
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
safe_clean "$dir_path" "JetBrains Toolbox old IDE version"
|
safe_clean "$dir_path" "JetBrains Toolbox old IDE version"
|
||||||
note_activity
|
note_activity
|
||||||
((idx++)) || true
|
idx=$((idx + 1))
|
||||||
done
|
done
|
||||||
done < <(command find "$product_dir" -mindepth 1 -maxdepth 1 -type d -name "ch-*" -print0 2> /dev/null)
|
done < <(command find "$product_dir" -mindepth 1 -maxdepth 1 -type d -name "ch-*" -print0 2> /dev/null)
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ hint_get_path_size_kb_with_timeout() {
|
|||||||
record_project_artifact_hint() {
|
record_project_artifact_hint() {
|
||||||
local path="$1"
|
local path="$1"
|
||||||
|
|
||||||
((PROJECT_ARTIFACT_HINT_COUNT++)) || true
|
PROJECT_ARTIFACT_HINT_COUNT=$((PROJECT_ARTIFACT_HINT_COUNT + 1))
|
||||||
|
|
||||||
if [[ ${#PROJECT_ARTIFACT_HINT_EXAMPLES[@]} -lt 2 ]]; then
|
if [[ ${#PROJECT_ARTIFACT_HINT_EXAMPLES[@]} -lt 2 ]]; then
|
||||||
PROJECT_ARTIFACT_HINT_EXAMPLES+=("${path/#$HOME/~}")
|
PROJECT_ARTIFACT_HINT_EXAMPLES+=("${path/#$HOME/~}")
|
||||||
@@ -74,8 +74,8 @@ record_project_artifact_hint() {
|
|||||||
local size_kb=""
|
local size_kb=""
|
||||||
if size_kb=$(hint_get_path_size_kb_with_timeout "$path" "$timeout_seconds"); then
|
if size_kb=$(hint_get_path_size_kb_with_timeout "$path" "$timeout_seconds"); then
|
||||||
if [[ "$size_kb" =~ ^[0-9]+$ ]]; then
|
if [[ "$size_kb" =~ ^[0-9]+$ ]]; then
|
||||||
((PROJECT_ARTIFACT_HINT_ESTIMATED_KB += size_kb)) || true
|
PROJECT_ARTIFACT_HINT_ESTIMATED_KB=$((PROJECT_ARTIFACT_HINT_ESTIMATED_KB + size_kb))
|
||||||
((PROJECT_ARTIFACT_HINT_ESTIMATE_SAMPLES++)) || true
|
PROJECT_ARTIFACT_HINT_ESTIMATE_SAMPLES=$((PROJECT_ARTIFACT_HINT_ESTIMATE_SAMPLES + 1))
|
||||||
else
|
else
|
||||||
PROJECT_ARTIFACT_HINT_ESTIMATE_PARTIAL=true
|
PROJECT_ARTIFACT_HINT_ESTIMATE_PARTIAL=true
|
||||||
fi
|
fi
|
||||||
@@ -140,8 +140,8 @@ probe_project_artifact_hints() {
|
|||||||
local root_projects_scanned=0
|
local root_projects_scanned=0
|
||||||
|
|
||||||
if is_quick_purge_project_root "$root"; then
|
if is_quick_purge_project_root "$root"; then
|
||||||
((scanned_projects++)) || true
|
scanned_projects=$((scanned_projects + 1))
|
||||||
((root_projects_scanned++)) || true
|
root_projects_scanned=$((root_projects_scanned + 1))
|
||||||
if [[ $scanned_projects -gt $max_projects ]]; then
|
if [[ $scanned_projects -gt $max_projects ]]; then
|
||||||
PROJECT_ARTIFACT_HINT_TRUNCATED=true
|
PROJECT_ARTIFACT_HINT_TRUNCATED=true
|
||||||
stop_scan=true
|
stop_scan=true
|
||||||
@@ -175,8 +175,8 @@ probe_project_artifact_hints() {
|
|||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
((scanned_projects++)) || true
|
scanned_projects=$((scanned_projects + 1))
|
||||||
((root_projects_scanned++)) || true
|
root_projects_scanned=$((root_projects_scanned + 1))
|
||||||
if [[ $scanned_projects -gt $max_projects ]]; then
|
if [[ $scanned_projects -gt $max_projects ]]; then
|
||||||
PROJECT_ARTIFACT_HINT_TRUNCATED=true
|
PROJECT_ARTIFACT_HINT_TRUNCATED=true
|
||||||
stop_scan=true
|
stop_scan=true
|
||||||
@@ -206,7 +206,7 @@ probe_project_artifact_hints() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
((nested_count++)) || true
|
nested_count=$((nested_count + 1))
|
||||||
if [[ $nested_count -gt $max_nested_per_project ]]; then
|
if [[ $nested_count -gt $max_nested_per_project ]]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -640,7 +640,7 @@ select_purge_categories() {
|
|||||||
for ((i = 0; i < total_items; i++)); do
|
for ((i = 0; i < total_items; i++)); do
|
||||||
if [[ ${selected[i]} == true ]]; then
|
if [[ ${selected[i]} == true ]]; then
|
||||||
selected_size=$((selected_size + ${sizes[i]:-0}))
|
selected_size=$((selected_size + ${sizes[i]:-0}))
|
||||||
((selected_count++)) || true
|
selected_count=$((selected_count + 1))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -728,9 +728,9 @@ select_purge_categories() {
|
|||||||
local visible_count=$((total_items - top_index))
|
local visible_count=$((total_items - top_index))
|
||||||
[[ $visible_count -gt $items_per_page ]] && visible_count=$items_per_page
|
[[ $visible_count -gt $items_per_page ]] && visible_count=$items_per_page
|
||||||
if [[ $cursor_pos -lt $((visible_count - 1)) ]]; then
|
if [[ $cursor_pos -lt $((visible_count - 1)) ]]; then
|
||||||
((cursor_pos++)) || true
|
cursor_pos=$((cursor_pos + 1))
|
||||||
elif [[ $((top_index + visible_count)) -lt $total_items ]]; then
|
elif [[ $((top_index + visible_count)) -lt $total_items ]]; then
|
||||||
((top_index++)) || true
|
top_index=$((top_index + 1))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -1350,7 +1350,7 @@ clean_project_artifacts() {
|
|||||||
[[ "$selected_size_kb" =~ ^[0-9]+$ ]] || selected_size_kb=0
|
[[ "$selected_size_kb" =~ ^[0-9]+$ ]] || selected_size_kb=0
|
||||||
selected_total_kb=$((selected_total_kb + selected_size_kb))
|
selected_total_kb=$((selected_total_kb + selected_size_kb))
|
||||||
if [[ "${item_size_unknown_flags[idx]:-false}" == "true" ]]; then
|
if [[ "${item_size_unknown_flags[idx]:-false}" == "true" ]]; then
|
||||||
((selected_unknown_count++)) || true
|
selected_unknown_count=$((selected_unknown_count + 1))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -1391,7 +1391,7 @@ clean_project_artifacts() {
|
|||||||
if [[ ! -e "$item_path" ]]; then
|
if [[ ! -e "$item_path" ]]; then
|
||||||
local current_total=$(cat "$stats_dir/purge_stats" 2> /dev/null || echo "0")
|
local current_total=$(cat "$stats_dir/purge_stats" 2> /dev/null || echo "0")
|
||||||
echo "$((current_total + size_kb))" > "$stats_dir/purge_stats"
|
echo "$((current_total + size_kb))" > "$stats_dir/purge_stats"
|
||||||
((cleaned_count++)) || true
|
cleaned_count=$((cleaned_count + 1))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ -t 1 ]]; then
|
if [[ -t 1 ]]; then
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ clean_deep_system() {
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
if safe_sudo_remove "$item"; then
|
if safe_sudo_remove "$item"; then
|
||||||
((updates_cleaned++)) || true
|
updates_cleaned=$((updates_cleaned + 1))
|
||||||
fi
|
fi
|
||||||
done < <(find /Library/Updates -mindepth 1 -maxdepth 1 -print0 2> /dev/null || true)
|
done < <(find /Library/Updates -mindepth 1 -maxdepth 1 -print0 2> /dev/null || true)
|
||||||
stop_section_spinner
|
stop_section_spinner
|
||||||
@@ -143,7 +143,7 @@ clean_deep_system() {
|
|||||||
debug_log "Cleaning macOS installer: $app_name, $size_human, ${age_days} days old"
|
debug_log "Cleaning macOS installer: $app_name, $size_human, ${age_days} days old"
|
||||||
if safe_sudo_remove "$installer_app"; then
|
if safe_sudo_remove "$installer_app"; then
|
||||||
log_success "$app_name, $size_human"
|
log_success "$app_name, $size_human"
|
||||||
((installer_cleaned++)) || true
|
installer_cleaned=$((installer_cleaned + 1))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -153,7 +153,7 @@ clean_deep_system() {
|
|||||||
local code_sign_cleaned=0
|
local code_sign_cleaned=0
|
||||||
while IFS= read -r -d '' cache_dir; do
|
while IFS= read -r -d '' cache_dir; do
|
||||||
if safe_sudo_remove "$cache_dir"; then
|
if safe_sudo_remove "$cache_dir"; then
|
||||||
((code_sign_cleaned++)) || true
|
code_sign_cleaned=$((code_sign_cleaned + 1))
|
||||||
fi
|
fi
|
||||||
done < <(run_with_timeout 5 command find /private/var/folders -type d -name "*.code_sign_clone" -path "*/X/*" -print0 2> /dev/null || true)
|
done < <(run_with_timeout 5 command find /private/var/folders -type d -name "*.code_sign_clone" -path "*/X/*" -print0 2> /dev/null || true)
|
||||||
stop_section_spinner
|
stop_section_spinner
|
||||||
@@ -300,7 +300,7 @@ clean_time_machine_failed_backups() {
|
|||||||
size_human=$(bytes_to_human "$((size_kb * 1024))")
|
size_human=$(bytes_to_human "$((size_kb * 1024))")
|
||||||
if [[ "$DRY_RUN" == "true" ]]; then
|
if [[ "$DRY_RUN" == "true" ]]; then
|
||||||
echo -e " ${YELLOW}${ICON_DRY_RUN}${NC} Incomplete backup: $backup_name${NC}, ${YELLOW}$size_human dry${NC}"
|
echo -e " ${YELLOW}${ICON_DRY_RUN}${NC} Incomplete backup: $backup_name${NC}, ${YELLOW}$size_human dry${NC}"
|
||||||
((tm_cleaned++)) || true
|
tm_cleaned=$((tm_cleaned + 1))
|
||||||
note_activity
|
note_activity
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@@ -310,10 +310,10 @@ clean_time_machine_failed_backups() {
|
|||||||
fi
|
fi
|
||||||
if tmutil delete "$inprogress_file" 2> /dev/null; then
|
if tmutil delete "$inprogress_file" 2> /dev/null; then
|
||||||
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Incomplete backup: $backup_name${NC}, ${GREEN}$size_human${NC}"
|
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Incomplete backup: $backup_name${NC}, ${GREEN}$size_human${NC}"
|
||||||
((tm_cleaned++)) || true
|
tm_cleaned=$((tm_cleaned + 1))
|
||||||
((files_cleaned++)) || true
|
files_cleaned=$((files_cleaned + 1))
|
||||||
((total_size_cleaned += size_kb)) || true
|
total_size_cleaned=$((total_size_cleaned + size_kb))
|
||||||
((total_items++)) || true
|
total_items=$((total_items + 1))
|
||||||
note_activity
|
note_activity
|
||||||
else
|
else
|
||||||
echo -e " ${YELLOW}!${NC} Could not delete: $backup_name · try manually with sudo"
|
echo -e " ${YELLOW}!${NC} Could not delete: $backup_name · try manually with sudo"
|
||||||
@@ -352,7 +352,7 @@ clean_time_machine_failed_backups() {
|
|||||||
size_human=$(bytes_to_human "$((size_kb * 1024))")
|
size_human=$(bytes_to_human "$((size_kb * 1024))")
|
||||||
if [[ "$DRY_RUN" == "true" ]]; then
|
if [[ "$DRY_RUN" == "true" ]]; then
|
||||||
echo -e " ${YELLOW}${ICON_DRY_RUN}${NC} Incomplete APFS backup in $bundle_name: $backup_name${NC}, ${YELLOW}$size_human dry${NC}"
|
echo -e " ${YELLOW}${ICON_DRY_RUN}${NC} Incomplete APFS backup in $bundle_name: $backup_name${NC}, ${YELLOW}$size_human dry${NC}"
|
||||||
((tm_cleaned++)) || true
|
tm_cleaned=$((tm_cleaned + 1))
|
||||||
note_activity
|
note_activity
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@@ -361,10 +361,10 @@ clean_time_machine_failed_backups() {
|
|||||||
fi
|
fi
|
||||||
if tmutil delete "$inprogress_file" 2> /dev/null; then
|
if tmutil delete "$inprogress_file" 2> /dev/null; then
|
||||||
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Incomplete APFS backup in $bundle_name: $backup_name${NC}, ${GREEN}$size_human${NC}"
|
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Incomplete APFS backup in $bundle_name: $backup_name${NC}, ${GREEN}$size_human${NC}"
|
||||||
((tm_cleaned++)) || true
|
tm_cleaned=$((tm_cleaned + 1))
|
||||||
((files_cleaned++)) || true
|
files_cleaned=$((files_cleaned + 1))
|
||||||
((total_size_cleaned += size_kb)) || true
|
total_size_cleaned=$((total_size_cleaned + size_kb))
|
||||||
((total_items++)) || true
|
total_items=$((total_items + 1))
|
||||||
note_activity
|
note_activity
|
||||||
else
|
else
|
||||||
echo -e " ${YELLOW}!${NC} Could not delete from bundle: $backup_name"
|
echo -e " ${YELLOW}!${NC} Could not delete from bundle: $backup_name"
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ clean_user_essentials() {
|
|||||||
local cleaned_count=0
|
local cleaned_count=0
|
||||||
while IFS= read -r -d '' item; do
|
while IFS= read -r -d '' item; do
|
||||||
if safe_remove "$item" true; then
|
if safe_remove "$item" true; then
|
||||||
((cleaned_count++)) || true
|
cleaned_count=$((cleaned_count + 1))
|
||||||
fi
|
fi
|
||||||
done < <(command find "$HOME/.Trash" -mindepth 1 -maxdepth 1 -print0 2> /dev/null || true)
|
done < <(command find "$HOME/.Trash" -mindepth 1 -maxdepth 1 -print0 2> /dev/null || true)
|
||||||
if [[ $cleaned_count -gt 0 ]]; then
|
if [[ $cleaned_count -gt 0 ]]; then
|
||||||
@@ -100,8 +100,8 @@ _clean_mail_downloads() {
|
|||||||
local file_size_kb
|
local file_size_kb
|
||||||
file_size_kb=$(get_path_size_kb "$file_path")
|
file_size_kb=$(get_path_size_kb "$file_path")
|
||||||
if safe_remove "$file_path" true; then
|
if safe_remove "$file_path" true; then
|
||||||
((count++)) || true
|
count=$((count + 1))
|
||||||
((cleaned_kb += file_size_kb)) || true
|
cleaned_kb=$((cleaned_kb + file_size_kb))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done < <(command find "$target_path" -type f -mtime +"$mail_age_days" -print0 2> /dev/null || true)
|
done < <(command find "$target_path" -type f -mtime +"$mail_age_days" -print0 2> /dev/null || true)
|
||||||
@@ -171,7 +171,7 @@ clean_chrome_old_versions() {
|
|||||||
size_kb=$(get_path_size_kb "$dir" || echo 0)
|
size_kb=$(get_path_size_kb "$dir" || echo 0)
|
||||||
size_kb="${size_kb:-0}"
|
size_kb="${size_kb:-0}"
|
||||||
total_size=$((total_size + size_kb))
|
total_size=$((total_size + size_kb))
|
||||||
((cleaned_count++)) || true
|
cleaned_count=$((cleaned_count + 1))
|
||||||
cleaned_any=true
|
cleaned_any=true
|
||||||
if [[ "$DRY_RUN" != "true" ]]; then
|
if [[ "$DRY_RUN" != "true" ]]; then
|
||||||
if has_sudo_session; then
|
if has_sudo_session; then
|
||||||
@@ -191,9 +191,9 @@ clean_chrome_old_versions() {
|
|||||||
else
|
else
|
||||||
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Chrome old versions${NC}, ${GREEN}${cleaned_count} dirs, $size_human${NC}"
|
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Chrome old versions${NC}, ${GREEN}${cleaned_count} dirs, $size_human${NC}"
|
||||||
fi
|
fi
|
||||||
((files_cleaned += cleaned_count)) || true
|
files_cleaned=$((files_cleaned + cleaned_count))
|
||||||
((total_size_cleaned += total_size)) || true
|
total_size_cleaned=$((total_size_cleaned + total_size))
|
||||||
((total_items++)) || true
|
total_items=$((total_items + 1))
|
||||||
note_activity
|
note_activity
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -257,7 +257,7 @@ clean_edge_old_versions() {
|
|||||||
size_kb=$(get_path_size_kb "$dir" || echo 0)
|
size_kb=$(get_path_size_kb "$dir" || echo 0)
|
||||||
size_kb="${size_kb:-0}"
|
size_kb="${size_kb:-0}"
|
||||||
total_size=$((total_size + size_kb))
|
total_size=$((total_size + size_kb))
|
||||||
((cleaned_count++)) || true
|
cleaned_count=$((cleaned_count + 1))
|
||||||
cleaned_any=true
|
cleaned_any=true
|
||||||
if [[ "$DRY_RUN" != "true" ]]; then
|
if [[ "$DRY_RUN" != "true" ]]; then
|
||||||
if has_sudo_session; then
|
if has_sudo_session; then
|
||||||
@@ -277,9 +277,9 @@ clean_edge_old_versions() {
|
|||||||
else
|
else
|
||||||
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Edge old versions${NC}, ${GREEN}${cleaned_count} dirs, $size_human${NC}"
|
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Edge old versions${NC}, ${GREEN}${cleaned_count} dirs, $size_human${NC}"
|
||||||
fi
|
fi
|
||||||
((files_cleaned += cleaned_count)) || true
|
files_cleaned=$((files_cleaned + cleaned_count))
|
||||||
((total_size_cleaned += total_size)) || true
|
total_size_cleaned=$((total_size_cleaned + total_size))
|
||||||
((total_items++)) || true
|
total_items=$((total_items + 1))
|
||||||
note_activity
|
note_activity
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -324,7 +324,7 @@ clean_edge_updater_old_versions() {
|
|||||||
size_kb=$(get_path_size_kb "$dir" || echo 0)
|
size_kb=$(get_path_size_kb "$dir" || echo 0)
|
||||||
size_kb="${size_kb:-0}"
|
size_kb="${size_kb:-0}"
|
||||||
total_size=$((total_size + size_kb))
|
total_size=$((total_size + size_kb))
|
||||||
((cleaned_count++)) || true
|
cleaned_count=$((cleaned_count + 1))
|
||||||
cleaned_any=true
|
cleaned_any=true
|
||||||
if [[ "$DRY_RUN" != "true" ]]; then
|
if [[ "$DRY_RUN" != "true" ]]; then
|
||||||
safe_remove "$dir" true > /dev/null 2>&1 || true
|
safe_remove "$dir" true > /dev/null 2>&1 || true
|
||||||
@@ -339,9 +339,9 @@ clean_edge_updater_old_versions() {
|
|||||||
else
|
else
|
||||||
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Edge updater old versions${NC}, ${GREEN}${cleaned_count} dirs, $size_human${NC}"
|
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Edge updater old versions${NC}, ${GREEN}${cleaned_count} dirs, $size_human${NC}"
|
||||||
fi
|
fi
|
||||||
((files_cleaned += cleaned_count)) || true
|
files_cleaned=$((files_cleaned + cleaned_count))
|
||||||
((total_size_cleaned += total_size)) || true
|
total_size_cleaned=$((total_size_cleaned + total_size))
|
||||||
((total_items++)) || true
|
total_items=$((total_items + 1))
|
||||||
note_activity
|
note_activity
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -484,9 +484,9 @@ clean_app_caches() {
|
|||||||
else
|
else
|
||||||
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Sandboxed app caches${NC}, ${GREEN}$size_human${NC}"
|
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Sandboxed app caches${NC}, ${GREEN}$size_human${NC}"
|
||||||
fi
|
fi
|
||||||
((files_cleaned += cleaned_count)) || true
|
files_cleaned=$((files_cleaned + cleaned_count))
|
||||||
((total_size_cleaned += total_size)) || true
|
total_size_cleaned=$((total_size_cleaned + total_size))
|
||||||
((total_items++)) || true
|
total_items=$((total_items + 1))
|
||||||
note_activity
|
note_activity
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -513,9 +513,9 @@ process_container_cache() {
|
|||||||
if find "$cache_dir" -mindepth 1 -maxdepth 1 -print -quit 2> /dev/null | grep -q .; then
|
if find "$cache_dir" -mindepth 1 -maxdepth 1 -print -quit 2> /dev/null | grep -q .; then
|
||||||
local size
|
local size
|
||||||
size=$(get_path_size_kb "$cache_dir")
|
size=$(get_path_size_kb "$cache_dir")
|
||||||
((total_size += size)) || true
|
total_size=$((total_size + size))
|
||||||
found_any=true
|
found_any=true
|
||||||
((cleaned_count++)) || true
|
cleaned_count=$((cleaned_count + 1))
|
||||||
if [[ "$DRY_RUN" != "true" ]]; then
|
if [[ "$DRY_RUN" != "true" ]]; then
|
||||||
local item
|
local item
|
||||||
while IFS= read -r -d '' item; do
|
while IFS= read -r -d '' item; do
|
||||||
@@ -613,7 +613,7 @@ clean_group_container_caches() {
|
|||||||
item_size=$(get_path_size_kb "$item" 2> /dev/null) || item_size=0
|
item_size=$(get_path_size_kb "$item" 2> /dev/null) || item_size=0
|
||||||
[[ "$item_size" =~ ^[0-9]+$ ]] || item_size=0
|
[[ "$item_size" =~ ^[0-9]+$ ]] || item_size=0
|
||||||
candidate_changed=true
|
candidate_changed=true
|
||||||
((candidate_size_kb += item_size)) || true
|
candidate_size_kb=$((candidate_size_kb + item_size))
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
for item in "${items_to_clean[@]}"; do
|
for item in "${items_to_clean[@]}"; do
|
||||||
@@ -622,14 +622,14 @@ clean_group_container_caches() {
|
|||||||
[[ "$item_size" =~ ^[0-9]+$ ]] || item_size=0
|
[[ "$item_size" =~ ^[0-9]+$ ]] || item_size=0
|
||||||
if safe_remove "$item" true 2> /dev/null; then
|
if safe_remove "$item" true 2> /dev/null; then
|
||||||
candidate_changed=true
|
candidate_changed=true
|
||||||
((candidate_size_kb += item_size)) || true
|
candidate_size_kb=$((candidate_size_kb + item_size))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$candidate_changed" == "true" ]]; then
|
if [[ "$candidate_changed" == "true" ]]; then
|
||||||
((total_size += candidate_size_kb)) || true
|
total_size=$((total_size + candidate_size_kb))
|
||||||
((cleaned_count++)) || true
|
cleaned_count=$((cleaned_count + 1))
|
||||||
found_any=true
|
found_any=true
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -645,9 +645,9 @@ clean_group_container_caches() {
|
|||||||
else
|
else
|
||||||
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Group Containers logs/caches${NC}, ${GREEN}$size_human${NC}"
|
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Group Containers logs/caches${NC}, ${GREEN}$size_human${NC}"
|
||||||
fi
|
fi
|
||||||
((files_cleaned += cleaned_count)) || true
|
files_cleaned=$((files_cleaned + cleaned_count))
|
||||||
((total_size_cleaned += total_size)) || true
|
total_size_cleaned=$((total_size_cleaned + total_size))
|
||||||
((total_items++)) || true
|
total_items=$((total_items + 1))
|
||||||
note_activity
|
note_activity
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -808,7 +808,7 @@ clean_application_support_logs() {
|
|||||||
[[ -d "$app_dir" ]] || continue
|
[[ -d "$app_dir" ]] || continue
|
||||||
local app_name
|
local app_name
|
||||||
app_name=$(basename "$app_dir")
|
app_name=$(basename "$app_dir")
|
||||||
((app_count++)) || true
|
app_count=$((app_count + 1))
|
||||||
update_progress_if_needed "$app_count" "$total_apps" last_progress_update 1 || true
|
update_progress_if_needed "$app_count" "$total_apps" last_progress_update 1 || true
|
||||||
local app_name_lower
|
local app_name_lower
|
||||||
app_name_lower=$(echo "$app_name" | LC_ALL=C tr '[:upper:]' '[:lower:]')
|
app_name_lower=$(echo "$app_name" | LC_ALL=C tr '[:upper:]' '[:lower:]')
|
||||||
@@ -834,12 +834,12 @@ clean_application_support_logs() {
|
|||||||
while IFS= read -r -d '' item; do
|
while IFS= read -r -d '' item; do
|
||||||
[[ -e "$item" ]] || continue
|
[[ -e "$item" ]] || continue
|
||||||
item_found=true
|
item_found=true
|
||||||
((candidate_item_count++)) || true
|
candidate_item_count=$((candidate_item_count + 1))
|
||||||
if [[ ! -L "$item" && (-f "$item" || -d "$item") ]]; then
|
if [[ ! -L "$item" && (-f "$item" || -d "$item") ]]; then
|
||||||
local item_size_bytes=""
|
local item_size_bytes=""
|
||||||
if item_size_bytes=$(app_support_item_size_bytes "$item" "$size_timeout_seconds"); then
|
if item_size_bytes=$(app_support_item_size_bytes "$item" "$size_timeout_seconds"); then
|
||||||
if [[ "$item_size_bytes" =~ ^[0-9]+$ ]]; then
|
if [[ "$item_size_bytes" =~ ^[0-9]+$ ]]; then
|
||||||
((candidate_size_bytes += item_size_bytes)) || true
|
candidate_size_bytes=$((candidate_size_bytes + item_size_bytes))
|
||||||
else
|
else
|
||||||
candidate_size_partial=true
|
candidate_size_partial=true
|
||||||
fi
|
fi
|
||||||
@@ -865,9 +865,9 @@ clean_application_support_logs() {
|
|||||||
fi
|
fi
|
||||||
done < <(command find "$candidate" -mindepth 1 -maxdepth 1 -print0 2> /dev/null || true)
|
done < <(command find "$candidate" -mindepth 1 -maxdepth 1 -print0 2> /dev/null || true)
|
||||||
if [[ "$item_found" == "true" ]]; then
|
if [[ "$item_found" == "true" ]]; then
|
||||||
((total_size_bytes += candidate_size_bytes)) || true
|
total_size_bytes=$((total_size_bytes + candidate_size_bytes))
|
||||||
[[ "$candidate_size_partial" == "true" ]] && total_size_partial=true
|
[[ "$candidate_size_partial" == "true" ]] && total_size_partial=true
|
||||||
((cleaned_count++)) || true
|
cleaned_count=$((cleaned_count + 1))
|
||||||
found_any=true
|
found_any=true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -889,12 +889,12 @@ clean_application_support_logs() {
|
|||||||
while IFS= read -r -d '' item; do
|
while IFS= read -r -d '' item; do
|
||||||
[[ -e "$item" ]] || continue
|
[[ -e "$item" ]] || continue
|
||||||
item_found=true
|
item_found=true
|
||||||
((candidate_item_count++)) || true
|
candidate_item_count=$((candidate_item_count + 1))
|
||||||
if [[ ! -L "$item" && (-f "$item" || -d "$item") ]]; then
|
if [[ ! -L "$item" && (-f "$item" || -d "$item") ]]; then
|
||||||
local item_size_bytes=""
|
local item_size_bytes=""
|
||||||
if item_size_bytes=$(app_support_item_size_bytes "$item" "$size_timeout_seconds"); then
|
if item_size_bytes=$(app_support_item_size_bytes "$item" "$size_timeout_seconds"); then
|
||||||
if [[ "$item_size_bytes" =~ ^[0-9]+$ ]]; then
|
if [[ "$item_size_bytes" =~ ^[0-9]+$ ]]; then
|
||||||
((candidate_size_bytes += item_size_bytes)) || true
|
candidate_size_bytes=$((candidate_size_bytes + item_size_bytes))
|
||||||
else
|
else
|
||||||
candidate_size_partial=true
|
candidate_size_partial=true
|
||||||
fi
|
fi
|
||||||
@@ -920,9 +920,9 @@ clean_application_support_logs() {
|
|||||||
fi
|
fi
|
||||||
done < <(command find "$candidate" -mindepth 1 -maxdepth 1 -print0 2> /dev/null || true)
|
done < <(command find "$candidate" -mindepth 1 -maxdepth 1 -print0 2> /dev/null || true)
|
||||||
if [[ "$item_found" == "true" ]]; then
|
if [[ "$item_found" == "true" ]]; then
|
||||||
((total_size_bytes += candidate_size_bytes)) || true
|
total_size_bytes=$((total_size_bytes + candidate_size_bytes))
|
||||||
[[ "$candidate_size_partial" == "true" ]] && total_size_partial=true
|
[[ "$candidate_size_partial" == "true" ]] && total_size_partial=true
|
||||||
((cleaned_count++)) || true
|
cleaned_count=$((cleaned_count + 1))
|
||||||
found_any=true
|
found_any=true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -951,9 +951,9 @@ clean_application_support_logs() {
|
|||||||
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Application Support logs/caches${NC}, ${GREEN}$size_human${NC}"
|
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Application Support logs/caches${NC}, ${GREEN}$size_human${NC}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
((files_cleaned += cleaned_count)) || true
|
files_cleaned=$((files_cleaned + cleaned_count))
|
||||||
((total_size_cleaned += total_size_kb)) || true
|
total_size_cleaned=$((total_size_cleaned + total_size_kb))
|
||||||
((total_items++)) || true
|
total_items=$((total_items + 1))
|
||||||
note_activity
|
note_activity
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -878,18 +878,18 @@ validate_terminal_environment() {
|
|||||||
# Check if TERM is set
|
# Check if TERM is set
|
||||||
if [[ -z "${TERM:-}" ]]; then
|
if [[ -z "${TERM:-}" ]]; then
|
||||||
log_warning "TERM environment variable not set"
|
log_warning "TERM environment variable not set"
|
||||||
((warnings++)) || true
|
warnings=$((warnings + 1))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if running in a known problematic terminal
|
# Check if running in a known problematic terminal
|
||||||
case "${TERM:-}" in
|
case "${TERM:-}" in
|
||||||
dumb)
|
dumb)
|
||||||
log_warning "Running in 'dumb' terminal, limited functionality"
|
log_warning "Running in 'dumb' terminal, limited functionality"
|
||||||
((warnings++)) || true
|
warnings=$((warnings + 1))
|
||||||
;;
|
;;
|
||||||
unknown)
|
unknown)
|
||||||
log_warning "Terminal type unknown, may have display issues"
|
log_warning "Terminal type unknown, may have display issues"
|
||||||
((warnings++)) || true
|
warnings=$((warnings + 1))
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -898,7 +898,7 @@ validate_terminal_environment() {
|
|||||||
local cols=$(tput cols 2> /dev/null || echo "80")
|
local cols=$(tput cols 2> /dev/null || echo "80")
|
||||||
if [[ "$cols" -lt 60 ]]; then
|
if [[ "$cols" -lt 60 ]]; then
|
||||||
log_warning "Terminal width, $cols cols, is narrow, output may wrap"
|
log_warning "Terminal width, $cols cols, is narrow, output may wrap"
|
||||||
((warnings++)) || true
|
warnings=$((warnings + 1))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ remove_apps_from_dock() {
|
|||||||
local url
|
local url
|
||||||
url=$(/usr/libexec/PlistBuddy -c "Print :persistent-apps:$i:tile-data:file-data:_CFURLString" "$plist" 2> /dev/null || echo "")
|
url=$(/usr/libexec/PlistBuddy -c "Print :persistent-apps:$i:tile-data:file-data:_CFURLString" "$plist" 2> /dev/null || echo "")
|
||||||
[[ -z "$url" ]] && {
|
[[ -z "$url" ]] && {
|
||||||
((i++)) || true
|
i=$((i + 1))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ remove_apps_from_dock() {
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
((i++)) || true
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -536,7 +536,7 @@ calculate_total_size() {
|
|||||||
if [[ -n "$file" && -e "$file" ]]; then
|
if [[ -n "$file" && -e "$file" ]]; then
|
||||||
local size_kb
|
local size_kb
|
||||||
size_kb=$(get_path_size_kb "$file")
|
size_kb=$(get_path_size_kb "$file")
|
||||||
((total_kb += size_kb)) || true
|
total_kb=$((total_kb + size_kb))
|
||||||
fi
|
fi
|
||||||
done <<< "$files"
|
done <<< "$files"
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ _request_password() {
|
|||||||
|
|
||||||
if [[ -z "$password" ]]; then
|
if [[ -z "$password" ]]; then
|
||||||
unset password
|
unset password
|
||||||
((attempts++)) || true
|
attempts=$((attempts + 1))
|
||||||
if [[ $attempts -lt 3 ]]; then
|
if [[ $attempts -lt 3 ]]; then
|
||||||
echo -e "${GRAY}${ICON_WARNING}${NC} Password cannot be empty" > "$tty_path"
|
echo -e "${GRAY}${ICON_WARNING}${NC} Password cannot be empty" > "$tty_path"
|
||||||
fi
|
fi
|
||||||
@@ -91,7 +91,7 @@ _request_password() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
unset password
|
unset password
|
||||||
((attempts++)) || true
|
attempts=$((attempts + 1))
|
||||||
if [[ $attempts -lt 3 ]]; then
|
if [[ $attempts -lt 3 ]]; then
|
||||||
echo -e "${GRAY}${ICON_WARNING}${NC} Incorrect password, try again" > "$tty_path"
|
echo -e "${GRAY}${ICON_WARNING}${NC} Incorrect password, try again" > "$tty_path"
|
||||||
fi
|
fi
|
||||||
@@ -166,7 +166,7 @@ request_sudo_access() {
|
|||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
((elapsed++)) || true
|
elapsed=$((elapsed + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
# Touch ID failed/cancelled - clean up thoroughly before password input
|
# Touch ID failed/cancelled - clean up thoroughly before password input
|
||||||
@@ -216,7 +216,7 @@ _start_sudo_keepalive() {
|
|||||||
local retry_count=0
|
local retry_count=0
|
||||||
while true; do
|
while true; do
|
||||||
if ! sudo -n -v 2> /dev/null; then
|
if ! sudo -n -v 2> /dev/null; then
|
||||||
((retry_count++)) || true
|
retry_count=$((retry_count + 1))
|
||||||
if [[ $retry_count -ge 3 ]]; then
|
if [[ $retry_count -ge 3 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -138,8 +138,8 @@ truncate_by_display_width() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
truncated+="$char"
|
truncated+="$char"
|
||||||
((width += char_width)) || true
|
width=$((width + char_width))
|
||||||
((i++)) || true
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
# Restore locale
|
# Restore locale
|
||||||
@@ -265,7 +265,7 @@ read_key() {
|
|||||||
drain_pending_input() {
|
drain_pending_input() {
|
||||||
local drained=0
|
local drained=0
|
||||||
while IFS= read -r -s -n 1 -t 0.01 _ 2> /dev/null; do
|
while IFS= read -r -s -n 1 -t 0.01 _ 2> /dev/null; do
|
||||||
((drained++)) || true
|
drained=$((drained + 1))
|
||||||
[[ $drained -gt 100 ]] && break
|
[[ $drained -gt 100 ]] && break
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@@ -341,7 +341,7 @@ start_inline_spinner() {
|
|||||||
local c="${chars:$((i % ${#chars})):1}"
|
local c="${chars:$((i % ${#chars})):1}"
|
||||||
# Output to stderr to avoid interfering with stdout
|
# Output to stderr to avoid interfering with stdout
|
||||||
printf "\r${MOLE_SPINNER_PREFIX:-}${BLUE}%s${NC} %s" "$c" "$display_message" >&2 || break
|
printf "\r${MOLE_SPINNER_PREFIX:-}${BLUE}%s${NC} %s" "$c" "$display_message" >&2 || break
|
||||||
((i++)) || true
|
i=$((i + 1))
|
||||||
sleep 0.05
|
sleep 0.05
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -367,7 +367,7 @@ stop_inline_spinner() {
|
|||||||
local wait_count=0
|
local wait_count=0
|
||||||
while kill -0 "$INLINE_SPINNER_PID" 2> /dev/null && [[ $wait_count -lt 5 ]]; do
|
while kill -0 "$INLINE_SPINNER_PID" 2> /dev/null && [[ $wait_count -lt 5 ]]; do
|
||||||
sleep 0.05 2> /dev/null || true
|
sleep 0.05 2> /dev/null || true
|
||||||
((wait_count++)) || true
|
wait_count=$((wait_count + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
# Only use SIGKILL as last resort if process is stuck
|
# Only use SIGKILL as last resort if process is stuck
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ perform_auto_fix() {
|
|||||||
echo -e "${BLUE}Enabling Firewall...${NC}"
|
echo -e "${BLUE}Enabling Firewall...${NC}"
|
||||||
if sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on > /dev/null 2>&1; then
|
if sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on > /dev/null 2>&1; then
|
||||||
echo -e "${GREEN}✓${NC} Firewall enabled"
|
echo -e "${GREEN}✓${NC} Firewall enabled"
|
||||||
((fixed_count++)) || true
|
fixed_count=$((fixed_count + 1))
|
||||||
fixed_items+=("Firewall enabled")
|
fixed_items+=("Firewall enabled")
|
||||||
else
|
else
|
||||||
echo -e "${RED}✗${NC} Failed to enable Firewall"
|
echo -e "${RED}✗${NC} Failed to enable Firewall"
|
||||||
@@ -154,7 +154,7 @@ perform_auto_fix() {
|
|||||||
auth sufficient pam_tid.so
|
auth sufficient pam_tid.so
|
||||||
' '$pam_file'" 2> /dev/null; then
|
' '$pam_file'" 2> /dev/null; then
|
||||||
echo -e "${GREEN}✓${NC} Touch ID configured"
|
echo -e "${GREEN}✓${NC} Touch ID configured"
|
||||||
((fixed_count++)) || true
|
fixed_count=$((fixed_count + 1))
|
||||||
fixed_items+=("Touch ID configured for sudo")
|
fixed_items+=("Touch ID configured for sudo")
|
||||||
else
|
else
|
||||||
echo -e "${RED}✗${NC} Failed to configure Touch ID"
|
echo -e "${RED}✗${NC} Failed to configure Touch ID"
|
||||||
@@ -167,7 +167,7 @@ auth sufficient pam_tid.so
|
|||||||
echo -e "${BLUE}Installing Rosetta 2...${NC}"
|
echo -e "${BLUE}Installing Rosetta 2...${NC}"
|
||||||
if sudo softwareupdate --install-rosetta --agree-to-license 2>&1 | grep -qE "(Installing|Installed|already installed)"; then
|
if sudo softwareupdate --install-rosetta --agree-to-license 2>&1 | grep -qE "(Installing|Installed|already installed)"; then
|
||||||
echo -e "${GREEN}✓${NC} Rosetta 2 installed"
|
echo -e "${GREEN}✓${NC} Rosetta 2 installed"
|
||||||
((fixed_count++)) || true
|
fixed_count=$((fixed_count + 1))
|
||||||
fixed_items+=("Rosetta 2 installed")
|
fixed_items+=("Rosetta 2 installed")
|
||||||
else
|
else
|
||||||
echo -e "${RED}✗${NC} Failed to install Rosetta 2"
|
echo -e "${RED}✗${NC} Failed to install Rosetta 2"
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ manage_purge_paths() {
|
|||||||
line="${line#"${line%%[![:space:]]*}"}"
|
line="${line#"${line%%[![:space:]]*}"}"
|
||||||
line="${line%"${line##*[![:space:]]}"}"
|
line="${line%"${line##*[![:space:]]}"}"
|
||||||
[[ -z "$line" || "$line" =~ ^# ]] && continue
|
[[ -z "$line" || "$line" =~ ^# ]] && continue
|
||||||
((custom_count++)) || true
|
custom_count=$((custom_count + 1))
|
||||||
done < "$PURGE_PATHS_CONFIG"
|
done < "$PURGE_PATHS_CONFIG"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ perform_updates() {
|
|||||||
if "$mole_bin" update 2>&1 | grep -qE "(Updated|latest version)"; then
|
if "$mole_bin" update 2>&1 | grep -qE "(Updated|latest version)"; then
|
||||||
echo -e "${GREEN}${ICON_SUCCESS}${NC} Mole updated"
|
echo -e "${GREEN}${ICON_SUCCESS}${NC} Mole updated"
|
||||||
reset_mole_cache
|
reset_mole_cache
|
||||||
((updated_count++)) || true
|
updated_count=$((updated_count + 1))
|
||||||
else
|
else
|
||||||
echo -e "${RED}✗${NC} Mole update failed"
|
echo -e "${RED}✗${NC} Mole update failed"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ ${GRAY}Edit: ${display_config}${NC}"
|
|||||||
cache_patterns+=("$pattern")
|
cache_patterns+=("$pattern")
|
||||||
menu_options+=("$display_name")
|
menu_options+=("$display_name")
|
||||||
|
|
||||||
((index++)) || true
|
index=$((index + 1))
|
||||||
done <<< "$items_source"
|
done <<< "$items_source"
|
||||||
|
|
||||||
# Identify custom patterns (not in predefined list)
|
# Identify custom patterns (not in predefined list)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ fix_broken_preferences() {
|
|||||||
plutil -lint "$plist_file" > /dev/null 2>&1 && continue
|
plutil -lint "$plist_file" > /dev/null 2>&1 && continue
|
||||||
|
|
||||||
safe_remove "$plist_file" true > /dev/null 2>&1 || true
|
safe_remove "$plist_file" true > /dev/null 2>&1 || true
|
||||||
((broken_count++)) || true
|
broken_count=$((broken_count + 1))
|
||||||
done < <(command find "$prefs_dir" -maxdepth 1 -name "*.plist" -type f 2> /dev/null || true)
|
done < <(command find "$prefs_dir" -maxdepth 1 -name "*.plist" -type f 2> /dev/null || true)
|
||||||
|
|
||||||
# Check ByHost preferences.
|
# Check ByHost preferences.
|
||||||
@@ -45,7 +45,7 @@ fix_broken_preferences() {
|
|||||||
plutil -lint "$plist_file" > /dev/null 2>&1 && continue
|
plutil -lint "$plist_file" > /dev/null 2>&1 && continue
|
||||||
|
|
||||||
safe_remove "$plist_file" true > /dev/null 2>&1 || true
|
safe_remove "$plist_file" true > /dev/null 2>&1 || true
|
||||||
((broken_count++)) || true
|
broken_count=$((broken_count + 1))
|
||||||
done < <(command find "$byhost_dir" -name "*.plist" -type f 2> /dev/null || true)
|
done < <(command find "$byhost_dir" -name "*.plist" -type f 2> /dev/null || true)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ opt_sqlite_vacuum() {
|
|||||||
local file_size
|
local file_size
|
||||||
file_size=$(get_file_size "$db_file")
|
file_size=$(get_file_size "$db_file")
|
||||||
if [[ "$file_size" -gt "$MOLE_SQLITE_MAX_SIZE" ]]; then
|
if [[ "$file_size" -gt "$MOLE_SQLITE_MAX_SIZE" ]]; then
|
||||||
((skipped++)) || true
|
skipped=$((skipped + 1))
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -327,7 +327,7 @@ opt_sqlite_vacuum() {
|
|||||||
freelist_count=$(echo "$page_info" | awk 'NR==2 {print $1}' 2> /dev/null || echo "")
|
freelist_count=$(echo "$page_info" | awk 'NR==2 {print $1}' 2> /dev/null || echo "")
|
||||||
if [[ "$page_count" =~ ^[0-9]+$ && "$freelist_count" =~ ^[0-9]+$ && "$page_count" -gt 0 ]]; then
|
if [[ "$page_count" =~ ^[0-9]+$ && "$freelist_count" =~ ^[0-9]+$ && "$page_count" -gt 0 ]]; then
|
||||||
if ((freelist_count * 100 < page_count * 5)); then
|
if ((freelist_count * 100 < page_count * 5)); then
|
||||||
((skipped++)) || true
|
skipped=$((skipped + 1))
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -341,7 +341,7 @@ opt_sqlite_vacuum() {
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [[ $integrity_status -ne 0 ]] || ! echo "$integrity_check" | grep -q "ok"; then
|
if [[ $integrity_status -ne 0 ]] || ! echo "$integrity_check" | grep -q "ok"; then
|
||||||
((skipped++)) || true
|
skipped=$((skipped + 1))
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -354,14 +354,14 @@ opt_sqlite_vacuum() {
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [[ $exit_code -eq 0 ]]; then
|
if [[ $exit_code -eq 0 ]]; then
|
||||||
((vacuumed++)) || true
|
vacuumed=$((vacuumed + 1))
|
||||||
elif [[ $exit_code -eq 124 ]]; then
|
elif [[ $exit_code -eq 124 ]]; then
|
||||||
((timed_out++)) || true
|
timed_out=$((timed_out + 1))
|
||||||
else
|
else
|
||||||
((failed++)) || true
|
failed=$((failed + 1))
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
((vacuumed++)) || true
|
vacuumed=$((vacuumed + 1))
|
||||||
fi
|
fi
|
||||||
done < <(compgen -G "$pattern" || true)
|
done < <(compgen -G "$pattern" || true)
|
||||||
done
|
done
|
||||||
@@ -730,7 +730,7 @@ opt_spotlight_index_optimize() {
|
|||||||
test_end=$(get_epoch_seconds)
|
test_end=$(get_epoch_seconds)
|
||||||
test_duration=$((test_end - test_start))
|
test_duration=$((test_end - test_start))
|
||||||
if [[ $test_duration -gt 3 ]]; then
|
if [[ $test_duration -gt 3 ]]; then
|
||||||
((slow_count++)) || true
|
slow_count=$((slow_count + 1))
|
||||||
fi
|
fi
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ select_apps_for_uninstall() {
|
|||||||
sizekb_csv+=",${size_kb:-0}"
|
sizekb_csv+=",${size_kb:-0}"
|
||||||
fi
|
fi
|
||||||
names_arr+=("$display_name")
|
names_arr+=("$display_name")
|
||||||
((idx++)) || true
|
idx=$((idx + 1))
|
||||||
done
|
done
|
||||||
# Use newline separator for names (safe for names with commas)
|
# Use newline separator for names (safe for names with commas)
|
||||||
local names_newline
|
local names_newline
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ paginated_multi_select() {
|
|||||||
# Only count if not already selected (handles duplicates)
|
# Only count if not already selected (handles duplicates)
|
||||||
if [[ ${selected[idx]} != true ]]; then
|
if [[ ${selected[idx]} != true ]]; then
|
||||||
selected[idx]=true
|
selected[idx]=true
|
||||||
((selected_count++)) || true
|
selected_count=$((selected_count + 1))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -654,7 +654,7 @@ paginated_multi_select() {
|
|||||||
|
|
||||||
if [[ $cursor_pos -lt $((visible_count - 1)) ]]; then
|
if [[ $cursor_pos -lt $((visible_count - 1)) ]]; then
|
||||||
local old_cursor=$cursor_pos
|
local old_cursor=$cursor_pos
|
||||||
((cursor_pos++)) || true
|
cursor_pos=$((cursor_pos + 1))
|
||||||
local new_cursor=$cursor_pos
|
local new_cursor=$cursor_pos
|
||||||
|
|
||||||
if [[ -n "$filter_text" || -n "${MOLE_READ_KEY_FORCE_CHAR:-}" ]]; then
|
if [[ -n "$filter_text" || -n "${MOLE_READ_KEY_FORCE_CHAR:-}" ]]; then
|
||||||
@@ -674,7 +674,7 @@ paginated_multi_select() {
|
|||||||
prev_cursor_pos=$cursor_pos
|
prev_cursor_pos=$cursor_pos
|
||||||
continue
|
continue
|
||||||
elif [[ $((top_index + visible_count)) -lt ${#view_indices[@]} ]]; then
|
elif [[ $((top_index + visible_count)) -lt ${#view_indices[@]} ]]; then
|
||||||
((top_index++)) || true
|
top_index=$((top_index + 1))
|
||||||
visible_count=$((${#view_indices[@]} - top_index))
|
visible_count=$((${#view_indices[@]} - top_index))
|
||||||
[[ $visible_count -gt $items_per_page ]] && visible_count=$items_per_page
|
[[ $visible_count -gt $items_per_page ]] && visible_count=$items_per_page
|
||||||
if [[ $cursor_pos -ge $visible_count ]]; then
|
if [[ $cursor_pos -ge $visible_count ]]; then
|
||||||
@@ -716,7 +716,7 @@ paginated_multi_select() {
|
|||||||
((selected_count--))
|
((selected_count--))
|
||||||
else
|
else
|
||||||
selected[real]=true
|
selected[real]=true
|
||||||
((selected_count++)) || true
|
selected_count=$((selected_count + 1))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Incremental update: only redraw header (for count) and current row
|
# Incremental update: only redraw header (for count) and current row
|
||||||
@@ -757,9 +757,9 @@ paginated_multi_select() {
|
|||||||
local visible_count=$((${#view_indices[@]} - top_index))
|
local visible_count=$((${#view_indices[@]} - top_index))
|
||||||
[[ $visible_count -gt $items_per_page ]] && visible_count=$items_per_page
|
[[ $visible_count -gt $items_per_page ]] && visible_count=$items_per_page
|
||||||
if [[ $cursor_pos -lt $((visible_count - 1)) ]]; then
|
if [[ $cursor_pos -lt $((visible_count - 1)) ]]; then
|
||||||
((cursor_pos++)) || true
|
cursor_pos=$((cursor_pos + 1))
|
||||||
elif [[ $((top_index + visible_count)) -lt ${#view_indices[@]} ]]; then
|
elif [[ $((top_index + visible_count)) -lt ${#view_indices[@]} ]]; then
|
||||||
((top_index++)) || true
|
top_index=$((top_index + 1))
|
||||||
fi
|
fi
|
||||||
need_full_redraw=true
|
need_full_redraw=true
|
||||||
fi
|
fi
|
||||||
@@ -843,7 +843,7 @@ paginated_multi_select() {
|
|||||||
if [[ $idx -lt ${#view_indices[@]} ]]; then
|
if [[ $idx -lt ${#view_indices[@]} ]]; then
|
||||||
local real="${view_indices[idx]}"
|
local real="${view_indices[idx]}"
|
||||||
selected[real]=true
|
selected[real]=true
|
||||||
((selected_count++)) || true
|
selected_count=$((selected_count + 1))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ paginated_multi_select() {
|
|||||||
# Count selections for header display
|
# Count selections for header display
|
||||||
local selected_count=0
|
local selected_count=0
|
||||||
for ((i = 0; i < total_items; i++)); do
|
for ((i = 0; i < total_items; i++)); do
|
||||||
[[ ${selected[i]} == true ]] && ((selected_count++)) || true
|
[[ ${selected[i]} == true ]] && selected_count=$((selected_count + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
# Header
|
# Header
|
||||||
@@ -247,9 +247,9 @@ paginated_multi_select() {
|
|||||||
[[ $visible_count -gt $items_per_page ]] && visible_count=$items_per_page
|
[[ $visible_count -gt $items_per_page ]] && visible_count=$items_per_page
|
||||||
|
|
||||||
if [[ $cursor_pos -lt $((visible_count - 1)) ]]; then
|
if [[ $cursor_pos -lt $((visible_count - 1)) ]]; then
|
||||||
((cursor_pos++)) || true
|
cursor_pos=$((cursor_pos + 1))
|
||||||
elif [[ $((top_index + visible_count)) -lt $total_items ]]; then
|
elif [[ $((top_index + visible_count)) -lt $total_items ]]; then
|
||||||
((top_index++)) || true
|
top_index=$((top_index + 1))
|
||||||
visible_count=$((total_items - top_index))
|
visible_count=$((total_items - top_index))
|
||||||
[[ $visible_count -gt $items_per_page ]] && visible_count=$items_per_page
|
[[ $visible_count -gt $items_per_page ]] && visible_count=$items_per_page
|
||||||
if [[ $cursor_pos -ge $visible_count ]]; then
|
if [[ $cursor_pos -ge $visible_count ]]; then
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ batch_uninstall_applications() {
|
|||||||
local system_size_kb=$(calculate_total_size "$system_files" || echo "0")
|
local system_size_kb=$(calculate_total_size "$system_files" || echo "0")
|
||||||
local diag_system_size_kb=$(calculate_total_size "$diag_system" || echo "0")
|
local diag_system_size_kb=$(calculate_total_size "$diag_system" || echo "0")
|
||||||
local total_kb=$((app_size_kb + related_size_kb + system_size_kb + diag_system_size_kb))
|
local total_kb=$((app_size_kb + related_size_kb + system_size_kb + diag_system_size_kb))
|
||||||
((total_estimated_size += total_kb)) || true
|
total_estimated_size=$((total_estimated_size + total_kb))
|
||||||
|
|
||||||
# shellcheck disable=SC2128
|
# shellcheck disable=SC2128
|
||||||
if [[ -n "$system_files" || -n "$diag_system" ]]; then
|
if [[ -n "$system_files" || -n "$diag_system" ]]; then
|
||||||
@@ -465,7 +465,7 @@ batch_uninstall_applications() {
|
|||||||
local -a success_items=()
|
local -a success_items=()
|
||||||
local current_index=0
|
local current_index=0
|
||||||
for detail in "${app_details[@]}"; do
|
for detail in "${app_details[@]}"; do
|
||||||
((current_index++)) || true
|
current_index=$((current_index + 1))
|
||||||
IFS='|' read -r app_name app_path bundle_id total_kb encoded_files encoded_system_files has_sensitive_data needs_sudo is_brew_cask cask_name encoded_diag_system <<< "$detail"
|
IFS='|' read -r app_name app_path bundle_id total_kb encoded_files encoded_system_files has_sensitive_data needs_sudo is_brew_cask cask_name encoded_diag_system <<< "$detail"
|
||||||
local related_files=$(decode_file_list "$encoded_files" "$app_name")
|
local related_files=$(decode_file_list "$encoded_files" "$app_name")
|
||||||
local system_files=$(decode_file_list "$encoded_system_files" "$app_name")
|
local system_files=$(decode_file_list "$encoded_system_files" "$app_name")
|
||||||
@@ -610,11 +610,11 @@ batch_uninstall_applications() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
((total_size_freed += total_kb)) || true
|
total_size_freed=$((total_size_freed + total_kb))
|
||||||
((success_count++)) || true
|
success_count=$((success_count + 1))
|
||||||
[[ "$used_brew_successfully" == "true" ]] && ((brew_apps_removed++)) || true
|
[[ "$used_brew_successfully" == "true" ]] && brew_apps_removed=$((brew_apps_removed + 1))
|
||||||
((files_cleaned++)) || true
|
files_cleaned=$((files_cleaned + 1))
|
||||||
((total_items++)) || true
|
total_items=$((total_items + 1))
|
||||||
success_items+=("$app_path")
|
success_items+=("$app_path")
|
||||||
else
|
else
|
||||||
if [[ -t 1 ]]; then
|
if [[ -t 1 ]]; then
|
||||||
@@ -628,7 +628,7 @@ batch_uninstall_applications() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
((failed_count++)) || true
|
failed_count=$((failed_count + 1))
|
||||||
failed_items+=("$app_name:$reason:${suggestion:-}")
|
failed_items+=("$app_name:$reason:${suggestion:-}")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -672,7 +672,7 @@ batch_uninstall_applications() {
|
|||||||
else
|
else
|
||||||
current_line="$current_line, $display_item"
|
current_line="$current_line, $display_item"
|
||||||
fi
|
fi
|
||||||
((idx++)) || true
|
idx=$((idx + 1))
|
||||||
done
|
done
|
||||||
if [[ -n "$current_line" ]]; then
|
if [[ -n "$current_line" ]]; then
|
||||||
summary_details+=("$current_line")
|
summary_details+=("$current_line")
|
||||||
@@ -765,6 +765,6 @@ batch_uninstall_applications() {
|
|||||||
_restore_uninstall_traps
|
_restore_uninstall_traps
|
||||||
unset -f _restore_uninstall_traps
|
unset -f _restore_uninstall_traps
|
||||||
|
|
||||||
((total_size_cleaned += total_size_freed)) || true
|
total_size_cleaned=$((total_size_cleaned + total_size_freed))
|
||||||
unset failed_items
|
unset failed_items
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user