From cb7c18ac1d7ee4c1426ff17c1f94c426792c9603 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Sat, 18 Jun 2011 18:49:42 +0000 Subject: [PATCH] replaced xargs -l with a for loop, sigh... --- inxi | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/inxi b/inxi index f5c1a8a..a8c9ffc 100755 --- a/inxi +++ b/inxi @@ -3,7 +3,7 @@ #### Script Name: inxi #### version: 1.7.0 #### Date: June 17 2011 -#### Patch Number: 02 +#### Patch Number: 03 ######################################################################## #### SPECIAL THANKS ######################################################################## @@ -4503,11 +4503,24 @@ 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 separator='' linked='' disk='' item_string='' proc_info_string='' + 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 # 0 - true dev path, ie, sr0, hdc @@ -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