From eefa0d00e8c54511d95b15ebdaef3be69f40de7f Mon Sep 17 00:00:00 2001 From: the-sane <3657071+the-sane@users.noreply.github.com> Date: Mon, 22 Jan 2024 16:05:54 -0500 Subject: [PATCH] Round memory checks to whole numbers to fix integer errors --- lug-helper.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lug-helper.sh b/lug-helper.sh index 097c7ac..3388881 100755 --- a/lug-helper.sh +++ b/lug-helper.sh @@ -917,10 +917,10 @@ memory_check() { swaptotal="$(($swaptotal * 1024))" combtotal="$(($memtotal + $swaptotal))" - # Convert to GiB - memtotal="$(numfmt --to=iec-i --suffix="B" "$memtotal")" - swaptotal="$(numfmt --to=iec-i --suffix="B" "$swaptotal")" - combtotal="$(numfmt --to=iec-i --suffix="B" "$combtotal")" + # Convert to whole number GiB + memtotal="$(numfmt --to=iec-i --format="%.0f" --suffix="B" "$memtotal")" + swaptotal="$(numfmt --to=iec-i --format="%.0f" --suffix="B" "$swaptotal")" + combtotal="$(numfmt --to=iec-i --format="%.0f" --suffix="B" "$combtotal")" if [ "${memtotal: -3}" != "GiB" ] || [ "${memtotal::-3}" -lt "$memory_required" ]; then # Minimum requirements are not met