more bug fixes, simplified logic

This commit is contained in:
inxi-svn 2011-06-08 06:17:03 +00:00
parent 98249b201c
commit 6b1fc9cdc0

39
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 1.5.997 #### version: 1.5.998
#### Date: June 7 2011 #### Date: June 7 2011
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
@ -224,6 +224,7 @@ B_EXTRA_EXTRA_DATA='false'
# override certain errors due to currupted data # override certain errors due to currupted data
B_HANDLE_CORRUPT_DATA='false' B_HANDLE_CORRUPT_DATA='false'
B_LABEL_SET='false' B_LABEL_SET='false'
B_LAPTOP='false'
B_LOG_COLORS='false' B_LOG_COLORS='false'
B_LOG_FULL_DATA='false' B_LOG_FULL_DATA='false'
B_OUTPUT_FILTER='false' B_OUTPUT_FILTER='false'
@ -670,7 +671,9 @@ initialize_script_data()
else else
error_handler 6 error_handler 6
fi fi
if [[ -d /proc/acpi/battery ]];then
B_LAPTOP='true'
fi
if [[ -e $FILE_CPUINFO ]]; then if [[ -e $FILE_CPUINFO ]]; then
B_CPUINFO_FILE='true' B_CPUINFO_FILE='true'
fi fi
@ -5963,23 +5966,21 @@ print_machine_data()
if [[ ${#A_MACHINE_DATA[@]} -gt 0 ]];then if [[ ${#A_MACHINE_DATA[@]} -gt 0 ]];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
if [[ -z ${A_MACHINE_DATA[0]} ]];then if [[ $B_LAPTOP != 'true' ]];then
b_skip_system='true' if [[ -z ${A_MACHINE_DATA[0]} ]];then
elif [[ ${A_MACHINE_DATA[0]} == ${A_MACHINE_DATA[5]} && \ b_skip_system='true'
-n ${A_MACHINE_DATA[1]} && -n ${A_MACHINE_DATA[6]} ]];then # ibm / ibm can be true; dell / quantum is false, so in other words, only do this
# some special cases, with: System MSI product MS-7680/Mobo MSI model H61M-P23 (MS-7680) # in case where the vendor is the same and the version is the same and not null,
# do not match, but I think the data is worth keeping since the first string might be the # otherwise the version information is going to be different in all cases I think
# actual version number you see on the box of the mobo. So here we dump system if the longer elif [[ ${A_MACHINE_DATA[0]} == ${A_MACHINE_DATA[5]} && \
# mobo model string contains the system version data and the vendors are the same -n ${A_MACHINE_DATA[2]} && ${A_MACHINE_DATA[2]} == ${A_MACHINE_DATA[7]} ]];then
if [[ ${A_MACHINE_DATA[1]} == ${A_MACHINE_DATA[6]} ]] || \
[[ -n $( grep ${A_MACHINE_DATA[1]} <<< ${A_MACHINE_DATA[6]} ) ]];then
b_skip_system='true' b_skip_system='true'
fi fi
fi fi
# no point in showing chassis if system isn't there, it's very unlikely that would be correct # no point in showing chassis if system isn't there, it's very unlikely that would be correct
if [[ $B_EXTRA_EXTRA_DATA == 'true' && $b_skip_system != 'true' ]];then if [[ $B_EXTRA_EXTRA_DATA == 'true' && $b_skip_system != 'true' ]];then
if [[ -n ${A_MACHINE_DATA[6]} && -n ${A_MACHINE_DATA[14]} && ${A_MACHINE_DATA[14]} == ${A_MACHINE_DATA[6]} ]];then if [[ -n ${A_MACHINE_DATA[7]} && ${A_MACHINE_DATA[14]} == ${A_MACHINE_DATA[7]} ]];then
b_skip_chassis='true' b_skip_chassis='true'
fi fi
if [[ -n ${A_MACHINE_DATA[12]} && $b_skip_chassis != 'true' ]];then if [[ -n ${A_MACHINE_DATA[12]} && $b_skip_chassis != 'true' ]];then
@ -6037,13 +6038,13 @@ print_machine_data()
system_line=$mobo_line system_line=$mobo_line
mobo_line='' mobo_line=''
else else
if [[ -n ${A_MACHINE_DATA[0]} ]];then # this has already been tested for above so we know it's not null
system_vendor=${A_MACHINE_DATA[0]} system_vendor=${A_MACHINE_DATA[0]}
else
system_vendor='N/A'
fi
if [[ -n ${A_MACHINE_DATA[1]} ]];then if [[ -n ${A_MACHINE_DATA[1]} ]];then
product_name=${A_MACHINE_DATA[1]} product_name=${A_MACHINE_DATA[1]}
if [[ $B_LAPTOP == 'true' ]];then
product_name="$product_name (portable)"
fi
else else
product_name='N/A' product_name='N/A'
fi fi