WizardKit/archlive/airootfs/usr/local/bin/hw-diags
Alan Mason d8952ed26f 2017-01: Retroactive Updates
* Disabled gputest
  * The package is failing to install.

* Now using Midori GTK3 build
  * GTK2 was pulled from main repos for security reasons

* Removed warnings about missing UFD
  * For use with live sessions

* Wallpaper updated for live sessions
  * Wallpaper is now set at startup
  * Checks for UFD source but defaults to included file
  * Bugfix: Wallpaper is now set for multiple monitor/workspace setups

* Disabled choose-mirror service

* Better permission handling
  * build-wk now checks if running as root
  * build-wk now sets permissions before calling build.sh
    * Should prevent build failues as build.sh expects files to be owned by root
    * build-wk sets ownership back to builduser.builduser during cleanup

* Better menu for HW-Diags
  * The script now returns to the menu after running a selection
    * Unless the mode was set directly by passing a valid argument
    * NOTE: This allows for easier use in CLI mode

* Add delay before removing /media/wktech

* Adjusted TMP_DIR in build-wk

* Fixed path to custom repo

* Trimming the fat
  * hostname / hosts now configured by customize_airootfs.sh
  * removed files from etc that were at default settings
  * removed grml zsh config since oh-my-zsh/lean is used

* Defined a LOG_DIR for build-wk

* Introducing libinput
  * Switched to libinput over synaptics as it has been deprecated.
    * Should restore touchpad functionality going forward.
* Full mount path SHOULD now be displayed for mount-all-volumes.

* Added CLI Screensavers

* diag-network works now
  * network connection tests now passes all ipv4 private ip ranges
    * 10.0.0.0/8, 172.16.0.0/12, & 192.168.0.0/24
    * need to add ipv6 at some point
  * hw-diag menu flow adjusted

* New hostname and more bugfixes
  * hostname switched to wk-arch
  * ufw package is now installed
  * adjusted upload section of hw-diags

* Added alias for start-wifi

* Booting to CLI mode will autologin wktech
  * When booting to the CLI the motd shows some avail commands
  * Adjusted HW-Diags menu for use in CLI mode
2017-12-06 17:56:10 -08:00

130 lines
3.8 KiB
Bash

#!/bin/bash
#
## WK HW diagnostics - Launcher
MODE="$1"
SHOW_MENU="True"
if [[ "$MODE" =~ ^(all|cpu|drives|foh|smart|badblocks)$ ]]; then
SHOW_MENU="False"
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 [[ "$MODE" =~ ^cli$ ]]; 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