From a2a6dc0aebbbb0f9329cf4f3624310ecd80a2fcc Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Sat, 13 Dec 2008 21:15:51 +0000 Subject: [PATCH] Fixed bugs in debugger logic, it simply wasn't working at all, things were out of place, fails to run when needed. --- inxi | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/inxi b/inxi index 5a2659b..1b7efd4 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,8 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 0.8.5 -#### Date: December 4 2008 +#### version: 0.8.6 +#### Date: December 13 2008 ######################################################################## #### 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. @@ -110,9 +110,6 @@ A_PARTITION_DATA='' A_X_DATA='' ### 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 # -U and -! testing/advanced update options, as well as removing the -U help menu item B_ALLOW_UPDATE='true' @@ -306,18 +303,19 @@ error_handler() exit $1 } +# args: $1 - $@ debugging string text; $2 - type: missing-app/all-up script_debugger() { local a_debug_buffer='' - if [[ $B_ALL_UP == 'true' ]];then - if [[ $DEBUG -eq 0 ]];then + if [[ $2 == 'all-up' || $2 == 'missing-app' ]];then + # only return if not app missing or no debugger + if [[ $DEBUG -eq 0 && $2 != 'missing-app' ]];then return - fi - if [[ $DEBUG_BUFFER_INDEX -gt 0 ]];then + elif [[ $DEBUG_BUFFER_INDEX -gt 0 ]];then for (( DEBUG_BUFFER_INDEX=0; DEBUG_BUFFER_INDEX < ${#a_debug_buffer[@]}; DEBUG_BUFFER_INDEX++ )) do - print_screen_output "${a_debug_buffer[DEBUG_BUFFER_INDEX]}" + print_screen_output "${a_debug_buffer[$DEBUG_BUFFER_INDEX]}" done DEBUG_BUFFER_INDEX=0 fi @@ -421,13 +419,12 @@ check_script_depends() if [[ ! -d /proc/ ]];then error_handler 6 fi - if [[ $B_X_RUNNING == 'true' ]];then for app_name in xrandr xdpyinfo glxinfo do app_data=$( type -p $app_name ) 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' break fi @@ -2734,8 +2731,8 @@ if [[ $COLOR_SCHEME_SET != 'true' ]];then set_color_scheme "$DEFAULT_SCHEME" fi -B_ALL_UP='true' -script_debugger "B_ALL_UP=true : inxi up and running.." +# all the pre-start stuff is in place now +script_debugger "Debugger: inxi is up and running..." 'all-up' # then create the output print_it_out