From 0b4058277c56cd0da6e9801a141aadf8f00eed7f Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Sat, 8 Nov 2008 22:14:56 +0000 Subject: [PATCH] Trying a fix for special case where hard disk doesn't actually divide by 16, no idea why --- inxi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/inxi b/inxi index f48928b..61b7b9a 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 0.4.13 +#### version: 0.4.14 #### Date: November 8 2008 ######################################################################## #### 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 IFS=$'\n' A_HDD_DATA=( $( gawk -v hddused="$hdd_used" ' - /[hs]d[a-x]$/ { + /[hs]d[a-z]$/ { driveSize = $(NF - 1)*1024/1000**3 gsub(/,/, " ", driveSize) gsub(/^ +| +$/, "", driveSize) printf( $NF",%.1fGB,,\n", driveSize ) } # 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 { size = size*1024/1000**3 # calculate size in GB size workingUsed = hddused*1024/1000**3 # calculate workingUsed in GB used