branch one, trying another fix for duplicated mount points for disk use

This commit is contained in:
inxi-svn 2013-06-14 21:58:33 +00:00
parent 0351d39c60
commit 8e765a8be8

15
inxi
View file

@ -3,7 +3,7 @@
#### Script Name: inxi #### Script Name: inxi
#### Version: 1.9.8 #### Version: 1.9.8
#### Date: June 14 2013 #### Date: June 14 2013
#### Patch Number: 05-b1 #### Patch Number: 06-b1
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
######################################################################## ########################################################################
@ -4996,6 +4996,8 @@ get_hdd_data_basic()
# is present. The value is searched for an earlier appearance of that partition and if it is # is present. The value is searched for an earlier appearance of that partition and if it is
# present, the data is not added into the partition used size. # present, the data is not added into the partition used size.
partitionsSet="" partitionsSet=""
# this handles a case where the same dev item is mounted twice to different points
devSet=""
} }
# using $1, not $2, because older bsd df do not have -T, filesystem type # using $1, not $2, because older bsd df do not have -T, filesystem type
( bsdType != "" ) && $1 ~ /^(aufs|devfs|devtmpfs|fdescfs|iso9660|linprocfs|procfs|squashfs|sysfs|tmpfs|type|unionfs)$/ { ( bsdType != "" ) && $1 ~ /^(aufs|devfs|devtmpfs|fdescfs|iso9660|linprocfs|procfs|squashfs|sysfs|tmpfs|type|unionfs)$/ {
@ -5010,24 +5012,31 @@ get_hdd_data_basic()
# it to the next line for that single case. Using df -P should # it to the next line for that single case. Using df -P should
# make this unneeded but leave it in just in case # make this unneeded but leave it in just in case
if ( NF < 6 && $0 !~ /.*%/ ) { if ( NF < 6 && $0 !~ /.*%/ ) {
devSet = devSet "~" $1 "~"
getline getline
} }
# if the first item caused a wrap, use one less than standard # if the first item caused a wrap, use one less than standard
# testing for the field with % in it, ie: 34%, then go down from there # testing for the field with % in it, ie: 34%, then go down from there
# this also protects against cases where the mount point has a space in the # this also protects against cases where the mount point has a space in the
# file name, thus breaking going down from $NF directly. # file name, thus breaking going down from $NF directly.
if ( $5 ~ /.*%/ ) { # some bsds will also have only 6 items
if ( $5 ~ /.*%/ && devSet !~ /.*~$1~.*/ ) {
if ( partitionsSet !~ /.*~$6~.*/ ) { if ( partitionsSet !~ /.*~$6~.*/ ) {
used += $3 used += $3
} }
partitionsSet = partitionsSet "~" $6 "~" partitionsSet = partitionsSet "~" $6 "~"
# make sure to only include bsd real lines here, ie, short df output
if ( $1 ~ /\/dev\// ) {
devSet = devSet "~" $1 "~"
}
} }
# otherwise use standard # otherwise use standard
else if ( $6 ~ /.*%/ ) { else if ( $6 ~ /.*%/ ) {
if ( partitionsSet !~ /.*~$7~.*/ ) { if ( partitionsSet !~ /.*~$7~.*/ && devSet !~ /.*~$1~.*/ ) {
used += $4 used += $4
} }
partitionsSet = partitionsSet "~" $7 "~" partitionsSet = partitionsSet "~" $7 "~"
devSet = devSet "~" $1 "~"
} }
# and if this is not detected, give up, we need user data to debug # and if this is not detected, give up, we need user data to debug
else { else {