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

feat: remove automatic Rosetta 2 installation prompt

- Change Rosetta 2 status from warning to info
- Remove auto-fix suggestion for missing Rosetta 2
- Update tests to reflect new behavior (3 -> 2 expected fixes)
This commit is contained in:
tw93
2026-01-26 14:36:12 +08:00
parent e966838c82
commit e0aba780c8
3 changed files with 12 additions and 21 deletions

View File

@@ -57,13 +57,12 @@ check_touchid_sudo() {
check_rosetta() { check_rosetta() {
# Check whitelist # Check whitelist
if command -v is_whitelisted > /dev/null && is_whitelisted "check_rosetta"; then return; fi if command -v is_whitelisted > /dev/null && is_whitelisted "check_rosetta"; then return; fi
# Check Rosetta 2 (for Apple Silicon Macs) # Check Rosetta 2 (for Apple Silicon Macs) - informational only, not auto-fixed
if [[ "$(uname -m)" == "arm64" ]]; then if [[ "$(uname -m)" == "arm64" ]]; then
if [[ -f "/Library/Apple/usr/share/rosetta/rosetta" ]]; then if [[ -f "/Library/Apple/usr/share/rosetta/rosetta" ]]; then
echo -e " ${GREEN}${NC} Rosetta 2 Intel app translation ready" echo -e " ${GREEN}${NC} Rosetta 2 Intel app translation ready"
else else
echo -e " ${GRAY}${ICON_WARNING}${NC} Rosetta 2 ${YELLOW}Intel app support missing${NC}" echo -e " ${GRAY}${ICON_EMPTY}${NC} Rosetta 2 ${GRAY}Not installed${NC}"
export ROSETTA_NOT_INSTALLED=true
fi fi
fi fi
} }
@@ -344,7 +343,7 @@ check_mole_update() {
# Compare versions # Compare versions
if [[ "$(printf '%s\n' "$current_version" "$latest_version" | sort -V | head -1)" == "$current_version" ]]; then if [[ "$(printf '%s\n' "$current_version" "$latest_version" | sort -V | head -1)" == "$current_version" ]]; then
export MOLE_UPDATE_AVAILABLE="true" export MOLE_UPDATE_AVAILABLE="true"
echo -e " ${GRAY}${ICON_WARNING}${NC} Mole ${YELLOW}${latest_version} available${NC} (running ${current_version})" echo -e " ${GRAY}${ICON_WARNING}${NC} Mole ${YELLOW}${latest_version} available${NC}, running ${current_version}"
else else
echo -e " ${GREEN}${NC} Mole Latest version ${current_version}" echo -e " ${GREEN}${NC} Mole Latest version ${current_version}"
fi fi
@@ -406,9 +405,9 @@ check_disk_space() {
export DISK_FREE_GB=$free_num export DISK_FREE_GB=$free_num
if [[ $free_num -lt 20 ]]; then if [[ $free_num -lt 20 ]]; then
echo -e " ${RED}${NC} Disk Space ${RED}${free_gb}GB free${NC} (Critical)" echo -e " ${RED}${NC} Disk Space ${RED}${free_gb}GB free${NC}, Critical"
elif [[ $free_num -lt 50 ]]; then elif [[ $free_num -lt 50 ]]; then
echo -e " ${GRAY}${ICON_WARNING}${NC} Disk Space ${YELLOW}${free_gb}GB free${NC} (Low)" echo -e " ${GRAY}${ICON_WARNING}${NC} Disk Space ${YELLOW}${free_gb}GB free${NC}, Low"
else else
echo -e " ${GREEN}${NC} Disk Space ${free_gb}GB free" echo -e " ${GREEN}${NC} Disk Space ${free_gb}GB free"
fi fi
@@ -452,9 +451,9 @@ check_memory_usage() {
((used_percent < 0)) && used_percent=0 ((used_percent < 0)) && used_percent=0
if [[ $used_percent -gt 90 ]]; then if [[ $used_percent -gt 90 ]]; then
echo -e " ${RED}${NC} Memory ${RED}${used_percent}% used${NC} (Critical)" echo -e " ${RED}${NC} Memory ${RED}${used_percent}% used${NC}, Critical"
elif [[ $used_percent -gt 80 ]]; then elif [[ $used_percent -gt 80 ]]; then
echo -e " ${GRAY}${ICON_WARNING}${NC} Memory ${YELLOW}${used_percent}% used${NC} (High)" echo -e " ${GRAY}${ICON_WARNING}${NC} Memory ${YELLOW}${used_percent}% used${NC}, High"
else else
echo -e " ${GREEN}${NC} Memory ${used_percent}% used" echo -e " ${GREEN}${NC} Memory ${used_percent}% used"
fi fi
@@ -568,7 +567,7 @@ check_swap_usage() {
if [[ "$swap_used" == *"G"* ]]; then if [[ "$swap_used" == *"G"* ]]; then
local swap_gb=${swap_num%.*} local swap_gb=${swap_num%.*}
if [[ $swap_gb -gt 2 ]]; then if [[ $swap_gb -gt 2 ]]; then
echo -e " ${GRAY}${ICON_WARNING}${NC} Swap Usage ${YELLOW}${swap_used}${NC} (High)" echo -e " ${GRAY}${ICON_WARNING}${NC} Swap Usage ${YELLOW}${swap_used}${NC}, High"
else else
echo -e " ${GREEN}${NC} Swap Usage ${swap_used}" echo -e " ${GREEN}${NC} Swap Usage ${swap_used}"
fi fi

View File

@@ -56,7 +56,7 @@ show_suggestions() {
if [[ -n "${DISK_FREE_GB:-}" && "${DISK_FREE_GB:-0}" -lt 50 ]]; then if [[ -n "${DISK_FREE_GB:-}" && "${DISK_FREE_GB:-0}" -lt 50 ]]; then
if [[ -z "${CACHE_SIZE_GB:-}" ]] || (($(echo "${CACHE_SIZE_GB:-0} <= 5" | bc -l 2> /dev/null || echo 1))); then if [[ -z "${CACHE_SIZE_GB:-}" ]] || (($(echo "${CACHE_SIZE_GB:-0} <= 5" | bc -l 2> /dev/null || echo 1))); then
manual_items+=("Low disk space (${DISK_FREE_GB}GB free)|Run: mo analyze to find large files") manual_items+=("Low disk space, ${DISK_FREE_GB}GB free|Run: mo analyze to find large files")
has_suggestions=true has_suggestions=true
fi fi
fi fi
@@ -127,7 +127,7 @@ perform_auto_fix() {
# Ensure sudo access # Ensure sudo access
if ! has_sudo_session; then if ! has_sudo_session; then
if ! ensure_sudo_session "System fixes require admin access"; then if ! ensure_sudo_session "System fixes require admin access"; then
echo -e "${YELLOW}Skipping auto fixes (admin authentication required)${NC}" echo -e "${YELLOW}Skipping auto fixes, admin authentication required${NC}"
echo "" echo ""
return 0 return 0
fi fi
@@ -176,7 +176,7 @@ auth sufficient pam_tid.so
fi fi
if [[ $fixed_count -gt 0 ]]; then if [[ $fixed_count -gt 0 ]]; then
AUTO_FIX_SUMMARY="Auto fixes applied: ${fixed_count} issue(s)" AUTO_FIX_SUMMARY="Auto fixes applied: ${fixed_count} issues"
if [[ ${#fixed_items[@]} -gt 0 ]]; then if [[ ${#fixed_items[@]} -gt 0 ]]; then
AUTO_FIX_DETAILS=$(printf '%s\n' "${fixed_items[@]}") AUTO_FIX_DETAILS=$(printf '%s\n' "${fixed_items[@]}")
else else

View File

@@ -14,7 +14,6 @@ source "$PROJECT_ROOT/lib/manage/autofix.sh"
export FIREWALL_DISABLED=true export FIREWALL_DISABLED=true
export FILEVAULT_DISABLED=true export FILEVAULT_DISABLED=true
export TOUCHID_NOT_CONFIGURED=true export TOUCHID_NOT_CONFIGURED=true
export ROSETTA_NOT_INSTALLED=true
export CACHE_SIZE_GB=9 export CACHE_SIZE_GB=9
export BREW_HAS_WARNINGS=true export BREW_HAS_WARNINGS=true
export DISK_FREE_GB=25 export DISK_FREE_GB=25
@@ -27,7 +26,6 @@ EOF
[[ "$output" == *"Enable Firewall for better security"* ]] [[ "$output" == *"Enable Firewall for better security"* ]]
[[ "$output" == *"Enable FileVault"* ]] [[ "$output" == *"Enable FileVault"* ]]
[[ "$output" == *"Enable Touch ID for sudo"* ]] [[ "$output" == *"Enable Touch ID for sudo"* ]]
[[ "$output" == *"Install Rosetta 2"* ]]
[[ "$output" == *"Low disk space (25GB free)"* ]] [[ "$output" == *"Low disk space (25GB free)"* ]]
[[ "$output" == *"AUTO_FLAG=true"* ]] [[ "$output" == *"AUTO_FLAG=true"* ]]
} }
@@ -72,10 +70,6 @@ sudo() {
case "$1" in case "$1" in
defaults) return 0 ;; defaults) return 0 ;;
bash) return 0 ;; bash) return 0 ;;
softwareupdate)
echo "Installing Rosetta 2 stub output"
return 0
;;
/usr/libexec/ApplicationFirewall/socketfilterfw) return 0 ;; /usr/libexec/ApplicationFirewall/socketfilterfw) return 0 ;;
*) return 0 ;; *) return 0 ;;
esac esac
@@ -83,7 +77,6 @@ sudo() {
export FIREWALL_DISABLED=true export FIREWALL_DISABLED=true
export TOUCHID_NOT_CONFIGURED=true export TOUCHID_NOT_CONFIGURED=true
export ROSETTA_NOT_INSTALLED=true
perform_auto_fix perform_auto_fix
echo "SUMMARY=${AUTO_FIX_SUMMARY}" echo "SUMMARY=${AUTO_FIX_SUMMARY}"
@@ -93,7 +86,6 @@ EOF
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
[[ "$output" == *"Firewall enabled"* ]] [[ "$output" == *"Firewall enabled"* ]]
[[ "$output" == *"Touch ID configured"* ]] [[ "$output" == *"Touch ID configured"* ]]
[[ "$output" == *"Rosetta 2 installed"* ]] [[ "$output" == *"SUMMARY=Auto fixes applied: 2 issues"* ]]
[[ "$output" == *"SUMMARY=Auto fixes applied: 3 issue(s)"* ]]
[[ "$output" == *"DETAILS"* ]] [[ "$output" == *"DETAILS"* ]]
} }