bug fixes, output fixes, error fixes

This commit is contained in:
inxi-svn 2009-07-27 05:53:29 +00:00
parent 0c198e1c74
commit c70c18e707

32
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash
########################################################################
#### Script Name: inxi
#### version: 1.0.83-b1
#### version: 1.0.84-b1
#### Date: 26 July 2009
########################################################################
#### SPECIAL THANKS
@ -551,8 +551,6 @@ initialize_script_data()
if [[ -n $( which sensors ) ]];then
B_SENSORS='true'
else
A_SENSORS_DATA=( "Sensors tool requires missing app: lm-sensors" )
fi
if [[ -n $DISPLAY ]];then
@ -3013,8 +3011,8 @@ get_sensors_data()
{
eval $LOGFS
IFS=","
if [[ $B_SENSORS == 'true' ]];then
IFS=","
A_SENSORS_DATA=( $( sensors | gawk '
BEGIN {
IGNORECASE=1
@ -3042,17 +3040,22 @@ get_sensors_data()
}
END {
if ( moboTemp != "" && cpuTemp != "" && cpuFan != "" ) {
print moboTemp "," cpuTemp "," cpuFan
# if they are ALL null, print error message
if ( moboTemp == "" && cpuTemp == "" && cpuFan == "" ) {
print "No active sensors found. Have you configured your sensors yet?"
}
else {
print "No sensors found. Have you configured your sensors yet?"
print moboTemp "," cpuTemp "," cpuFan
}
}
'
) )
IFS="$ORIGINAL_IFS"
# the error case needs to go here because we are setting special array delimiter ','
else
A_SENSORS_DATA=( "You do not have the sensors app installed." )
fi
IFS="$ORIGINAL_IFS"
log_function_data "A_SENSORS_DATA: ${A_SENSORS_DATA[@]}"
echo "A_SENSORS_DATA: ${A_SENSORS_DATA[@]}"
eval $LOGFE
@ -3914,16 +3917,17 @@ print_sensors_data()
eval $LOGFS
local mobo_temp='' cpu_temp='' cpu_fan='' sensors_data=''
get_sensors_data
# initial error cases, for missing app or unconfigured sensors
if [[ ${#A_SENSORS_DATA[@]} -eq 1 ]];then
sensors_data=${A_SENSORS_DATA[0]}
mobo_temp=${A_SENSORS_DATA[0]}
else
if [[ -n ${A_SENSORS_DATA[0]} ]];then
mobo_temp=${A_SENSORS_DATA[0]}
else
mobo_temp='N/A'
fi
mobo_temp="${C1}Mobo Temp:${C2} $mobo_temp"
mobo_temp="${C1}Mobo Temp:${C2} $mobo_temp "
if [[ -n ${A_SENSORS_DATA[1]} ]];then
cpu_temp=${A_SENSORS_DATA[1]}
@ -3933,14 +3937,14 @@ print_sensors_data()
cpu_temp="${C1}Cpu Temp:${C2} $cpu_temp"
if [[ -n ${A_SENSORS_DATA[2]} ]];then
cpu_fan="${A_SENSORS_DATA[2]}rpm"
cpu_fan="${A_SENSORS_DATA[2]}rpm "
else
cpu_fan='N/A'
fi
cpu_fan="${C1}Cpu Fan:${C2} $cpu_fan"
cpu_fan="${C1}Cpu Fan:${C2} $cpu_fan "
sensors_data=${A_SENSORS_DATA[0]}
fi
sensors_data="$mobo_temp $cpu_temp $cpu_fan"
sensors_data="$mobo_temp$cpu_temp$cpu_fan"
sensors_data=$( create_print_line "Sensors:" "$sensors_data" )
print_screen_output "$sensors_data"
eval $LOGFE