66 lines
1.5 KiB
Python
Executable file
66 lines
1.5 KiB
Python
Executable file
#!/bin/python3
|
|
#
|
|
## Wizard Kit: HW Diagnostics - Menu
|
|
|
|
import os
|
|
import sys
|
|
|
|
# Init
|
|
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
|
|
from functions.hw_diags import *
|
|
from functions.tmux import *
|
|
init_global_vars()
|
|
|
|
if __name__ == '__main__':
|
|
# Show menu
|
|
try:
|
|
state = State()
|
|
menu_diags(state, sys.argv)
|
|
except KeyboardInterrupt:
|
|
print_standard(' ')
|
|
print_warning('Aborted')
|
|
print_standard(' ')
|
|
sleep(1)
|
|
pause('Press Enter to exit...')
|
|
except SystemExit as sys_exit:
|
|
tmux_switch_client()
|
|
exit_script(sys_exit.code)
|
|
except:
|
|
# Cleanup
|
|
tmux_kill_all_panes()
|
|
|
|
if DEBUG_MODE:
|
|
# Custom major exception
|
|
print_standard(' ')
|
|
print_error('Major exception')
|
|
print_warning(SUPPORT_MESSAGE)
|
|
print(traceback.format_exc())
|
|
print_log(traceback.format_exc())
|
|
|
|
# Save debug reports and upload data
|
|
try_and_print(
|
|
message='Saving debug reports...',
|
|
function=save_debug_reports,
|
|
state=state, global_vars=global_vars)
|
|
question = 'Upload crash details to {}?'.format(CRASH_SERVER['Name'])
|
|
if ENABLED_UPLOAD_DATA and ask(question):
|
|
try_and_print(
|
|
message='Uploading Data...',
|
|
function=upload_logdir,
|
|
global_vars=global_vars)
|
|
|
|
# Done
|
|
sleep(1)
|
|
pause('Press Enter to exit...')
|
|
exit_script(1)
|
|
|
|
else:
|
|
# "Normal" major exception
|
|
major_exception()
|
|
|
|
# Done
|
|
tmux_kill_all_panes()
|
|
tmux_switch_client()
|
|
exit_script()
|
|
|
|
# vim: sts=2 sw=2 ts=2
|