From 9962e8661addaf95146371bb4f9c09d2dc4f50d1 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Sat, 18 Jun 2011 19:09:31 +0000 Subject: [PATCH] patch four, that should do it --- inxi | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/inxi b/inxi index a8c9ffc..0eb4d3a 100755 --- a/inxi +++ b/inxi @@ -3,7 +3,7 @@ #### Script Name: inxi #### version: 1.7.0 #### Date: June 17 2011 -#### Patch Number: 03 +#### Patch Number: 04 ######################################################################## #### SPECIAL THANKS ######################################################################## @@ -4506,20 +4506,25 @@ get_optical_drive_data() 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='' + 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 )" + # 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 + # need line break IFS for below, no white space + dev_disks_real="$dev_disks_real$separator$disk" + separator=$'\n' + fi + done + dev_disks_real="$( sort -u <<< "$dev_disks_real" )" + linked='' + disk='' + separator='' + fi # 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 @@ -4540,7 +4545,6 @@ $disk" # 14 - state if [[ -n $dev_disks_real ]];then - # 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