From 0ef4b22dcc550db8580b6b46bd1c323b094ef88a Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Sun, 9 Nov 2008 20:20:23 +0000 Subject: [PATCH] Cleaned up some testing cases, removed and cleaned up comments, tweaked the full hard drive output a bit --- inxi | 41 +++++++++++------------------------------ 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/inxi b/inxi index 9e9ebee..53f7a04 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 0.4.21 +#### version: 0.4.22 #### Date: November 8 2008 ######################################################################## #### inxi is a fork of infobash, the original bash sys info script by locsmif @@ -1250,19 +1250,7 @@ get_hard_drive_data_advanced() ## then handle libata names # first get the ata device names, put them into an array IFS=$'\n' - if [[ -e /proc/scsi/sg/device_strs && $B_TESTING_FLAG == 'true' ]]; then - ## prints out hdd device if field one is ATA type (sata compatibility mode) or prints out scsi device - # note: pmap handles usb mounted devices, which have a null first field - a_temp_scsi=( $( gawk -F'\t' ' - BEGIN { IGNORECASE=1 } - # if the item starts with empty, void field, assume it is flash drive - /^ata|^scsi|^ |^corsair|^wdc|^kingston/ { - gsub(/,/, " ", $(NF -1) ) - gsub(/^ +| +$/, "", $(NF -1) ) - print $(NF -1) - } - ' /proc/scsi/sg/device_strs ) ) - elif [[ -e /proc/scsi/scsi ]]; then + if [[ -e /proc/scsi/scsi ]]; then a_temp_scsi=( $( gawk ' BEGIN { IGNORECASE=1 } /host/ { @@ -1309,7 +1297,7 @@ get_hard_drive_data_advanced() temp_name=$( tr ' ' '_' <<< ${a_temp_scsi[$j]} | cut -d '-' -f 1 ) sd_ls_by_id=$( ls -l /dev/disk/by-id | egrep -m1 ".*$temp_name.*${a_temp_working[0]}$" ) - # echo temp_name:$temp_name + if [[ -n $sd_ls_by_id ]];then a_temp_working[2]=${a_temp_scsi[$j]} if [[ -n $( grep 'usb-' <<< $sd_ls_by_id ) ]];then @@ -1317,12 +1305,7 @@ get_hard_drive_data_advanced() fi break else - # special initial usb handling - # if [[ -n $( ls -l /dev/disk/by-id | egrep -m1 ".*/USB.*${a_temp_working[0]}$" ) ]];then - # - # else - a_temp_working[2]="Name n/a" - # fi + a_temp_working[2]="Name n/a" fi done else @@ -1572,12 +1555,10 @@ print_cpu_data() # weird hack, probably should be changed cpu_vendor=${a_cpu_working[5]} - # Strange (and also some expected) behavior encountered. - # If print_screen_output() uses $1 as the parameter to output to the screen, - # then passing " ${ARR[@]} " - # will output only and the first element of ARR. That "@" splits in elements and "*" _doesn't_, - # is to be expected. - # However, that text2 is consecutively truncated is somewhat strange, so take note. + # Strange (and also some expected) behavior encountered. If print_screen_output() uses $1 + # as the parameter to output to the screen, then passing " ${ARR[@]} " + # will output only and first element of ARR. That "@" splits in elements and "*" _doesn't_, + # is to be expected. However, that text2 is consecutively truncated is somewhat strange, so take note. # This has been confirmed by #bash on freenode. # The above mentioned only emerges when using the debugging markers below ## print_screen_output "a_cpu_working=\"***${a_cpu_working[@]} $hostName+++++++\"----------" @@ -1738,12 +1719,12 @@ print_hard_disk_data() IFS="$ORIGINAL_IFS" if [[ $B_SHOW_FULL_HDD == 'true' ]];then if [[ -n ${a_hdd_working[3]} ]];then - usb_data="(${a_hdd_working[3]})" + usb_data="(${a_hdd_working[3]})-" else usb_data='' fi - dev_data="/dev/${a_hdd_working[0]}-" - size_data="-${a_hdd_working[1]}" + dev_data="/dev/${a_hdd_working[0]} " + size_data=" ${a_hdd_working[1]}" fi # wrap to avoid long lines if [[ $i -gt 1 && $B_SHOW_FULL_HDD == 'true' ]] || [[ $i -gt 3 ]];then