Fixed a bug with WDC, requires for the ls -l /dev/disk/by-id test replacing whitespace with _, and trimming off the last

part of the string
This commit is contained in:
inxi-svn 2008-11-08 05:18:01 +00:00
parent fbd76c10bc
commit ac5337d56f

11
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 0.4.0 #### version: 0.4.1
#### Date: November 7 2008 #### Date: November 7 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
@ -1191,10 +1191,7 @@ get_hdd_data_basic()
## fills out the A_HDD_DATA array with disk names ## fills out the A_HDD_DATA array with disk names
get_hard_drive_data_advanced() get_hard_drive_data_advanced()
{ {
local disk='' i='' j='' hdd_cap2='' hdd_cap1='' disk_capacity='' a_total_hdd='' local a_temp_working='' a_temp_scsi='' temp_holder='' temp_name='' i='' j=''
local hdd_model='' hdd_capacity='' hdd_used=''
local a_temp_working='' a_temp_scsi='' temp_holder=''
## next check for all ide type drives, non libata, only do it if hdx is in array ## next check for all ide type drives, non libata, only do it if hdx is in array
if [[ -n $( egrep 'hd[a-z]' <<< ${A_HDD_DATA[@]} ) ]];then if [[ -n $( egrep 'hd[a-z]' <<< ${A_HDD_DATA[@]} ) ]];then
@ -1253,7 +1250,9 @@ get_hard_drive_data_advanced()
do do
## ok, ok, it's incomprehensible, search /dev/disk/by-id for a line that contains the ## 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 # discovered disk name AND ends with the correct identifier, sdx
if [[ -n $( ls -l /dev/disk/by-id | egrep -m1 ".*${a_temp_scsi[$j]}.*${a_temp_working[0]}$" ) ]];then temp_name=$( tr ' ' '_' <<< ${a_temp_scsi[$j]} | cut -d '-' -f 1 ) # get rid of whitespace for WDC
# echo temp_name:$temp_name
if [[ -n $( ls -l /dev/disk/by-id | egrep -m1 ".*$temp_name.*${a_temp_working[0]}$" ) ]];then
a_temp_working[2]=${a_temp_scsi[$j]} a_temp_working[2]=${a_temp_scsi[$j]}
break break
else else