replaced xargs -l with a for loop, sigh...

This commit is contained in:
inxi-svn 2011-06-18 18:49:42 +00:00
parent 9884ebab24
commit cb7c18ac1d

23
inxi
View file

@ -3,7 +3,7 @@
#### Script Name: inxi
#### version: 1.7.0
#### Date: June 17 2011
#### Patch Number: 02
#### Patch Number: 03
########################################################################
#### SPECIAL THANKS
########################################################################
@ -4503,10 +4503,23 @@ get_networking_local_ip_data()
get_optical_drive_data()
{
eval $LOGFS
# get the actual disk dev location:
local dev_disks_real=$( ls /dev/dvd* /dev/cd* /dev/scd* 2>/dev/null | xargs -l readlink | sort -u )
local temp_array='' dev_disks_links='' sys_uevent_path='' proc_cdrom='' link_list=''
local temp_array='' sys_uevent_path='' proc_cdrom='' link_list='' dev_disks_real=''
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: can't use this because some systems don't support xargs -l
# ls /dev/dvd* /dev/cd* /dev/scd* 2>/dev/null | xargs -l readlink | sort -u
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
# need line break IFS for below
dev_disks_real="$dev_disks_real
$disk"
fi
done
linked=''
disk=''
# A_OPTICAL_DRIVE_DATA indexes: not going to use all these, but it's just as easy to build the full
# data array and use what we need from it as to update it later to add features or items
@ -4527,7 +4540,7 @@ get_optical_drive_data()
# 14 - state
if [[ -n $dev_disks_real ]];then
dev_disks_links=$( ls /dev/dvd* /dev/cd* /dev/scd* 2>/dev/null )
# dev_disks_links=$( ls /dev/dvd* /dev/cd* /dev/scd* 2>/dev/null )
if [[ $B_SHOW_FULL_OPTICAL == 'true' ]];then
proc_cdrom="$( cat /proc/sys/dev/cdrom/info 2>/dev/null )"
fi