version upgrade

some optimizations, code fixes, handled failed xargs -l case for optical disks
This commit is contained in:
inxi-svn 2011-06-18 19:27:41 +00:00
parent f02a64561c
commit 1635966093

20
inxi
View file

@ -1,9 +1,9 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 1.7.0 #### version: 1.7.1
#### Date: June 17 2011 #### Date: June 17 2011
#### Patch Number: 05 #### Patch Number: 00
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
######################################################################## ########################################################################
@ -4504,21 +4504,23 @@ get_optical_drive_data()
{ {
eval $LOGFS eval $LOGFS
local temp_array='' sys_uevent_path='' proc_cdrom='' link_list='' dev_disks_real='' local temp_array='' sys_uevent_path='' proc_cdrom='' link_list=''
local separator='' linked='' disk='' item_string='' proc_info_string='' local separator='' linked='' disk='' item_string='' proc_info_string=''
local dev_disks_links="$( ls /dev/dvd* /dev/cd* /dev/scd* 2>/dev/null )" local dev_disks_links="$( ls /dev/dvd* /dev/cd* /dev/scd* 2>/dev/null )"
# get the actual disk dev location, first try default which is easier to run # get the actual disk dev location, first try default which is easier to run, need to preserve line breaks
dev_disks_real="$( echo "$dev_disks_links" | xargs -l readlink 2>/dev/null | sort -u )" local dev_disks_real="$( echo "$dev_disks_links" | xargs -l readlink 2>/dev/null | sort -u )"
# Some systems don't support xargs -l so we need to do it manually # Some systems don't support xargs -l so we need to do it manually
if [[ -z $dev_disks_real ]];then if [[ -z $dev_disks_real ]];then
for linked in $dev_disks_links for linked in $dev_disks_links
do do
disk=$( readlink $linked 2>/dev/null ) disk=$( readlink $linked 2>/dev/null )
if [[ -n $disk ]] && [[ -z $dev_disks_real || -z $( grep $disk <<< $dev_disks_real ) ]];then if [[ -n $disk ]];then
disk=$( basename $disk ) # puppy shows this as /dev/sr0, not sr0 disk=$( basename $disk ) # puppy shows this as /dev/sr0, not sr0
# need line break IFS for below, no white space if [[ -z $dev_disks_real || -z $( grep $disk <<< $dev_disks_real ) ]];then
dev_disks_real="$dev_disks_real$separator$disk" # need line break IFS for below, no white space
separator=$'\n' dev_disks_real="$dev_disks_real$separator$disk"
separator=$'\n'
fi
fi fi
done done
dev_disks_real="$( sort -u <<< "$dev_disks_real" )" dev_disks_real="$( sort -u <<< "$dev_disks_real" )"