mirror of
https://github.com/smxi/inxi.git
synced 2025-01-19 08:57:57 +00:00
Added null data handler for temp array scsi
This commit is contained in:
parent
0b4058277c
commit
0a6347bed9
50
inxi
50
inxi
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### version: 0.4.14
|
#### version: 0.4.15
|
||||||
#### 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
|
||||||
|
@ -1263,30 +1263,34 @@ get_hard_drive_data_advanced()
|
||||||
IFS=","
|
IFS=","
|
||||||
a_temp_working=( ${A_HDD_DATA[$i]} )
|
a_temp_working=( ${A_HDD_DATA[$i]} )
|
||||||
IFS="$ORIGINAL_IFS"
|
IFS="$ORIGINAL_IFS"
|
||||||
|
if [[ ${#a_temp_scsi[@]} > 0 ]];then
|
||||||
|
for (( j=0; j < ${#a_temp_scsi[@]}; j++ ))
|
||||||
|
do
|
||||||
|
## ok, ok, it's incomprehensible, search /dev/disk/by-id for a line that contains the
|
||||||
|
# discovered disk name AND ends with the correct identifier, sdx
|
||||||
|
# get rid of whitespace for some drive names and ids, and extra data after - in name
|
||||||
|
temp_name=$( tr ' ' '_' <<< ${a_temp_scsi[$j]} | cut -d '-' -f 1 )
|
||||||
|
|
||||||
for (( j=0; j < ${#a_temp_scsi[@]}; j++ ))
|
sd_ls_by_id=$( ls -l /dev/disk/by-id | egrep -m1 ".*$temp_name.*${a_temp_working[0]}$" )
|
||||||
do
|
# echo temp_name:$temp_name
|
||||||
## ok, ok, it's incomprehensible, search /dev/disk/by-id for a line that contains the
|
if [[ -n $sd_ls_by_id ]];then
|
||||||
# discovered disk name AND ends with the correct identifier, sdx
|
a_temp_working[2]=${a_temp_scsi[$j]}
|
||||||
temp_name=$( tr ' ' '_' <<< ${a_temp_scsi[$j]} | cut -d '-' -f 1 ) # get rid of whitespace for WDC
|
if [[ -n $( grep 'usb-' <<< $sd_ls_by_id ) ]];then
|
||||||
|
a_temp_working[3]='usb'
|
||||||
sd_ls_by_id=$( ls -l /dev/disk/by-id | egrep -m1 ".*$temp_name.*${a_temp_working[0]}$" )
|
fi
|
||||||
# echo temp_name:$temp_name
|
break
|
||||||
if [[ -n $sd_ls_by_id ]];then
|
else
|
||||||
a_temp_working[2]=${a_temp_scsi[$j]}
|
# special initial usb handling
|
||||||
if [[ -n $( grep 'usb-' <<< $sd_ls_by_id ) ]];then
|
# if [[ -n $( ls -l /dev/disk/by-id | egrep -m1 ".*/USB.*${a_temp_working[0]}$" ) ]];then
|
||||||
a_temp_working[3]='usb'
|
#
|
||||||
|
# else
|
||||||
|
a_temp_working[2]="Name n/a"
|
||||||
|
# fi
|
||||||
fi
|
fi
|
||||||
break
|
done
|
||||||
else
|
else
|
||||||
# special initial usb handling
|
a_temp_working[2]="Name n/a"
|
||||||
# if [[ -n $( ls -l /dev/disk/by-id | egrep -m1 ".*/USB.*${a_temp_working[0]}$" ) ]];then
|
fi
|
||||||
#
|
|
||||||
# else
|
|
||||||
a_temp_working[2]="Name n/a"
|
|
||||||
# fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# these loops are to easily extend the cpu array created in the awk script above with more fields per cpu.
|
# these loops are to easily extend the cpu array created in the awk script above with more fields per cpu.
|
||||||
for (( j=0; j < ${#a_temp_working[@]}; j++ ))
|
for (( j=0; j < ${#a_temp_working[@]}; j++ ))
|
||||||
|
|
Loading…
Reference in a new issue