mirror of
https://github.com/the-sane/lug-helper.git
synced 2024-12-26 17:54:18 +00:00
Round memory checks to whole numbers to fix integer errors
This commit is contained in:
parent
e7c7ad5cba
commit
eefa0d00e8
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user