From a9fe030cea51b3fb586088b92f2894446536faee Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Wed, 29 Jul 2009 20:39:48 +0000 Subject: [PATCH] bug fix should be ready to go now --- inxi | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/inxi b/inxi index 1d7b365..e65c96d 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.1.1-b1 +#### version: 1.1.2-b1 #### Date: 29 July 2009 ######################################################################## #### SPECIAL THANKS @@ -3011,7 +3011,10 @@ get_partition_data_advanced() get_sensors_data() { eval $LOGFS +sample=" +" +# echo "$sample" | gawk -F ': ' -v userCpuNo="$SENSORS_CPU_NO" ' IFS=$'\n' if [[ $B_SENSORS == 'true' ]];then # note: non-configured sensors gives error message, which we need to redirect to stdout @@ -3202,17 +3205,6 @@ get_sensors_data() } } - # then set mobo fan if missing. Note, not trying to guess on either of these -# if ( ! 2 in aFanMain ) { -# aFanMain[2] = "" -# } -# # then set psu fan if missing -# if ( ! 3 in aFanMain ) { -# aFanMain[3] = "" -# } - - - # then we need to get the actual numeric max array count for both fan arrays for (i = 0; i <= 14; i++) { if ( i in aFanMain && i > indexCountaFanMain ) { @@ -3263,6 +3255,10 @@ get_sensors_data() else { # then build array arrays: print cpuTempReal "," moboTempReal "," psuTemp + # this is for output, a null print line does NOT create a new array index in bash + if ( fanMainString == "" && fanDefaultString == "" ) { + fanMainString="," + } print fanMainString print fanDefaultString } @@ -4138,9 +4134,12 @@ print_sensors_data() local temp_data='' fan_data='' fan_data2='' b_is_error='false' fan_count=0 local a_sensors_working='' get_sensors_data - + + IFS="," + a_sensors_working=( ${A_SENSORS_DATA[0]} ) + IFS="$ORIGINAL_IFS" # initial error cases, for missing app or unconfigured sensors - if [[ ${#A_SENSORS_DATA[@]} -eq 1 ]];then + if [[ ${#a_sensors_working[@]} -eq 1 ]];then cpu_temp=${A_SENSORS_DATA[0]} b_is_error='true' else @@ -4240,8 +4239,8 @@ print_sensors_data() temp_data=$( create_print_line "Sensors:" "$temp_data" ) print_screen_output "$temp_data" # don't print second or subsequent lines if error data - if [[ $b_is_error != 'true' ]];then - fan_data="$cpu_fan$mobo_fan$ps_fan$sys_fans" + fan_data="$cpu_fan$mobo_fan$ps_fan$sys_fans" + if [[ $b_is_error != 'true' && -n $fan_data ]];then fan_data=$( create_print_line " " "$fan_data" ) print_screen_output "$fan_data" # and then second wrapped fan line if needed