mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
fixed bug with space in user partition names in hard disk size
This commit is contained in:
parent
7006e1a062
commit
1b19321e2c
43
inxi
43
inxi
|
@ -1,8 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### version: 0.9.3
|
#### version: 0.9.4
|
||||||
#### Date: January 6, 2009
|
#### Date: January 8, 2009
|
||||||
########################################################################
|
########################################################################
|
||||||
#### SPECIAL THANKS
|
#### SPECIAL THANKS
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -1862,25 +1862,28 @@ get_hdd_data_basic()
|
||||||
local hdd_used=''
|
local hdd_used=''
|
||||||
|
|
||||||
hdd_used=$( df | gawk '
|
hdd_used=$( df | gawk '
|
||||||
p {
|
/^\/dev\/(mapper\/|[hs]d[a-z][0-9]+)/ {
|
||||||
if (/^\/dev\/(mapper\/|[hs]d[a-z][0-9]+)/) {
|
# this handles the case where the first item is too long
|
||||||
if (NF == 1) {
|
# and makes df wrap output to next line, so here we advance
|
||||||
getline
|
# it to the next line for that single case
|
||||||
if (NF == 5) {
|
if ( NF == 1 ) {
|
||||||
c += $2
|
getline
|
||||||
}
|
}
|
||||||
else {
|
# if the first item caused a wrap, use one less than standard
|
||||||
next
|
if ( $4 ~ /.*\%/ ) {
|
||||||
}
|
used += $2
|
||||||
}
|
}
|
||||||
else if (NF == 6) {
|
# otherwise use standard
|
||||||
c += $3
|
else if ( $5 ~ /.*\%/ ) {
|
||||||
}
|
used += $3
|
||||||
|
}
|
||||||
|
# and if this is not detected, give up, we need user data to debug
|
||||||
|
else {
|
||||||
|
next
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/^Filesystem/ { p++ }
|
|
||||||
END {
|
END {
|
||||||
print c
|
print used
|
||||||
}' )
|
}' )
|
||||||
|
|
||||||
if [[ -z $hdd_used ]];then
|
if [[ -z $hdd_used ]];then
|
||||||
|
@ -1903,7 +1906,9 @@ get_hdd_data_basic()
|
||||||
# See http://lanana.org/docs/device-list/devices-2.6+.txt for major numbers used below
|
# See http://lanana.org/docs/device-list/devices-2.6+.txt for major numbers used below
|
||||||
# $1 ~ /^(3|22|33|8)$/ && $2 % 16 == 0 {size+=$3}
|
# $1 ~ /^(3|22|33|8)$/ && $2 % 16 == 0 {size+=$3}
|
||||||
# special case from this data: 8 0 156290904 sda
|
# special case from this data: 8 0 156290904 sda
|
||||||
$1 ~ /^(3|22|33|8)$/ && $NF ~ /[hs]d[a-z]$/ && ( $2 % 16 == 0 || $2 % 16 == 8 ) {size+=$3}
|
$1 ~ /^(3|22|33|8)$/ && $NF ~ /[hs]d[a-z]$/ && ( $2 % 16 == 0 || $2 % 16 == 8 ) {
|
||||||
|
size += $3
|
||||||
|
}
|
||||||
END {
|
END {
|
||||||
size = size*1024/1000**3 # calculate size in GB size
|
size = size*1024/1000**3 # calculate size in GB size
|
||||||
workingUsed = hddused*1024/1000**3 # calculate workingUsed in GB used
|
workingUsed = hddused*1024/1000**3 # calculate workingUsed in GB used
|
||||||
|
|
Loading…
Reference in a new issue