From 42143726b02f0426eb770ca1eeac8261af60897a Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 19 May 2024 23:40:40 +0200 Subject: [PATCH] Update config.sh --- src/config.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/config.sh b/src/config.sh index bece9f9..394a1dd 100644 --- a/src/config.sh +++ b/src/config.sh @@ -34,16 +34,20 @@ fi # Check available memory as the very last step -RAM_AVAIL=$(free -b | grep -m 1 Mem: | awk '{print $7}') -AVAIL_GB=$(( (RAM_AVAIL + 1073741823)/1073741824 )) +if [[ "$RAM_CHECK" != [Nn]* ]]; then -if (( (RAM_WANTED + 500000000) > RAM_AVAIL )); then - error "Your configured RAM_SIZE of $WANTED_GB GB is higher than the $AVAIL_GB GB of memory available, please set a lower value." - exit 17 -fi + RAM_AVAIL=$(free -b | grep -m 1 Mem: | awk '{print $7}') + AVAIL_GB=$(( RAM_AVAIL/1073741824 )) + + if (( (RAM_WANTED + RAM_SPARE) > RAM_AVAIL )); then + error "Your configured RAM_SIZE of $WANTED_GB GB is too high for the $AVAIL_GB GB of memory available, please set a lower value." + exit 17 + fi + + if (( (RAM_WANTED + (RAM_SPARE * 3)) > RAM_AVAIL )); then + warn "your configured RAM_SIZE of $WANTED_GB GB is very close to the $AVAIL_GB GB of memory available, please consider a lower value." + fi -if (( (RAM_WANTED + 1450000000) > RAM_AVAIL )); then - warn "your configured RAM_SIZE of $WANTED_GB GB is much too close to the $AVAIL_GB GB of memory available, please set a lower value." fi return 0