New version, new tarball. This is a transitional version, most -x/-xx/-xxx data is now

working, but help/man does not have that yet, until I finalize the order.

Fixed dmidecode issues, showing extra data types for -m, added line length handling
so -m is properly integrated with rest of inxi re max line lengths.
This commit is contained in:
inxi-svn 2014-08-13 01:13:10 +00:00
parent 75dbb9d473
commit 86e68baaa0
2 changed files with 120 additions and 30 deletions

134
inxi
View file

@ -1,8 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### Version: 2.1.90 #### Version: 2.1.91
#### Date: 2014-08-11 #### Date: 2014-08-12
#### Patch Number: 00 #### Patch Number: 00
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
@ -4922,11 +4922,12 @@ get_dmidecode_data()
sub(/^\tDMI type.*/, "", $0) sub(/^\tDMI type.*/, "", $0)
cutExtraTab="true" cutExtraTab="true"
} }
gsub(/'"$BAN_LIST_NORMAL"'/, "", twoData) gsub(/'"$BAN_LIST_NORMAL"'/, "", twoData)
gsub(/,/, " ", $0) gsub(/,/, " ", twoData)
# clean out Handle line # clean out Handle line
# sub(/^Handle.*/,"", $0) # sub(/^Handle.*/,"", $0)
sub(/^[[:space:]]*Inactive.*/,"",$0) sub(/^[[:space:]]*Inactive.*/,"",twoData)
# yes, there is a typo in a user data set, unknow # yes, there is a typo in a user data set, unknow
# Base Board Version|Base Board Serial Number # Base Board Version|Base Board Serial Number
# Chassis Manufacturer|Chassis Version|Chassis Serial Number # Chassis Manufacturer|Chassis Version|Chassis Serial Number
@ -4934,8 +4935,8 @@ get_dmidecode_data()
# To Be Filled By O.E.M. # To Be Filled By O.E.M.
# strip out starting white space so that the following stuff will clear properly # strip out starting white space so that the following stuff will clear properly
sub(/^[[:space:]]+/, "", twoData) sub(/^[[:space:]]+/, "", twoData)
sub(/^Base Board .*|^Chassis .*|.*O\.E\.M\..*|.*OEM.*|^Not .*|^System .*|.*unknow.*|.*N\/A.*|none|^To be filled.*/, "", twoData) sub(/^Base Board .*|^Chassis .*|.*O\.E\.M\..*|.*OEM.*|^Not .*|^System .*|.*unknow.*|.*N\/A.*|none|^To be filled.*|^0x[0]+$/, "", twoData)
sub(/(AssetTagNum|Manufacturer| Or Motherboard|PartNum|SerNum).*/, "", twoData) sub(/.*(AssetTagNum|Manufacturer| Or Motherboard|PartNum.*|SerNum).*/, "", twoData)
gsub(/bios|acpi/, "", twoData) gsub(/bios|acpi/, "", twoData)
sub(/http:\/\/www.abit.com.tw\//, "Abit", twoData) sub(/http:\/\/www.abit.com.tw\//, "Abit", twoData)
@ -4948,7 +4949,6 @@ get_dmidecode_data()
else { else {
sub(/^\t\t+/, "~", oneData) sub(/^\t\t+/, "~", oneData)
} }
gsub(/^[[:space:]]+|[[:space:]]+$/, "", twoData) gsub(/^[[:space:]]+|[[:space:]]+$/, "", twoData)
gsub(/^[[:space:]]+|[[:space:]]+$/, "", oneData) gsub(/^[[:space:]]+|[[:space:]]+$/, "", oneData)
gsub(/ [ \t]+/, " ", twoData) gsub(/ [ \t]+/, " ", twoData)
@ -4965,7 +4965,7 @@ N
/^\n$/D /^\n$/D
}' \ }' \
)" )"
# echo ":${DMIDECODE_DATA/*Permission denied*/}:" # echo ":${DMIDECODE_DATA}:"
log_function_data "DMIDECODE_DATA (PRE): $DMIDECODE_DATA" log_function_data "DMIDECODE_DATA (PRE): $DMIDECODE_DATA"
if [[ ${#DMIDECODE_DATA} -lt 100 ]];then if [[ ${#DMIDECODE_DATA} -lt 100 ]];then
if [[ -z ${DMIDECODE_DATA/*Permission denied*/} ]];then if [[ -z ${DMIDECODE_DATA/*Permission denied*/} ]];then
@ -6095,7 +6095,6 @@ get_machine_data()
board_vendor board_name board_version board_serial board_vendor board_name board_version board_serial
bios_vendor bios_version bios_date bios_vendor bios_version bios_date
" "
if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then
machine_files="$machine_files machine_files="$machine_files
chassis_vendor chassis_type chassis_version chassis_serial chassis_vendor chassis_type chassis_version chassis_serial
@ -6222,6 +6221,9 @@ get_machine_data()
exit # stop the loop exit # stop the loop
} }
END { END {
# sys_vendor product_name product_version product_serial product_uuid
# board_vendor board_name board_version board_serial
# bios_vendor bios_version bios_date
if ( bItemFound == "true" ) { if ( bItemFound == "true" ) {
fullString = systemManufacturer "," systemProductName "," systemVersion "," systemSerialNumber fullString = systemManufacturer "," systemProductName "," systemVersion "," systemSerialNumber
fullString = fullString "," systemUuid "," baseboardManufacturer "," baseboardProductName fullString = fullString "," systemUuid "," baseboardManufacturer "," baseboardProductName
@ -6236,11 +6238,13 @@ get_machine_data()
fi fi
fi fi
fi fi
echo $array_string
IFS=',' IFS=','
A_MACHINE_DATA=( $array_string ) A_MACHINE_DATA=( $array_string )
IFS="$ORIGINAL_IFS" IFS="$ORIGINAL_IFS"
a_temp=${A_MACHINE_DATA[@]} # echo ${A_MACHINE_DATA[5]}
# echo ${a_temp[@]} a_temp=( ${A_MACHINE_DATA[@]} )
# echo ${#a_temp[@]}
log_function_data "A_MACHINE_DATA: $a_temp" log_function_data "A_MACHINE_DATA: $a_temp"
eval $LOGFE eval $LOGFE
} }
@ -8166,7 +8170,7 @@ get_ram_data()
if ( $1 == "Error Correction Type") { if ( $1 == "Error Correction Type") {
errorCorrection=$2 errorCorrection=$2
if ( errorCorrection == "" ){ if ( errorCorrection == "" ){
errorCorrection="None" errorCorrection="No"
} }
} }
if ( $1 == "Number of Devices") { if ( $1 == "Number of Devices") {
@ -8199,12 +8203,13 @@ get_ram_data()
deviceSize=$2 deviceSize=$2
} }
if ( $1 == "Locator") { if ( $1 == "Locator") {
sub(/.*_/,"",$2) # sub(/.*_/,"",$2)
sub(/RAM slot #|^DIMM/, "slot",$2)
locator=toupper($2) locator=toupper($2)
} }
if ( $1 == "Bank Locator") { if ( $1 == "Bank Locator") {
sub(/_.*/,"",$2) sub(/_.*/,"",$2)
sub(/Channel/,"bank",$2) sub(/RAM slot #|Channel|Chan/,"bank",$2)
bankLocator=toupper($2) bankLocator=toupper($2)
} }
if ( $1 == "Form Factor") { if ( $1 == "Form Factor") {
@ -8223,15 +8228,15 @@ get_ram_data()
configuredClockSpeed=$2 configuredClockSpeed=$2
} }
if ( $1 == "Manufacturer") { if ( $1 == "Manufacturer") {
sub(/([0]+|Undefined.*|Manufacturer.*)/,"",$2) gsub(/(^[0]+$|Undefined.*|.*Manufacturer.*)/,"",$2)
deviceManufacturer=$2 deviceManufacturer=$2
} }
if ( $1 == "Part Number") { if ( $1 == "Part Number") {
sub(/([0]+|PartNum.*|Undefined.*)/,"",$2) sub(/(^[0]+$||.*Module.*|Undefined.*)/,"",$2)
devicePartNumber=$2 devicePartNumber=$2
} }
if ( $1 == "Serial Number") { if ( $1 == "Serial Number") {
sub(/([0]+|SerNum.*|Undefined.*)/,"",$2) gsub(/(^[0]+$|Undefined.*)/,"",$2)
deviceSerialNumber=$2 deviceSerialNumber=$2
} }
} }
@ -10705,8 +10710,8 @@ print_machine_data()
# 9-bios_vendor 10-bios_version 11-bios_date # 9-bios_vendor 10-bios_version 11-bios_date
## with extra data: ## with extra data:
# 12-chassis_vendor 13-chassis_type 14-chassis_version 15-chassis_serial # 12-chassis_vendor 13-chassis_type 14-chassis_version 15-chassis_serial
# a null array always has a count of 1
if [[ ${#A_MACHINE_DATA[@]} -gt 0 ]];then if [[ ${#A_MACHINE_DATA[@]} -gt 1 ]];then
# note: in some case a mobo/version will match a product name/version, do not print those # note: in some case a mobo/version will match a product name/version, do not print those
# but for laptops, or even falsely id'ed desktops with batteries, let's print it all if it matches # but for laptops, or even falsely id'ed desktops with batteries, let's print it all if it matches
# there can be false id laptops if battery appears so need to make sure system is filled # there can be false id laptops if battery appears so need to make sure system is filled
@ -11863,7 +11868,7 @@ print_raid_data()
print_ram_data() print_ram_data()
{ {
eval $LOGFS eval $LOGFS
local memory_line="${C1}Placeholder$SEP3${C2} Feature not yet developed" local memory_line='' line_2='' line_3=''
local error_string='' a_memory_item='' line_starter='Memory:' array_counter=0 local error_string='' a_memory_item='' line_starter='Memory:' array_counter=0
local dmidecodeNull='No dmidecode memory data: try newer kernel.' local dmidecodeNull='No dmidecode memory data: try newer kernel.'
@ -11872,9 +11877,8 @@ print_ram_data()
local device_size='' array_use='' location='' error_correction='' max_capacity='' nu_of_devices='' local device_size='' array_use='' location='' error_correction='' max_capacity='' nu_of_devices=''
get_ram_data get_ram_data
#echo ${#A_MEMORY_DATA[@]} #echo ${#A_MEMORY_DATA[@]}
# echo ${A_MEMORY_DATA[0]} #echo ${A_MEMORY_DATA[0]}
if [[ ${#A_MEMORY_DATA[@]} -gt 0 ]];then if [[ ${#A_MEMORY_DATA[@]} -gt 0 ]];then
if [[ ${A_MEMORY_DATA[0]} == 'dmidecode-error-'* ]];then if [[ ${A_MEMORY_DATA[0]} == 'dmidecode-error-'* ]];then
error_string=$( print_dmidecode_error 'default' "${A_MEMORY_DATA[0]}" ) error_string=$( print_dmidecode_error 'default' "${A_MEMORY_DATA[0]}" )
@ -11885,9 +11889,13 @@ print_ram_data()
IFS=',' IFS=','
a_memory_item=(${A_MEMORY_DATA[i]}) a_memory_item=(${A_MEMORY_DATA[i]})
IFS="$ORIGINAL_IFS" IFS="$ORIGINAL_IFS"
memory_line=''
line_2=''
line_3=''
part_nu=''
serial_nu=''
manufacturer=''
# memory-array,0x0012,System Board,8 GB,4,System Memory,None # memory-array,0x0012,System Board,8 GB,4,System Memory,None
# memory-device,0x002C,8192 MB,ChannelD,ChannelD_Dimm2,DIMM,DDR3,Synchronous,2400 MHz,2400 MHz,64 bits,64 bits,Undefined,F3-19200C10-8GBZH,00000000
if [[ ${a_memory_item[0]} == 'memory-array' ]];then if [[ ${a_memory_item[0]} == 'memory-array' ]];then
if [[ -n ${a_memory_item[4]} ]];then if [[ -n ${a_memory_item[4]} ]];then
nu_of_devices=${a_memory_item[4]} nu_of_devices=${a_memory_item[4]}
@ -11904,7 +11912,7 @@ print_ram_data()
else else
error_correction='N/A' error_correction='N/A'
fi fi
memory_line="${C1}Array$SEP3${C2} $array_counter ${C1}Capacity$SEP3${C2} $max_capacity ${C1}Devices$SEP3${C2} $nu_of_devices ${C1}EC$SEP3${C2} $error_correction" memory_line="${C1}Array$SEP3${C2} $array_counter ${C1}capacity$SEP3${C2} $max_capacity ${C1}devices$SEP3${C2} $nu_of_devices ${C1}EC$SEP3${C2} $error_correction"
(( array_counter++ )) (( array_counter++ ))
else else
if [[ -n ${a_memory_item[3]} ]];then if [[ -n ${a_memory_item[3]} ]];then
@ -11918,8 +11926,8 @@ print_ram_data()
bank='N/A' bank='N/A'
fi fi
if [[ -n ${a_memory_item[4]} ]];then if [[ -n ${a_memory_item[4]} ]];then
if [[ -z ${a_memory_item[4]/DIMM*/} ]];then if [[ -z ${a_memory_item[4]/SLOT*/} ]];then
slot=${a_memory_item[4]#DIMM} slot=${a_memory_item[4]#SLOT}
slot=${slot## } slot=${slot## }
else else
slot=${a_memory_item[4]} slot=${a_memory_item[4]}
@ -11934,9 +11942,14 @@ print_ram_data()
fi fi
if [[ -n ${a_memory_item[6]} ]];then if [[ -n ${a_memory_item[6]} ]];then
device_type=${a_memory_item[6]} device_type=${a_memory_item[6]}
if [[ $B_EXTRA_EXTRA_EXTRA_DATA == 'true' && -n ${a_memory_item[7]} \
&& ${a_memory_item[7]} != 'Other' ]];then
device_type="$device_type (${a_memory_item[7]}) "
fi
else else
device_type='N/A' device_type='N/A '
fi fi
device_type="${C1}type$SEP3${C2} $device_type "
if [[ -n ${a_memory_item[8]} ]];then if [[ -n ${a_memory_item[8]} ]];then
if [[ -n ${a_memory_item[9]} ]];then if [[ -n ${a_memory_item[9]} ]];then
device_speed=${a_memory_item[9]} device_speed=${a_memory_item[9]}
@ -11946,11 +11959,72 @@ print_ram_data()
else else
device_speed='N/A' device_speed='N/A'
fi fi
memory_line="${C1}Bank$SEP3${C2} $bank ${C1}Slot$SEP3${C2} $slot ${C1}size$SEP3${C2} $device_size ${C1}speed$SEP3${C2} $device_speed ${C1}type$SEP3${C2} $device_type " device_speed="${C1}speed$SEP3${C2} $device_speed "
# memory-device,0x002C,8192 MB,ChannelD,ChannelD_Dimm2,DIMM,DDR3,Synchronous,2400 MHz,2400 MHz,64 bits,64 bits,Undefined,F3-19200C10-8GBZH,00000000
if [[ $B_EXTRA_DATA == 'true' ]];then
if [[ -n ${a_memory_item[13]} ]];then
part_nu=${a_memory_item[13]}
else
part_nu='N/A'
fi
part_nu="${C1}part$SEP3${C2} $part_nu "
fi
if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then
if [[ -n ${a_memory_item[12]} ]];then
manufacturer=${a_memory_item[12]}
else
manufacturer='N/A'
fi
manufacturer="${C1}manufacturer$SEP3${C2} $manufacturer "
if [[ -n ${a_memory_item[14]} ]];then
serial_nu=${a_memory_item[14]}
else
serial_nu='N/A'
fi
serial_nu="${C1}serial$SEP3${C2} $serial_nu "
fi
if [[ $B_EXTRA_EXTRA_EXTRA_DATA == 'true' ]];then
if [[ -n ${a_memory_item[11]} ]];then
data_width=${a_memory_item[11]}
else
data_width='N/A'
fi
data_width="${C1}width$SEP3 total$SEP3${C2} $data_width "
if [[ -n ${a_memory_item[10]} ]];then
total_width=${a_memory_item[10]}
else
total_width='N/A'
fi
total_width="${C1}data$SEP3${C2} $total_width "
fi
memory_line="${C1}Bank$SEP3${C2} $bank ${C1}slot$SEP3${C2} $slot ${C1}size$SEP3${C2} $device_size $device_speed"
if [[ $( calculate_line_length "$memory_line$device_type" ) -le $COLS_INNER ]];then
memory_line="$memory_line$device_type"
device_type=''
fi
line_3="$manufacturer$part_nu$serial_nu"
line_2="$device_type$data_width$total_width"
# echo $( calculate_line_length "$memory_line" )
# echo $( calculate_line_length "$memory_line$line_2" )
if [[ $( calculate_line_length "$memory_line$line_2$line_3" ) -gt $COLS_INNER ]];then
memory_line=$( create_print_line "$line_starter" "$memory_line${CN}" )
print_screen_output "$memory_line"
memory_line="$line_2"
line_starter=' '
if [[ -n $line_3 && $( calculate_line_length "$memory_line$line_3" ) -gt $COLS_INNER ]];then
memory_line=$( create_print_line "$line_starter" "$memory_line${CN}" )
print_screen_output "$memory_line"
memory_line="$line_3"
else
memory_line="$line_2$line_3"
fi
else
memory_line="$memory_line$line_2$line_3"
fi
fi fi
memory_line=$( create_print_line "$line_starter" "$memory_line${CN}" ) memory_line=$( create_print_line "$line_starter" "$memory_line${CN}" )
print_screen_output "$memory_line" print_screen_output "$memory_line"
line_starter='' line_starter=' '
done done
memory_line=' ' memory_line=' '
fi fi

View file

@ -1,3 +1,19 @@
=====================================================================================
Version: 2.1.91
Patch Version: 00
Script Date: 2014-08-12
-----------------------------------
Changes:
-----------------------------------
New version, new tarball. This is a transitional version, most -x/-xx/-xxx data is now
working, but help/man does not have that yet, until I finalize the order.
Fixed dmidecode issues, showing extra data types for -m, added line length handling
so -m is properly integrated with rest of inxi re max line lengths.
-----------------------------------
-- Harald Hope - Tue, 12 Aug 2014 18:11:29 -0700
===================================================================================== =====================================================================================
Version: 2.1.90 Version: 2.1.90
Patch Version: 00 Patch Version: 00