fixed oversight, forgot to put no cd drive detected if all cd / optical drive data is n ull

This commit is contained in:
inxi-svn 2011-07-22 07:03:26 +00:00
parent 93a7e248d9
commit 982f9a3e57

68
inxi
View file

@ -1,8 +1,8 @@
#!/bin/bash
########################################################################
#### Script Name: inxi
#### version: 1.7.18
#### Date: July 20 2011
#### version: 1.7.19
#### Date: July 22 2011
#### Patch Number: 00
########################################################################
#### SPECIAL THANKS
@ -7097,7 +7097,7 @@ print_optical_drive_data()
eval $LOGFS
local a_drives='' drive_data='' counter=''
local drive_id='' drive_links='' vendor='' speed='' multisession='' mcn='' audio=''
local dvd='' state='' rw_support='' rev='' separator=''
local dvd='' state='' rw_support='' rev='' separator='' drive_string=''
get_optical_drive_data
# 0 - true dev path, ie, sr0, hdc
# 1 - dev links to true path
@ -7123,41 +7123,45 @@ print_optical_drive_data()
speed=''
state=''
vendor=''
if [[ ${#A_OPTICAL_DRIVE_DATA[@]} -gt 1 ]];then
counter="-$(( i + 1 ))"
fi
if [[ -z ${a_drives[0]} ]];then
drive_id='N/A'
if [[ ${#A_OPTICAL_DRIVE_DATA[@]} -eq 1 && -z ${a_drives[0]} && -z ${a_drives[1]} ]];then
drive_string="No optical drive detected."
else
drive_id="/dev/${a_drives[0]}"
fi
drive_links=$( sed 's/~/,/g' <<< ${a_drives[1]} )
if [[ -z $drive_links ]];then
drive_links='N/A'
fi
if [[ -n ${a_drives[2]} ]];then
vendor=${a_drives[2]}
if [[ -n ${a_drives[3]} ]];then
vendor="$vendor ${a_drives[3]}"
if [[ ${#A_OPTICAL_DRIVE_DATA[@]} -gt 1 ]];then
counter="-$(( i + 1 ))"
fi
fi
if [[ -z $vendor ]];then
if [[ -n ${a_drives[3]} ]];then
vendor=${a_drives[3]}
if [[ -z ${a_drives[0]} ]];then
drive_id='N/A'
else
vendor='N/A'
drive_id="/dev/${a_drives[0]}"
fi
fi
if [[ $B_EXTRA_DATA == 'true' ]];then
if [[ -n ${a_drives[4]} ]];then
rev=${a_drives[4]}
else
rev='N/A'
drive_links=$( sed 's/~/,/g' <<< ${a_drives[1]} )
if [[ -z $drive_links ]];then
drive_links='N/A'
fi
rev=" ${C1}rev$SEP3${C2} $rev"
if [[ -n ${a_drives[2]} ]];then
vendor=${a_drives[2]}
if [[ -n ${a_drives[3]} ]];then
vendor="$vendor ${a_drives[3]}"
fi
fi
if [[ -z $vendor ]];then
if [[ -n ${a_drives[3]} ]];then
vendor=${a_drives[3]}
else
vendor='N/A'
fi
fi
if [[ $B_EXTRA_DATA == 'true' ]];then
if [[ -n ${a_drives[4]} ]];then
rev=${a_drives[4]}
else
rev='N/A'
fi
rev=" ${C1}rev$SEP3${C2} $rev"
fi
drive_string="$drive_id ${C1}model$SEP3${C2} $vendor$rev ${C1}dev-links$SEP3${C2} $drive_links"
fi
drive_data="${C1}Optical${counter}:${C2} $drive_id ${C1}model$SEP3${C2} $vendor$rev ${C1}dev-links$SEP3${C2} $drive_links"
drive_data="${C1}Optical${counter}:${C2} $drive_string"
drive_data=$( create_print_line "$Line_Starter" "$drive_data" )
print_screen_output "$drive_data"
Line_Starter=' '