From c4d5a5a3ddb114a7df7a25b1009d2c73f9f77746 Mon Sep 17 00:00:00 2001 From: the-sane <3657071+the-sane@users.noreply.github.com> Date: Tue, 21 Mar 2023 22:10:11 -0400 Subject: [PATCH] awk can't always be trusted for math (mawk bad) --- lug-helper.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lug-helper.sh b/lug-helper.sh index 16e341f..989b737 100755 --- a/lug-helper.sh +++ b/lug-helper.sh @@ -901,9 +901,11 @@ winetricks_check() { # Check system memory and swap space memory_check() { - # Get totals in bytes - memtotal="$(LC_NUMERIC=C awk '/MemTotal/ {printf $2*1024}' /proc/meminfo)" - swaptotal="$(LC_NUMERIC=C awk '/SwapTotal/ {printf $2*1024}' /proc/meminfo)" + # Get totals in KB + memtotal="$(LC_NUMERIC=C awk '/MemTotal/ {printf $2}' /proc/meminfo)" + swaptotal="$(LC_NUMERIC=C awk '/SwapTotal/ {printf $2}' /proc/meminfo)" + memtotal="$(($memtotal * 1024))" + swaptotal="$(($swaptotal * 1024))" combtotal="$(($memtotal + $swaptotal))" # Convert to GiB