mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
debug effort 1
This commit is contained in:
parent
2a976358b3
commit
44b83d0e2f
84
inxi
84
inxi
|
@ -1,8 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### version: 0.8.5-b1-t10
|
#### version: 0.8.8-b1-t1
|
||||||
#### Date: December 12 2008
|
#### Date: December 14 2008
|
||||||
########################################################################
|
########################################################################
|
||||||
#### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif
|
#### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif
|
||||||
#### As time permits functionality improvements and recoding will occur.
|
#### As time permits functionality improvements and recoding will occur.
|
||||||
|
@ -101,6 +101,7 @@ A_AUDIO_DATA=''
|
||||||
A_CMDL=''
|
A_CMDL=''
|
||||||
A_CPU_CORE_DATA=''
|
A_CPU_CORE_DATA=''
|
||||||
A_CPU_DATA=''
|
A_CPU_DATA=''
|
||||||
|
A_DEBUG_BUFFER=''
|
||||||
A_GFX_CARD_DATA=''
|
A_GFX_CARD_DATA=''
|
||||||
A_GLX_DATA=''
|
A_GLX_DATA=''
|
||||||
A_HDD_DATA=''
|
A_HDD_DATA=''
|
||||||
|
@ -110,9 +111,6 @@ A_PARTITION_DATA=''
|
||||||
A_X_DATA=''
|
A_X_DATA=''
|
||||||
|
|
||||||
### Boolean true/false globals
|
### Boolean true/false globals
|
||||||
# check to make sure initial steps run without error for debugging
|
|
||||||
# inxi hasn't been 'booted' yet.
|
|
||||||
B_ALL_UP='false'
|
|
||||||
# flag to allow distro maintainers to turn off update features. If false, turns off
|
# flag to allow distro maintainers to turn off update features. If false, turns off
|
||||||
# -U and -! testing/advanced update options, as well as removing the -U help menu item
|
# -U and -! testing/advanced update options, as well as removing the -U help menu item
|
||||||
B_ALLOW_UPDATE='true'
|
B_ALLOW_UPDATE='true'
|
||||||
|
@ -127,6 +125,8 @@ B_SHOW_DISK='false'
|
||||||
B_HANDLE_CORRUPT_DATA='false'
|
B_HANDLE_CORRUPT_DATA='false'
|
||||||
# Running in a shell? Defaults to false, and is determined later.
|
# Running in a shell? Defaults to false, and is determined later.
|
||||||
B_RUNNING_IN_SHELL='false'
|
B_RUNNING_IN_SHELL='false'
|
||||||
|
# this sets the debug buffer
|
||||||
|
B_SCRIPT_UP='false'
|
||||||
# Show sound card data
|
# Show sound card data
|
||||||
B_SHOW_AUDIO='false'
|
B_SHOW_AUDIO='false'
|
||||||
B_SHOW_CPU='false'
|
B_SHOW_CPU='false'
|
||||||
|
@ -306,33 +306,37 @@ error_handler()
|
||||||
exit $1
|
exit $1
|
||||||
}
|
}
|
||||||
|
|
||||||
# args: $1 - $@ debugging string text; $2 - optional: type
|
# prior to script up set, pack the data into an array
|
||||||
|
# then we'll print it out later.
|
||||||
|
# args: $1 - $@ debugging string text
|
||||||
script_debugger()
|
script_debugger()
|
||||||
{
|
{
|
||||||
local a_debug_buffer=''
|
if [[ $B_SCRIPT_UP == 'true' ]];then
|
||||||
|
# only return if debugger is off and no pre start up errors have occured
|
||||||
print_screen_output "debugger gets this: $1"
|
if [[ $DEBUG -eq 0 && $DEBUG_BUFFER_INDEX -eq 0 ]];then
|
||||||
|
return 0
|
||||||
if [[ $B_ALL_UP == 'true' || $2 == 'missing-app' ]];then
|
# print out the stored debugging information if errors occured
|
||||||
# only return if not app missing or no debugger
|
elif [[ $DEBUG_BUFFER_INDEX -gt 0 ]];then
|
||||||
if [[ $DEBUG -eq 0 && $2 != 'missing-app' ]];then
|
for (( DEBUG_BUFFER_INDEX=0; DEBUG_BUFFER_INDEX < ${#A_DEBUG_BUFFER[@]}; DEBUG_BUFFER_INDEX++ ))
|
||||||
return
|
do
|
||||||
fi
|
print_screen_output "${A_DEBUG_BUFFER[$DEBUG_BUFFER_INDEX]}"
|
||||||
print_screen_output "we in front of the dbi loop"
|
done
|
||||||
if [[ $DEBUG_BUFFER_INDEX -gt 0 ]];then
|
DEBUG_BUFFER_INDEX=0
|
||||||
for (( DEBUG_BUFFER_INDEX=0; DEBUG_BUFFER_INDEX < ${#a_debug_buffer[@]}; DEBUG_BUFFER_INDEX++ ))
|
fi
|
||||||
do
|
# or print out normal debugger messages if debugger is on
|
||||||
print_screen_output "${a_debug_buffer[$DEBUG_BUFFER_INDEX]}"
|
if [[ $DEBUG -gt 0 ]];then
|
||||||
done
|
print_screen_output "$1"
|
||||||
DEBUG_BUFFER_INDEX=0
|
fi
|
||||||
fi
|
|
||||||
print_screen_output "we got past the dbi loop"
|
|
||||||
print_screen_output "$@"
|
|
||||||
else
|
else
|
||||||
if [[ $B_DEBUG_FLOOD == 'true' && $DEBUG_BUFFER_INDEX -gt 10 ]];then
|
if [[ $B_DEBUG_FLOOD == 'true' && $DEBUG_BUFFER_INDEX -gt 10 ]];then
|
||||||
error_handler 2
|
error_handler 2
|
||||||
fi
|
# this case stores the data for later printout, will print out only
|
||||||
a_debug_buffer[DEBUG_BUFFER_INDEX++]="$@"
|
# at B_SCRIPT_UP == 'true' if array index > 0
|
||||||
|
else
|
||||||
|
A_DEBUG_BUFFER[$DEBUG_BUFFER_INDEX]="$1"
|
||||||
|
# increment count for next pre script up debugging error
|
||||||
|
(( DEBUG_BUFFER_INDEX++ ))
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,7 +436,7 @@ check_script_depends()
|
||||||
do
|
do
|
||||||
app_data=$( type -p $app_name )
|
app_data=$( type -p $app_name )
|
||||||
if [[ -z $app_data ]];then
|
if [[ -z $app_data ]];then
|
||||||
script_debugger "Resuming in non X mode: $app_name not found in path" 'missing-app'
|
script_debugger "Resuming in non X mode: $app_name not found in path"
|
||||||
B_X_RUNNING='false'
|
B_X_RUNNING='false'
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
@ -2700,13 +2704,21 @@ print_system_data()
|
||||||
########################################################################
|
########################################################################
|
||||||
#### SCRIPT EXECUTION
|
#### SCRIPT EXECUTION
|
||||||
########################################################################
|
########################################################################
|
||||||
|
# first two functions must be set first for colors etc. Remember, no debugger
|
||||||
|
# stuff works on these first two functions unless you set the debugging flag
|
||||||
|
# manually. Debugging flag -@ [number] will not work until get_parameters runs.
|
||||||
set_calculated_variables
|
set_calculated_variables
|
||||||
# Check for dependencies before running anything else except above function
|
|
||||||
check_script_depends
|
|
||||||
|
|
||||||
## this needs to run before the KONVI stuff is set below
|
## this needs to run before the KONVI stuff is set below
|
||||||
get_start_client
|
get_start_client
|
||||||
|
|
||||||
|
# "$@" passes every parameter separately quoted, "$*" passes all parameters as one quoted parameter.
|
||||||
|
# must be here to allow debugger and other flags to be set.
|
||||||
|
get_parameters $@
|
||||||
|
|
||||||
|
# Check for dependencies before running anything else except above functions
|
||||||
|
check_script_depends
|
||||||
|
|
||||||
# note: this only works if it's run from inside konversation as a script builtin or something
|
# note: this only works if it's run from inside konversation as a script builtin or something
|
||||||
# only do this if inxi has been started as a konversation script, otherwise bypass this
|
# only do this if inxi has been started as a konversation script, otherwise bypass this
|
||||||
if [[ $KONVI -eq 1 ]];then
|
if [[ $KONVI -eq 1 ]];then
|
||||||
|
@ -2731,17 +2743,15 @@ fi
|
||||||
# print_screen_output "DCSERVER: $DCSERVER"
|
# print_screen_output "DCSERVER: $DCSERVER"
|
||||||
# print_screen_output "DCTARGET: $DCTARGET"
|
# print_screen_output "DCTARGET: $DCTARGET"
|
||||||
|
|
||||||
# "$@" passes every parameter separately quoted, "$*" passes all parameters as one quoted parameter.
|
|
||||||
get_parameters "$@"
|
|
||||||
|
|
||||||
# If no colorscheme was set in the parameter handling routine, then set the default scheme
|
# If no colorscheme was set in the parameter handling routine, then set the default scheme
|
||||||
if [[ $COLOR_SCHEME_SET != 'true' ]];then
|
if [[ $COLOR_SCHEME_SET != 'true' ]];then
|
||||||
set_color_scheme "$DEFAULT_SCHEME"
|
set_color_scheme "$DEFAULT_SCHEME"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# all the pre-start stuff is in place now
|
# all the pre-start stuff is in place now
|
||||||
B_ALL_UP='true'
|
B_SCRIPT_UP='true'
|
||||||
script_debugger "Debugger: inxi up and running.."
|
script_debugger "Debugger: $SCRIPT_NAME is up and running..."
|
||||||
|
|
||||||
# then create the output
|
# then create the output
|
||||||
print_it_out
|
print_it_out
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue