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

14
inxi
View file

@ -1,9 +1,9 @@
#!/bin/bash
########################################################################
#### Script Name: inxi
#### version: 1.7.0
#### version: 1.7.1
#### Date: June 17 2011
#### Patch Number: 05
#### Patch Number: 00
########################################################################
#### SPECIAL THANKS
########################################################################
@ -4504,22 +4504,24 @@ get_optical_drive_data()
{
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 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
dev_disks_real="$( echo "$dev_disks_links" | xargs -l readlink 2>/dev/null | sort -u )"
# get the actual disk dev location, first try default which is easier to run, need to preserve line breaks
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
if [[ -z $dev_disks_real ]];then
for linked in $dev_disks_links
do
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
if [[ -z $dev_disks_real || -z $( grep $disk <<< $dev_disks_real ) ]];then
# need line break IFS for below, no white space
dev_disks_real="$dev_disks_real$separator$disk"
separator=$'\n'
fi
fi
done
dev_disks_real="$( sort -u <<< "$dev_disks_real" )"
linked=''