Skip to content

Commit 10b6807

Browse files
authored
fix: system requirements bug (#4407)
* fix: added missing variable physmemtotalgb * fix: compare RAM requirement to system's available RAM allow numbers with decimal points to be compared
1 parent 4b4c559 commit 10b6807

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lgsm/modules/check_system_requirements.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fi
6363

6464
# If the game or engine has a minimum RAM Requirement, compare it to system's available RAM.
6565
if [ "${ramrequirementgb}" ]; then
66-
if [ "${physmemtotalgb}" -lt "${ramrequirementgb}" ]; then
66+
if (($(echo "${physmemtotalgb} < ${ramrequirementgb}" | bc -l))); then
6767
fn_print_dots "Checking RAM"
6868
fn_print_warn_nl "Checking RAM: ${ramrequirementgb}G required, ${physmemtotal} available"
6969
echo "* ${gamename} server may fail to run or experience poor performance."

lgsm/modules/info_distro.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,16 @@ else
195195
else
196196
humanreadable="-h"
197197
fi
198-
physmemtotalmb="$(free -m | awk '/Mem:/ {print $2}')" # string
198+
physmemtotalmb="$(free -m | awk '/Mem:/ {print $2}')" # integer
199+
physmemtotalgb="$(free -m | awk '/Mem:/ {print $2}')" # integer
199200
physmemtotal="$(free ${humanreadable} | awk '/Mem:/ {print $2}')" # string
200201
physmemfree="$(free ${humanreadable} | awk '/Mem:/ {print $4}')" # string
201202
physmemused="$(free ${humanreadable} | awk '/Mem:/ {print $3}')" # string
202203

203204
oldfree="$(free ${humanreadable} | awk '/cache:/')"
204205
if [ "${oldfree}" ]; then
205-
physmemavailable="n/a"
206-
physmemcached="n/a"
206+
physmemavailable="n/a" # string
207+
physmemcached="n/a" # string
207208
else
208209
physmemavailable="$(free ${humanreadable} | awk '/Mem:/ {print $7}')" # string
209210
physmemcached="$(free ${humanreadable} | awk '/Mem:/ {print $6}')" # string

0 commit comments

Comments
 (0)