This commit is contained in:
inxi-svn 2009-02-07 03:53:39 +00:00
parent 90ae73b2f4
commit 11eaced89f

44
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 0.10.2-b1-t2 #### version: 0.10.2-b1-t3
#### Date: 5 February 2009 #### Date: 5 February 2009
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
@ -2441,6 +2441,32 @@ get_partition_data_advanced()
dev_label=${a_partition_working[6]} dev_label=${a_partition_working[6]}
dev_uuid=${a_partition_working[7]} 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 # first if the dev data/label data is incomplete, try to get missing piece
if [[ -n "$dev_disk_label" ]];then if [[ -n "$dev_disk_label" ]];then
if [[ -n $dev_item && -z $dev_label ]];then if [[ -n $dev_item && -z $dev_label ]];then
@ -2456,21 +2482,7 @@ get_partition_data_advanced()
}' ) }' )
fi fi
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 # assemble everything we could get for dev/h/dx, label, and uuid
IFS="," 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 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