bug fix for label/uuid for root, that was trickier than I realized

This commit is contained in:
inxi-svn 2009-02-07 07:48:35 +00:00
parent 76ebd9af44
commit 7086344a26

55
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash
########################################################################
#### Script Name: inxi
#### version: 0.10.2
#### version: 0.10.3
#### Date: 6 February 2009
########################################################################
#### SPECIAL THANKS
@ -2443,43 +2443,34 @@ get_partition_data_advanced()
# then if dev data/uuid is incomplete, try to get missing piece
# it's more likely we'll get a uuid than a label. But this should get the
# dev item set no matter what, so then we can get the label too
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 [[ -z $dev_item && -n $dev_label ]] && [[ -n $dev_disk_label ]];then
dev_item=$( echo "$dev_disk_label" | gawk '
# dev item set no matter what, so then we can get the rest of any missing data
# first we'll get the dev_item if it's missing
if [[ -n $dev_disk_uuid ]] && [[ -z $dev_item && -n $dev_uuid ]];then
dev_item=$( echo "$dev_disk_label" | gawk '
/'$dev_label'/ {
item=gensub( /..\/..\/(.+)/, "\\1", 1, $NF )
print item
}' )
elif [[ -n $dev_disk_label ]] && [[ -z $dev_item && -n $dev_label ]]
dev_item=$( echo "$dev_disk_label" | gawk '
/'$dev_label'/ {
item=gensub( /..\/..\/(.+)/, "\\1", 1, $NF )
print item
}' )
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
dev_label=$( echo "$dev_disk_label" | gawk '
/'$dev_item'$/ {
print $(NF - 2)
}' )
elif [[ -z $dev_item && -n $dev_label ]];then
dev_item=$( echo "$dev_disk_label" | gawk '
/'$dev_label'/ {
item=gensub( /..\/..\/(.+)/, "\\1", 1, $NF )
print item
}' )
fi
if [[ -n $dev_disk_uuid ]] && [[ -n $dev_item && -z $dev_uuid ]];then
dev_uuid=$( echo "$dev_disk_uuid" | gawk '
/'$dev_item'$/ {
print $(NF - 2)
}' )
if
if [[ -n $dev_disk_label ]] && [[ -n $dev_item && -z $dev_label ]];then
dev_label=$( echo "$dev_disk_label" | gawk '
/'$dev_item'/ {
item=gensub( /..\/..\/(.+)/, "\\1", 1, $NF )
print item
}' )
fi
# assemble everything we could get for dev/h/dx, label, and uuid