From 11eaced89ff4bba119bd7a1217080773e2f46728 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Sat, 7 Feb 2009 03:53:39 +0000 Subject: [PATCH] --- inxi | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/inxi b/inxi index b29c139..7a48614 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 0.10.2-b1-t2 +#### version: 0.10.2-b1-t3 #### Date: 5 February 2009 ######################################################################## #### SPECIAL THANKS @@ -2441,6 +2441,32 @@ get_partition_data_advanced() dev_label=${a_partition_working[6]} dev_uuid=${a_partition_working[7]} + # then if dev data/uuid is incomplete, try to get missing piece + # it's more likely we'll get a uuid than a label. + if [[ -n "$dev_disk_uuid" ]];then + if [[ -n $dev_item && -z $dev_uuid ]];then + dev_uuid=$( echo "$dev_disk_uuid" | gawk ' + /'$dev_item'$/ { + print $(NF - 2) + }' ) + elif [[ -z $dev_item && -n $dev_uuid ]];then + dev_item=$( echo "$dev_disk_uuid" | gawk ' + /'$dev_uuid'/ { + item=gensub( /..\/..\/(.+)/, "\\1", 1, $NF ) + print item + }' ) + # last chance, if nothing found, check with uuid + elif [[ -n "$dev_disk_label" ]];then + if [[ -z $dev_item && -n $dev_label ]];then + dev_item=$( echo "$dev_disk_label" | gawk ' + /'$dev_label'/ { + item=gensub( /..\/..\/(.+)/, "\\1", 1, $NF ) + print item + }' ) + fi + fi + fi + # first if the dev data/label data is incomplete, try to get missing piece if [[ -n "$dev_disk_label" ]];then if [[ -n $dev_item && -z $dev_label ]];then @@ -2456,21 +2482,7 @@ get_partition_data_advanced() }' ) fi fi - # then if dev data/uuid is incomplete, try to get missing piece - if [[ -n "$dev_disk_uuid" ]];then - if [[ -n $dev_item && -z $dev_uuid ]];then - dev_uuid=$( echo "$dev_disk_uuid" | gawk ' - /'$dev_item'$/ { - print $(NF - 2) - }' ) - elif [[ -z $dev_item && -n $dev_uuid ]];then - dev_item=$( echo "$dev_disk_uuid" | gawk ' - /'$dev_uuid'/ { - item=gensub( /..\/..\/(.+)/, "\\1", 1, $NF ) - print item - }' ) - fi - fi + # assemble everything we could get for dev/h/dx, label, and uuid IFS="," A_PARTITION_DATA[i]=${a_partition_working[0]}","${a_partition_working[1]}","${a_partition_working[2]}","${a_partition_working[3]}","${a_partition_working[4]}","$dev_item","$dev_label","$dev_uuid