mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-09-05 21:47:57 +00:00
Compute percentage memory sizes with integer arithmetic (#4252)
Co-authored-by: LCB <me@lbellows.com>
This commit is contained in:
@@ -513,11 +513,15 @@ elif [[ ${TYPE} == "CURSEFORGE" ]]; then
|
||||
|
||||
if isPercentage "$INIT_MEMORY" || isPercentage "$MAX_MEMORY"; then
|
||||
# Convert to bytes
|
||||
NORM_INIT_MEM=$(normalizeMemSize "$INIT_MEMORY")
|
||||
NORM_MAX_MEM=$(normalizeMemSize "$MAX_MEMORY")
|
||||
# Convert to MB
|
||||
((NORM_INIT_MEM*=1048576))
|
||||
((NORM_MAX_MEM*=1048576))
|
||||
if ! NORM_INIT_MEM=$(normalizeMemSize "$INIT_MEMORY"); then
|
||||
exit 1
|
||||
fi
|
||||
if ! NORM_MAX_MEM=$(normalizeMemSize "$MAX_MEMORY"); then
|
||||
exit 1
|
||||
fi
|
||||
# Convert bytes to MB
|
||||
((NORM_INIT_MEM/=1048576))
|
||||
((NORM_MAX_MEM/=1048576))
|
||||
|
||||
cat > "${FTB_DIR}/settings-local.sh" <<EOF
|
||||
export MIN_RAM="${NORM_INIT_MEM}M"
|
||||
|
||||
Reference in New Issue
Block a user