Fixed bugs in debugger logic, it simply wasn't working at all, things were out of place, fails to run when needed.

This commit is contained in:
inxi-svn 2008-12-13 21:15:51 +00:00
parent 3bb0d7d087
commit a2a6dc0aeb

25
inxi
View file

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 0.8.5 #### version: 0.8.6
#### Date: December 4 2008 #### Date: December 13 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.
@ -110,9 +110,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'
@ -306,18 +303,19 @@ error_handler()
exit $1 exit $1
} }
# args: $1 - $@ debugging string text; $2 - type: missing-app/all-up
script_debugger() script_debugger()
{ {
local a_debug_buffer='' local a_debug_buffer=''
if [[ $B_ALL_UP == 'true' ]];then if [[ $2 == 'all-up' || $2 == 'missing-app' ]];then
if [[ $DEBUG -eq 0 ]];then # only return if not app missing or no debugger
if [[ $DEBUG -eq 0 && $2 != 'missing-app' ]];then
return return
fi elif [[ $DEBUG_BUFFER_INDEX -gt 0 ]];then
if [[ $DEBUG_BUFFER_INDEX -gt 0 ]];then
for (( DEBUG_BUFFER_INDEX=0; DEBUG_BUFFER_INDEX < ${#a_debug_buffer[@]}; DEBUG_BUFFER_INDEX++ )) for (( DEBUG_BUFFER_INDEX=0; DEBUG_BUFFER_INDEX < ${#a_debug_buffer[@]}; DEBUG_BUFFER_INDEX++ ))
do do
print_screen_output "${a_debug_buffer[DEBUG_BUFFER_INDEX]}" print_screen_output "${a_debug_buffer[$DEBUG_BUFFER_INDEX]}"
done done
DEBUG_BUFFER_INDEX=0 DEBUG_BUFFER_INDEX=0
fi fi
@ -421,13 +419,12 @@ check_script_depends()
if [[ ! -d /proc/ ]];then if [[ ! -d /proc/ ]];then
error_handler 6 error_handler 6
fi fi
if [[ $B_X_RUNNING == 'true' ]];then if [[ $B_X_RUNNING == 'true' ]];then
for app_name in xrandr xdpyinfo glxinfo for app_name in xrandr xdpyinfo glxinfo
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" script_debugger "Resuming in non X mode: $app_name not found in path" 'missing-app'
B_X_RUNNING='false' B_X_RUNNING='false'
break break
fi fi
@ -2734,8 +2731,8 @@ if [[ $COLOR_SCHEME_SET != 'true' ]];then
set_color_scheme "$DEFAULT_SCHEME" set_color_scheme "$DEFAULT_SCHEME"
fi fi
B_ALL_UP='true' # all the pre-start stuff is in place now
script_debugger "B_ALL_UP=true : inxi up and running.." script_debugger "Debugger: inxi is up and running..." 'all-up'
# then create the output # then create the output
print_it_out print_it_out