(change version)

found and fixed bug in awk, the test ! i in array is not supported, you have to use only: i in array

annoying, but that's life.
This commit is contained in:
inxi-svn 2010-01-08 00:51:34 +00:00
parent 8eb4d3d470
commit aa746b3221

31
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash
########################################################################
#### Script Name: inxi
#### version: 1.2.9
#### version: 1.2.10
#### Date: January 7 2010
########################################################################
#### SPECIAL THANKS
@ -3207,13 +3207,13 @@ $repo_data_working"
get_sensors_data()
{
eval $LOGFS
IFS=$'\n'
if [[ $B_SENSORS == 'true' ]];then
# note: non-configured sensors gives error message, which we need to redirect to stdout
# also, -F ':' no space, since some cases have the data starting right after,like - :1287
A_SENSORS_DATA=( $(
sensors | gawk -F ':' -v userCpuNo="$SENSORS_CPU_NO" '
sensors | gawk -F ':' -v userCpuNo="$SENSORS_CPU_NO" '
BEGIN {
IGNORECASE=1
core0Temp="" # only if all else fails...
@ -3315,20 +3315,26 @@ get_sensors_data()
# note that the counters are dynamically set for fan numbers here
# otherwise you could overwrite eg aux fan2 with case fan2 in theory
# note: cpu/mobo/ps are 1/2/3
# NOTE: test: ! i in array does NOT work, this appears to be an awk/gawk bug
/^(AUX(1)? |CASE(1)? |CHASSIS(1)? )(.*)[ \t]*([0-9]+)[ \t]RPM/ {
for ( i = 4; i < 7; i++ ){
if ( ! i in aFanMain ){
sysFanNu = i
aFanMain[sysFanNu]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
if ( i in aFanMain ){
##
}
else {
aFanMain[i]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
break
}
}
}
/^(AUX([2-9]) |CASE([2-9]) |CHASSIS([2-9]) )(.*)[ \t]*([0-9]+)[ \t]RPM/ {
for ( i = 5; i < 30; i++ ){
if ( ! i in aFanMain ){
if ( i in aFanMain ) {
##
}
else {
sysFanNu = i
aFanMain[sysFanNu]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
aFanMain[i]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
break
}
}
@ -3342,7 +3348,12 @@ get_sensors_data()
sysFanNu=gensub( /fan([0-9]+)/, "\\1", 1, $1 )
if ( sysFanNu ~ /^([0-9]+)$/ ) {
# add to array if array index does not exist OR if number is > existing number
if ( ! sysFanNu in aFanDefault || fanWorking >= aFanDefault[sysFanNu] ) {
if ( sysFanNu in aFanDefault ) {
if ( fanWorking >= aFanDefault[sysFanNu] ) {
aFanDefault[sysFanNu]=fanWorking
}
}
else {
aFanDefault[sysFanNu]=fanWorking
}
}
@ -3431,7 +3442,7 @@ get_sensors_data()
}
# then we need to get the actual numeric max array count for both fan arrays
for (i = 0; i <= 14; i++) {
for (i = 0; i <= 29; i++) {
if ( i in aFanMain && i > indexCountaFanMain ) {
indexCountaFanMain=i
}