(change version)

Found and fixed a small bug with / label detection in cases where root is mounted by uuid, now it works again
This commit is contained in:
inxi-svn 2009-02-07 03:58:32 +00:00
parent b383f601e4
commit 76ebd9af44

47
inxi
View file

@ -1,8 +1,8 @@
#!/bin/bash
########################################################################
#### Script Name: inxi
#### version: 0.10.1
#### Date: 5 February 2009
#### version: 0.10.2
#### Date: 6 February 2009
########################################################################
#### SPECIAL THANKS
########################################################################
@ -2410,7 +2410,7 @@ get_partition_data_advanced()
if ( partTemp ~ /[hs]d[a-z][0-9]/ ) {
partition=gensub( /^(\/dev\/)(.+)$/, "\\2", 1, partTemp )
}
else if ( partTemp ~ /by-uuid\/[a-z0-9]+-[a-z0-9]+-[a-z0-9]+/ ) {
else if ( partTemp ~ /by-uuid/ ) {
uuid=gensub( /^(\/dev\/disk\/by-uuid\/)(.+)$/, "\\2", 1, partTemp )
}
else if ( partTemp ~ /by-label/ ) {
@ -2441,6 +2441,31 @@ 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. 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_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
@ -2456,21 +2481,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