1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-16 10:36:12 +00:00

Optimize security fix prompts and auto-fix flow

This commit is contained in:
Tw93
2025-12-29 15:14:23 +08:00
parent b852e91493
commit a9e4c7c08e

View File

@@ -27,6 +27,8 @@ print_header() {
run_system_checks() { run_system_checks() {
unset AUTO_FIX_SUMMARY AUTO_FIX_DETAILS unset AUTO_FIX_SUMMARY AUTO_FIX_DETAILS
unset MOLE_SECURITY_FIXES_SHOWN
unset MOLE_SECURITY_FIXES_SKIPPED
echo "" echo ""
# Run checks and display results directly without grouping # Run checks and display results directly without grouping
@@ -40,7 +42,9 @@ run_system_checks() {
if ask_for_security_fixes; then if ask_for_security_fixes; then
perform_security_fixes perform_security_fixes
fi fi
echo "" if [[ "${MOLE_SECURITY_FIXES_SKIPPED:-}" != "true" ]]; then
echo ""
fi
check_all_config check_all_config
echo "" echo ""
@@ -233,27 +237,30 @@ ask_for_security_fixes() {
return 1 return 1
fi fi
echo ""
echo -e "${BLUE}SECURITY FIXES${NC}" echo -e "${BLUE}SECURITY FIXES${NC}"
for entry in "${SECURITY_FIXES[@]}"; do for entry in "${SECURITY_FIXES[@]}"; do
IFS='|' read -r _ label <<< "$entry" IFS='|' read -r _ label <<< "$entry"
echo -e " ${ICON_LIST} $label" echo -e " ${ICON_LIST} $label"
done done
echo "" echo ""
echo -ne "${YELLOW}Apply now?${NC} ${GRAY}Enter confirm / ESC cancel${NC}: " export MOLE_SECURITY_FIXES_SHOWN=true
echo -ne "${YELLOW}Apply now?${NC} ${GRAY}Enter confirm / Space cancel${NC}: "
local key local key
if ! key=$(read_key); then if ! key=$(read_key); then
echo "skip" export MOLE_SECURITY_FIXES_SKIPPED=true
echo -e "\n ${GRAY}${ICON_WARNING}${NC} Security fixes skipped"
echo "" echo ""
return 1 return 1
fi fi
if [[ "$key" == "ENTER" ]]; then if [[ "$key" == "ENTER" ]]; then
echo "apply"
echo "" echo ""
return 0 return 0
else else
echo "skip" export MOLE_SECURITY_FIXES_SKIPPED=true
echo -e "\n ${GRAY}${ICON_WARNING}${NC} Security fixes skipped"
echo "" echo ""
return 1 return 1
fi fi