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

33
inxi
View file

@ -5424,15 +5424,6 @@ 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"
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
if df -k -T &>/dev/null;then
df_string='df -k -T'
else
df_string='df -k'
fi
fi
if swapon -s &>/dev/null;then
swap_size=$( swapon -s 2>/dev/null | gawk '
BEGIN {
@ -5449,6 +5440,30 @@ get_hdd_data_basic()
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
if df -k -T &>/dev/null;then
df_string='df -k -T'
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
# echo ss: $swap_size
hdd_data="$( eval $df_string )"
# eval $df_string | awk 'BEGIN{tot=0} !/total/ {tot+=$4} END{print tot}'