mirror of
https://github.com/smxi/inxi.git
synced 2024-11-16 16:21:39 +00:00
Trying a fix for special case where hard disk doesn't actually divide by 16, no idea why
This commit is contained in:
parent
cbe7e922a6
commit
0b4058277c
8
inxi
8
inxi
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### version: 0.4.13
|
#### version: 0.4.14
|
||||||
#### Date: November 8 2008
|
#### Date: November 8 2008
|
||||||
########################################################################
|
########################################################################
|
||||||
#### inxi is a fork of infobash, the original bash sys info script by locsmif
|
#### inxi is a fork of infobash, the original bash sys info script by locsmif
|
||||||
|
@ -1177,14 +1177,16 @@ get_hdd_data_basic()
|
||||||
# final item is the total of the disk
|
# final item is the total of the disk
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
A_HDD_DATA=( $( gawk -v hddused="$hdd_used" '
|
A_HDD_DATA=( $( gawk -v hddused="$hdd_used" '
|
||||||
/[hs]d[a-x]$/ {
|
/[hs]d[a-z]$/ {
|
||||||
driveSize = $(NF - 1)*1024/1000**3
|
driveSize = $(NF - 1)*1024/1000**3
|
||||||
gsub(/,/, " ", driveSize)
|
gsub(/,/, " ", driveSize)
|
||||||
gsub(/^ +| +$/, "", driveSize)
|
gsub(/^ +| +$/, "", driveSize)
|
||||||
printf( $NF",%.1fGB,,\n", driveSize )
|
printf( $NF",%.1fGB,,\n", driveSize )
|
||||||
}
|
}
|
||||||
# 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
|
||||||
|
$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