From b01f0eb22fe10cb5c9e23f2ca54383a3774a305f Mon Sep 17 00:00:00 2001 From: Dylan Date: Mon, 18 Jan 2016 17:17:32 +1100 Subject: [PATCH] Fixed memory usage on OpenBSD --- fetch | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/fetch b/fetch index 7d973b34..b6ae44a6 100755 --- a/fetch +++ b/fetch @@ -472,7 +472,6 @@ getpackages () { "FreeBSD") packages=$(pkg info | wc -l) - packages=${packages// } ;; *"BSD") @@ -487,6 +486,8 @@ getpackages () { packages="Unknown" ;; esac + + packages=${packages// } } # Get shell @@ -627,11 +628,22 @@ getmemory () { memory="${memused}MB / ${memtotal}MB" ;; + "FreeBSD") + memtotal=$(dmesg | awk '/real mem/ {printf $5}') + memtotal=${memtotal/\(/} + memtotal=${memtotal/)MB/} + memfree=$(top -d 1 | awk '/Mem:/ {print $10}') + memfree=${memfree/M/} + memused=$((memtotal - memfree)) + + memory="${memused}MB / ${memtotal}MB" + ;; + *"BSD") memtotal=$(dmesg | awk '/real mem/ {printf $5}') memtotal=${memtotal/\(/} memtotal=${memtotal/)MB/} - memfree=$(top -d1 | awk '/Mem:/ {print $10}') + memfree=$(top -d 1 | awk '/Real:/ {print $4}') memfree=${memfree/M/} memused=$((memtotal - memfree))