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