Fix memory usage for all BSD distros we support
This commit is contained in:
parent
b379106e35
commit
987c67fdd5
1 changed files with 15 additions and 1 deletions
16
neofetch
16
neofetch
|
@ -1409,7 +1409,21 @@ getmemory () {
|
|||
;;
|
||||
|
||||
"BSD")
|
||||
memtotal=$(($(sysctl -n hw.physmem) / 1000))
|
||||
case "$distro" in
|
||||
"OpenBSD"*)
|
||||
memtotal=$(top -d 1 | awk -F ': |/| |M' '/Memory:/ {printf $4}')
|
||||
;;
|
||||
|
||||
"FreeBSD"* | "DragonFly"*)
|
||||
memtotal=$(dmesg | awk -F '\\(| ' '/real mem/ {printf $7}')
|
||||
;;
|
||||
|
||||
"NetBSD"*)
|
||||
memtotal=$(awk -F ':|kB' '/MemTotal:/ {printf $2}' /proc/meminfo)
|
||||
memtotal=$((memtotal / 1024))
|
||||
;;
|
||||
esac
|
||||
|
||||
memfree=$(($(vmstat | awk 'END{printf $4}') / 1000))
|
||||
memused=$((memtotal - ${memfree/M}))
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue