new test for people

This commit is contained in:
inxi-svn 2009-01-09 02:17:35 +00:00
parent 1948f9df0e
commit 56df25f401

90
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash
########################################################################
#### Script Name: inxi
#### version: 0.9.3-b1-t2
#### version: 0.9.3-b1-t3
#### Date: January 8, 2009
########################################################################
#### SPECIAL THANKS
@ -1861,43 +1861,61 @@ get_hdd_data_basic()
{
local hdd_used=''
dfdata="Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hdc7 5289348 2811800 2208864 57% /
tmpfs 1037688 0 1037688 0% /lib/init/rw
udev 10240 116 10124 2% /dev
tmpfs 1037688 0 1037688 0% /dev/shm
/dev/hdc8 8420132 4218360 3774044 53% /home
/dev/hdc5 32981408 20955204 12026204 64% /media/hd2
/dev/sdb1 390700768 188926868 201773900 49% /media/Snusmumrikken
/dev/sda1 732572000 248156936 484415064 34% /media/Mr. Big"
# hdd_used=$( df | gawk '
hdd_used=$( echo "$dfdata" | gawk '
/^\/dev\/(mapper\/|[hs]d[a-z][0-9]+)/ {
# this handles the case where the first item is too long
# and makes df wrap output to next line, so here we advance
# it to the next line for that single case
if ( NF == 1 ) {
getline
# dfdata="Filesystem 1K-blocks Used Available Use% Mounted on
# /dev/hdc7 5289348 2811800 2208864 57% /
# tmpfs 1037688 0 1037688 0% /lib/init/rw
# udev 10240 116 10124 2% /dev
# tmpfs 1037688 0 1037688 0% /dev/shm
# /dev/hdc8 8420132 4218360 3774044 53% /home
# /dev/hdc5 32981408 20955204 12026204 64% /media/hd2
# /dev/sdb1 390700768 188926868 201773900 49% /media/Snusmumrikken
# /dev/sda1 732572000 248156936 484415064 34% /media/Mr. Big"
# # hdd_used=$( df | gawk '
if [[ $B_TESTING_1 == 'true' ]];then
hdd_used=$( df | gawk '
/^\/dev\/(mapper\/|[hs]d[a-z][0-9]+)/ {
# this handles the case where the first item is too long
# and makes df wrap output to next line, so here we advance
# it to the next line for that single case
if ( NF == 1 ) {
getline
}
if ( $4 ~ /.*\%/ ) {
used += $2
}
else if ( $5 ~ /.*\%/ ) {
used += $3
}
else {
next
}
}
if ( $4 ~ /.*\%/ ) {
used += $2
available += $3
print "b: " $1
END {
print used
}' )
else
hdd_used=$( df | gawk '
p {
if (/^\/dev\/(mapper\/|[hs]d[a-z][0-9]+)/) {
if (NF == 1) {
getline
if (NF == 5) {
c += $2
}
else {
next
}
}
else if (NF == 6) {
c += $3
}
}
}
else if ( $5 ~ /.*\%/ ) {
used += $3
available += $4
print "a: " $1
}
else {
next
}
}
END {
print "used: " used
print "available: " available
}' )
/^Filesystem/ { p++ }
END {
print c
}' )
fi
if [[ -z $hdd_used ]];then
hdd_used='na'