mirror of
https://github.com/smxi/inxi.git
synced 2025-01-31 18:12:21 +00:00
Cleaned up some testing cases, removed and cleaned up comments, tweaked the full hard drive output a bit
This commit is contained in:
parent
b8b87ed4bf
commit
0ef4b22dcc
39
inxi
39
inxi
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### version: 0.4.21
|
#### version: 0.4.22
|
||||||
#### Date: November 8 2008
|
#### Date: November 8 2008
|
||||||
########################################################################
|
########################################################################
|
||||||
#### inxi is a fork of infobash, the original bash sys info script by locsmif
|
#### 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
|
## then handle libata names
|
||||||
# first get the ata device names, put them into an array
|
# first get the ata device names, put them into an array
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
if [[ -e /proc/scsi/sg/device_strs && $B_TESTING_FLAG == 'true' ]]; then
|
if [[ -e /proc/scsi/scsi ]]; 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
|
|
||||||
a_temp_scsi=( $( gawk '
|
a_temp_scsi=( $( gawk '
|
||||||
BEGIN { IGNORECASE=1 }
|
BEGIN { IGNORECASE=1 }
|
||||||
/host/ {
|
/host/ {
|
||||||
|
@ -1309,7 +1297,7 @@ get_hard_drive_data_advanced()
|
||||||
temp_name=$( tr ' ' '_' <<< ${a_temp_scsi[$j]} | cut -d '-' -f 1 )
|
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]}$" )
|
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
|
if [[ -n $sd_ls_by_id ]];then
|
||||||
a_temp_working[2]=${a_temp_scsi[$j]}
|
a_temp_working[2]=${a_temp_scsi[$j]}
|
||||||
if [[ -n $( grep 'usb-' <<< $sd_ls_by_id ) ]];then
|
if [[ -n $( grep 'usb-' <<< $sd_ls_by_id ) ]];then
|
||||||
|
@ -1317,12 +1305,7 @@ get_hard_drive_data_advanced()
|
||||||
fi
|
fi
|
||||||
break
|
break
|
||||||
else
|
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"
|
a_temp_working[2]="Name n/a"
|
||||||
# fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
|
@ -1572,12 +1555,10 @@ print_cpu_data()
|
||||||
# weird hack, probably should be changed
|
# weird hack, probably should be changed
|
||||||
|
|
||||||
cpu_vendor=${a_cpu_working[5]}
|
cpu_vendor=${a_cpu_working[5]}
|
||||||
# Strange (and also some expected) behavior encountered.
|
# Strange (and also some expected) behavior encountered. If print_screen_output() uses $1
|
||||||
# If print_screen_output() uses $1 as the parameter to output to the screen,
|
# as the parameter to output to the screen, then passing "<text1> ${ARR[@]} <text2>"
|
||||||
# then passing "<text1> ${ARR[@]} <text2>"
|
# will output only <text1> and first element of ARR. That "@" splits in elements and "*" _doesn't_,
|
||||||
# will output only <text1> 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.
|
||||||
# is to be expected.
|
|
||||||
# However, that text2 is consecutively truncated is somewhat strange, so take note.
|
|
||||||
# This has been confirmed by #bash on freenode.
|
# This has been confirmed by #bash on freenode.
|
||||||
# The above mentioned only emerges when using the debugging markers below
|
# The above mentioned only emerges when using the debugging markers below
|
||||||
## print_screen_output "a_cpu_working=\"***${a_cpu_working[@]} $hostName+++++++\"----------"
|
## print_screen_output "a_cpu_working=\"***${a_cpu_working[@]} $hostName+++++++\"----------"
|
||||||
|
@ -1738,12 +1719,12 @@ print_hard_disk_data()
|
||||||
IFS="$ORIGINAL_IFS"
|
IFS="$ORIGINAL_IFS"
|
||||||
if [[ $B_SHOW_FULL_HDD == 'true' ]];then
|
if [[ $B_SHOW_FULL_HDD == 'true' ]];then
|
||||||
if [[ -n ${a_hdd_working[3]} ]];then
|
if [[ -n ${a_hdd_working[3]} ]];then
|
||||||
usb_data="(${a_hdd_working[3]})"
|
usb_data="(${a_hdd_working[3]})-"
|
||||||
else
|
else
|
||||||
usb_data=''
|
usb_data=''
|
||||||
fi
|
fi
|
||||||
dev_data="/dev/${a_hdd_working[0]}-"
|
dev_data="/dev/${a_hdd_working[0]} "
|
||||||
size_data="-${a_hdd_working[1]}"
|
size_data=" ${a_hdd_working[1]}"
|
||||||
fi
|
fi
|
||||||
# wrap to avoid long lines
|
# wrap to avoid long lines
|
||||||
if [[ $i -gt 1 && $B_SHOW_FULL_HDD == 'true' ]] || [[ $i -gt 3 ]];then
|
if [[ $i -gt 1 && $B_SHOW_FULL_HDD == 'true' ]] || [[ $i -gt 3 ]];then
|
||||||
|
|
Loading…
Reference in a new issue