added swpctl -l for bsd in -D, though -D doesn't work yet for bsds, but might as well.

This commit is contained in:
inxi-svn 2014-04-27 23:51:26 +00:00
parent fe09e772f6
commit 41087ac9a3

47
inxi
View file

@ -5424,6 +5424,22 @@ get_hdd_data_basic()
df_string="df -P -T --exclude-type=aufs --exclude-type=devfs --exclude-type=devtmpfs
--exclude-type=fdescfs --exclude-type=iso9660 --exclude-type=linprocfs --exclude-type=procfs
--exclude-type=squashfs --exclude-type=sysfs --exclude-type=tmpfs --exclude-type=unionfs $df_total"
if swapon -s &>/dev/null;then
swap_size=$( swapon -s 2>/dev/null | gawk '
BEGIN {
swapSize=0
total=0
}
( $2 == "partition" ) && ( $3 ~ /^[0-9]+$/ ) {
total += ( 1000 / 1024 ) * $3
}
END {
# result in kB, change to 1024 Byte blocks
total = total * 1000 / 1024
total = sprintf( "%.1f", total )
print total
}' )
fi
else
# default size is 512, , so use -k for 1024 -H only for size in human readable format
# older bsds don't support -T, pain, so we'll use partial output there
@ -5432,23 +5448,22 @@ get_hdd_data_basic()
else
df_string='df -k'
fi
if swapctl -l &>/dev/null;then
swap_size=$( swapctl -l 2>/dev/null | gawk '
BEGIN {
swapSize=0
total=0
}
( $1 ~ /^\/dev/ ) && ( $2 ~ /^[0-9]+$/ ) {
total += $2
}
END {
# result in blocks already
print total
}' )
fi
fi
if swapon -s &>/dev/null;then
swap_size=$( swapon -s 2>/dev/null | gawk '
BEGIN {
swapSize=0
total=0
}
( $2 == "partition" ) && ( $3 ~ /^[0-9]+$/ ) {
total += ( 1000 / 1024 ) * $3
}
END {
# result in kB, change to 1024 Byte blocks
total = total * 1000 / 1024
total = sprintf( "%.1f", total )
print total
}' )
fi
# echo ss: $swap_size
hdd_data="$( eval $df_string )"
# eval $df_string | awk 'BEGIN{tot=0} !/total/ {tot+=$4} END{print tot}'