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