1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 09:46:44 +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 whitelist
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 [[ -f "/Library/Apple/usr/share/rosetta/rosetta" ]]; then
echo -e " ${GREEN}${NC} Rosetta 2 Intel app translation ready"
else
echo -e " ${GRAY}${ICON_WARNING}${NC} Rosetta 2 ${YELLOW}Intel app support missing${NC}"
export ROSETTA_NOT_INSTALLED=true
echo -e " ${GRAY}${ICON_EMPTY}${NC} Rosetta 2 ${GRAY}Not installed${NC}"
fi
fi
}
@@ -344,7 +343,7 @@ check_mole_update() {
# Compare versions
if [[ "$(printf '%s\n' "$current_version" "$latest_version" | sort -V | head -1)" == "$current_version" ]]; then
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
echo -e " ${GREEN}${NC} Mole Latest version ${current_version}"
fi
@@ -406,9 +405,9 @@ check_disk_space() {
export DISK_FREE_GB=$free_num
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
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
echo -e " ${GREEN}${NC} Disk Space ${free_gb}GB free"
fi
@@ -452,9 +451,9 @@ check_memory_usage() {
((used_percent < 0)) && used_percent=0
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
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
echo -e " ${GREEN}${NC} Memory ${used_percent}% used"
fi
@@ -568,7 +567,7 @@ check_swap_usage() {
if [[ "$swap_used" == *"G"* ]]; then
local swap_gb=${swap_num%.*}
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
echo -e " ${GREEN}${NC} Swap Usage ${swap_used}"
fi

View File

@@ -56,7 +56,7 @@ show_suggestions() {
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
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
fi
fi
@@ -127,7 +127,7 @@ perform_auto_fix() {
# Ensure sudo access
if ! has_sudo_session; 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 ""
return 0
fi
@@ -176,7 +176,7 @@ auth sufficient pam_tid.so
fi
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
AUTO_FIX_DETAILS=$(printf '%s\n' "${fixed_items[@]}")
else

View File

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