mirror of
https://github.com/tw93/Mole.git
synced 2026-02-16 14:43:39 +00:00
refactor: Extract Apple Silicon cache cleaning to a shared function and improve optimization summary calculation.
This commit is contained in:
10
bin/clean.sh
10
bin/clean.sh
@@ -650,15 +650,7 @@ perform_cleanup() {
|
|||||||
end_section
|
end_section
|
||||||
|
|
||||||
# ===== 13. Apple Silicon optimizations =====
|
# ===== 13. Apple Silicon optimizations =====
|
||||||
if [[ "$IS_M_SERIES" == "true" ]]; then
|
clean_apple_silicon_caches
|
||||||
start_section "Apple Silicon updates"
|
|
||||||
safe_clean /Library/Apple/usr/share/rosetta/rosetta_update_bundle "Rosetta 2 cache"
|
|
||||||
safe_clean ~/Library/Caches/com.apple.rosetta.update "Rosetta 2 user cache"
|
|
||||||
safe_clean ~/Library/Caches/com.apple.amp.mediasevicesd "Apple Silicon media service cache"
|
|
||||||
# Skip: iCloud sync cache, may affect device pairing
|
|
||||||
# safe_clean ~/Library/Caches/com.apple.bird.lsuseractivity "User activity cache"
|
|
||||||
end_section
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ===== 14. iOS device backups =====
|
# ===== 14. iOS device backups =====
|
||||||
start_section "iOS device backups"
|
start_section "iOS device backups"
|
||||||
|
|||||||
@@ -67,7 +67,8 @@ show_optimization_summary() {
|
|||||||
local summary_title="Optimization and Check Complete"
|
local summary_title="Optimization and Check Complete"
|
||||||
local -a summary_details=()
|
local -a summary_details=()
|
||||||
|
|
||||||
summary_details+=("Applied ${GREEN}${safe_count:-0}${NC} optimizations; all system services tuned")
|
local total_applied=$((safe_count + confirm_count))
|
||||||
|
summary_details+=("Applied ${GREEN}${total_applied:-0}${NC} optimizations; all system services tuned")
|
||||||
summary_details+=("Updates, security and system health fully reviewed")
|
summary_details+=("Updates, security and system health fully reviewed")
|
||||||
|
|
||||||
local summary_line4=""
|
local summary_line4=""
|
||||||
|
|||||||
BIN
bin/status-go
BIN
bin/status-go
Binary file not shown.
@@ -6,10 +6,11 @@ set -euo pipefail
|
|||||||
# Helper function to clean tool caches using their built-in commands
|
# Helper function to clean tool caches using their built-in commands
|
||||||
# Args: $1 - description, $@ - command to execute
|
# Args: $1 - description, $@ - command to execute
|
||||||
# Env: DRY_RUN
|
# Env: DRY_RUN
|
||||||
|
# Note: Try to estimate potential savings (many tool caches don't have a direct path,
|
||||||
|
# so we just report the action if we can't easily find a path)
|
||||||
clean_tool_cache() {
|
clean_tool_cache() {
|
||||||
local description="$1"
|
local description="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
if [[ "$DRY_RUN" != "true" ]]; then
|
if [[ "$DRY_RUN" != "true" ]]; then
|
||||||
if "$@" > /dev/null 2>&1; then
|
if "$@" > /dev/null 2>&1; then
|
||||||
echo -e " ${GREEN}${ICON_SUCCESS}${NC} $description"
|
echo -e " ${GREEN}${ICON_SUCCESS}${NC} $description"
|
||||||
|
|||||||
@@ -366,11 +366,13 @@ check_ios_device_backups() {
|
|||||||
# Clean Apple Silicon specific caches
|
# Clean Apple Silicon specific caches
|
||||||
# Env: IS_M_SERIES
|
# Env: IS_M_SERIES
|
||||||
clean_apple_silicon_caches() {
|
clean_apple_silicon_caches() {
|
||||||
if [[ "$IS_M_SERIES" != "true" ]]; then
|
if [[ "${IS_M_SERIES:-false}" != "true" ]]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
start_section "Apple Silicon updates"
|
||||||
safe_clean /Library/Apple/usr/share/rosetta/rosetta_update_bundle "Rosetta 2 cache"
|
safe_clean /Library/Apple/usr/share/rosetta/rosetta_update_bundle "Rosetta 2 cache"
|
||||||
safe_clean ~/Library/Caches/com.apple.rosetta.update "Rosetta 2 user cache"
|
safe_clean ~/Library/Caches/com.apple.rosetta.update "Rosetta 2 user cache"
|
||||||
safe_clean ~/Library/Caches/com.apple.amp.mediasevicesd "Apple Silicon media service cache"
|
safe_clean ~/Library/Caches/com.apple.amp.mediasevicesd "Apple Silicon media service cache"
|
||||||
|
end_section
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user