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

51
inxi
View file

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