Fix memory size detection on Haiku

This commit is contained in:
Izaya
2018-07-13 05:03:57 +10:00
committed by GitHub
parent 7820d905a4
commit 444bb80fcb

View File

@@ -1706,8 +1706,8 @@ detectmem () {
usedmem=$((used_mem / 1024))
fi
elif [ "$distro" == "Haiku" ]; then
totalmem=$(( $(sysinfo -mem | head -n1 | cut -d'/' -f3 | tr -d ' ' | tr -d ')') / 1024^2 ))
usedmem=$(( $(sysinfo -mem | head -n1 | cut -d'/' -f2 | sed 's/max//; s/ //g') / 1024^2 ))
totalmem=$(( $(sysinfo -mem | head -n1 | cut -d'/' -f3 | tr -d ' ' | tr -d ')') / 1024**2 ))
usedmem=$(( $(sysinfo -mem | head -n1 | cut -d'/' -f2 | sed 's/max//; s/ //g') / 1024**2 ))
else
# MemUsed = Memtotal + Shmem - MemFree - Buffers - Cached - SReclaimable
# Source: https://github.com/dylanaraps/neofetch/pull/391/files#diff-e863270127ca6116fd30e708cdc582fc