diff --git a/apps/cloudpanel.sh b/apps/cloudpanel.sh index c18cbd6..b08575c 100755 --- a/apps/cloudpanel.sh +++ b/apps/cloudpanel.sh @@ -637,7 +637,7 @@ main() { 2) update_cloudpanel ;; 3) show_status ;; 4) configure_rclone_backblaze ;; - 0) return 0 ;; + 0) return 75 ;; *) echo -e "${RED}Invalid option${NC}" ;; esac diff --git a/apps/coolify.sh b/apps/coolify.sh index a1fed20..21902b0 100755 --- a/apps/coolify.sh +++ b/apps/coolify.sh @@ -252,7 +252,7 @@ main() { 2) update_coolify ;; 3) show_status ;; 4) show_post_installation_guide ;; - 0) return 0 ;; + 0) return 75 ;; *) echo -e "${RED}Invalid option${NC}" ;; esac diff --git a/apps/index.sh b/apps/index.sh index 19cd0e3..efadca9 100755 --- a/apps/index.sh +++ b/apps/index.sh @@ -66,17 +66,20 @@ menu_apps() { show_prompt read -r choice + child_rc=0 case $choice in - 1|01) run_sibling "apps/coolify.sh" ;; - 2|02) run_sibling "apps/pterodactyl.sh" ;; - 3|03) run_sibling "apps/uptime-kuma.sh" ;; - 4|04) run_sibling "apps/cloudpanel.sh" ;; - 5|05) run_sibling "apps/proxmox.sh" ;; + 1|01) run_sibling "apps/coolify.sh"; child_rc=$? ;; + 2|02) run_sibling "apps/pterodactyl.sh"; child_rc=$? ;; + 3|03) run_sibling "apps/uptime-kuma.sh"; child_rc=$? ;; + 4|04) run_sibling "apps/cloudpanel.sh"; child_rc=$? ;; + 5|05) run_sibling "apps/proxmox.sh"; child_rc=$? ;; 0|00) return ;; *) echo -e "${RED}[KO] Invalid protocol. Select 0-5.${NC}"; sleep 1; continue ;; esac - if [ "$choice" != "0" ] && [ "$choice" != "00" ]; then + # Exit code 75 from a child means it already paused on its own + # (its own "Back" or end-of-run prompt) — skip the redundant prompt. + if [ "$child_rc" -ne 75 ]; then echo "" read -r -p "Press Enter to continue..." fi diff --git a/apps/proxmox.sh b/apps/proxmox.sh index 3cdffb8..02b8304 100755 --- a/apps/proxmox.sh +++ b/apps/proxmox.sh @@ -371,7 +371,7 @@ main() { 7) update_proxmox ;; 8) clear_cache ;; 9) open_firewall_ports ;; - 0) return 0 ;; + 0) return 75 ;; *) echo -e "${RED}Invalid option${NC}" ;; esac diff --git a/apps/pterodactyl.sh b/apps/pterodactyl.sh index 9319c96..0b4367f 100755 --- a/apps/pterodactyl.sh +++ b/apps/pterodactyl.sh @@ -323,7 +323,7 @@ main() { case $choice in 1) install_pterodactyl ;; 2) show_status ;; - 0) return 0 ;; + 0) return 75 ;; *) echo -e "${RED}Invalid option${NC}" ;; esac diff --git a/apps/uptime-kuma.sh b/apps/uptime-kuma.sh index 9e84fa4..a6840f8 100755 --- a/apps/uptime-kuma.sh +++ b/apps/uptime-kuma.sh @@ -242,7 +242,7 @@ main() { 1) install_uptime_kuma ;; 2) update_uptime_kuma ;; 3) show_status ;; - 0) return 0 ;; + 0) return 75 ;; *) echo -e "${RED}Invalid option${NC}" ;; esac diff --git a/tools/index.sh b/tools/index.sh index f8d11b6..b390b51 100755 --- a/tools/index.sh +++ b/tools/index.sh @@ -69,19 +69,22 @@ menu_tools() { show_prompt read -r choice + child_rc=0 case $choice in - 1|01) run_sibling "tools/system-infos.sh" ;; - 2|02) run_sibling "tools/server-benchmark.sh" ;; - 3|03) run_sibling "tools/harden.sh" ;; - 4|04) run_sibling "tools/root-password.sh" ;; - 5|05) run_sibling "tools/update-server.sh" ;; - 6|06) run_sibling "tools/root-ssh-login.sh" ;; - 7|07) run_sibling "tools/welcome-message.sh" ;; + 1|01) run_sibling "tools/system-infos.sh"; child_rc=$? ;; + 2|02) run_sibling "tools/server-benchmark.sh"; child_rc=$? ;; + 3|03) run_sibling "tools/harden.sh"; child_rc=$? ;; + 4|04) run_sibling "tools/root-password.sh"; child_rc=$? ;; + 5|05) run_sibling "tools/update-server.sh"; child_rc=$? ;; + 6|06) run_sibling "tools/root-ssh-login.sh"; child_rc=$? ;; + 7|07) run_sibling "tools/welcome-message.sh"; child_rc=$? ;; 0|00) return ;; *) echo -e "${RED}[KO] Invalid protocol. Select 0-7.${NC}"; sleep 1; continue ;; esac - if [ "$choice" != "0" ] && [ "$choice" != "00" ]; then + # Exit code 75 from a child means it already paused on its own + # (its own "Back" or end-of-run prompt) — skip the redundant prompt. + if [ "$child_rc" -ne 75 ]; then echo "" read -r -p "Press Enter to continue..." fi diff --git a/tools/server-benchmark.sh b/tools/server-benchmark.sh index 92565ec..00450e3 100755 --- a/tools/server-benchmark.sh +++ b/tools/server-benchmark.sh @@ -28,13 +28,7 @@ SCORE_NETWORK_LATENCY=0 # ═══════════════════════════════════════════════════════════════════════════ show_header() { - echo -e "${WHITE}${BOLD}" - echo "╔═══════════════════════════════════════════════════════════════════════════╗" - echo "║ ║" - echo "║ SERVER PERFORMANCE BENCHMARK ║" - echo "║ ║" - echo "╚═══════════════════════════════════════════════════════════════════════════╝" - echo -e "${NC}" + show_box_top "SERVER PERFORMANCE BENCHMARK" } install_dependencies() { @@ -760,4 +754,5 @@ fi # Execute main function main +exit 75 diff --git a/tools/system-infos.sh b/tools/system-infos.sh index 2b973ed..4bee5a7 100755 --- a/tools/system-infos.sh +++ b/tools/system-infos.sh @@ -16,21 +16,21 @@ export LXS_LOG_FILE="/tmp/lxs_system_infos.log" menu_system_infos() { while true; do clear - echo -e "${WHITE}╔═══════════════════════════════════════════════════════╗${NC}" - echo -e "${WHITE}║ SYSTEM INFOS ║${NC}" - echo -e "${WHITE}╚═══════════════════════════════════════════════════════╝${NC}" + show_box_top "SYSTEM INFOS" echo "" - echo -e " ${CYAN}[1]${NC} View system informations" - echo -e " ${CYAN}[2]${NC} Check disk space" - echo -e " ${CYAN}[3]${NC} Check memory usage" - echo -e " ${CYAN}[4]${NC} Check CPU load" - echo -e " ${CYAN}[5]${NC} Check network" - echo -e " ${CYAN}[6]${NC} View system logs (last 50 lines)" - echo -e " ${CYAN}[7]${NC} Show top resource-consuming processes" - echo -e " ${CYAN}[8]${NC} Check disk health (SMART)" - echo -e " ${RED}[0]${NC} Exit" + show_menu_item "1" "View system informations" + show_menu_item "2" "Check disk space" + show_menu_item "3" "Check memory usage" + show_menu_item "4" "Check CPU load" + show_menu_item "5" "Check network" + show_menu_item "6" "View system logs (last 50 lines)" + show_menu_item "7" "Show top resource-consuming processes" + show_menu_item "8" "Check disk health (SMART)" + show_menu_item "0" "Exit" "" exit echo "" - echo -e -n "${BOLD}Choice [0-8]: ${NC}" + show_box_bottom + echo "" + show_prompt read -r choice echo "" @@ -39,9 +39,7 @@ menu_system_infos() { 1) # View system informations clear - echo -e "${WHITE}╔═══════════════════════════════════════════════════════╗${NC}" - echo -e "${WHITE}║ SYSTEM INFORMATION ║${NC}" - echo -e "${WHITE}╚═══════════════════════════════════════════════════════╝${NC}" + show_box_top "SYSTEM INFORMATION" echo "" echo -e "${CYAN}${BOLD}Operating System:${NC}" @@ -267,7 +265,7 @@ menu_system_infos() { fi ;; 0) - exit 0 + exit 75 ;; *) echo -e "${RED}[✗] Invalid option. Please select 0-8.${NC}"