#!/bin/bash # ## Wizard Kit: HW Diagnostics - Menu MODE="$1" SHOW_MENU="True" if [[ "$MODE" =~ ^(all|cpu|drives|foh|smart|badblocks)$ ]]; then SHOW_MENU="False" fi SHOW_POWEROPTIONS="False" if [[ "$MODE" =~ ^cli$ ]]; then SHOW_POWEROPTIONS="True" fi function pause() { # Pause to review output echo "" echo "$1" read } function menu() { while :; do if [[ "$SHOW_MENU" == "False" ]]; then break else clear echo "Hardware Diagnostics" echo "────────────────────" echo "0: Quick drive test" echo "1: All tests" echo "2: Prime95" echo "3: SMART & badblocks" echo "4: SMART" echo "5: badblocks" echo "────────────────────" #if [[ -n $DISPLAY ]] && [[ $(getconf LONG_BIT) -eq "64" ]]; then # echo "6: Graphics Test - FurMark" # echo "7: Graphics Test - Piano" # echo "8: Graphics Test - Volplosion" #fi echo "A: Speaker Test" if [[ -n $DISPLAY ]]; then echo "K: Keyboard Test" fi echo "N: Network Test" echo "────────────────────" echo "M: Screen Saver - Matrix" echo "P: Screen Saver - Pipes" echo "────────────────────" echo "Q: Quit" if [[ "$SHOW_POWEROPTIONS" =~ ^True$ ]]; then echo "R: Reboot" echo "S: Shutdown" fi echo "" read -r -p "Please make a selection: " MODE # Check input case $MODE in 0) MODE=foh break;; 1) MODE=all break;; 2) MODE=cpu break;; 3) MODE=drives break;; 4) MODE=smart break;; 5) MODE=badblocks break;; #6) # if [[ -n $DISPLAY ]] && [[ $(getconf LONG_BIT) -eq "64" ]]; then # gputest /fullscreen /test=fur # fi # ;; #7) # if [[ -n $DISPLAY ]] && [[ $(getconf LONG_BIT) -eq "64" ]]; then # gputest /fullscreen /test=pixmark_piano # fi # ;; #8) # if [[ -n $DISPLAY ]] && [[ $(getconf LONG_BIT) -eq "64" ]]; then # gputest /fullscreen /test=pixmark_volplosion # fi # ;; a|A|audio|Audio) clear hw-diags-audio pause "Press Enter to return to menu...";; k|K|keyboard|Keyboard) if [[ -n $DISPLAY ]]; then xev fi ;; m|M) cmatrix -abs reset clear;; n|N) clear hw-diags-network pause "Press Enter to return to menu...";; p|P) pipes -t 0 -t 1 -t 2 -t 3 -p 5 -R -r 4000 reset clear;; q|Q|quit|Quit) exit 0;; r|R) sudo reboot;; s|S) sudo poweroff;; esac fi done } # Main Loop while :; do menu tmux new-session -s 'hw-session' -n 'hw-window' "hw-diags-inner $MODE" if [[ "$SHOW_MENU" == "False" ]]; then break fi done