Round up host RAM. Closes #11

Avoid "integer expression expected" errors when host RAM enumeration returns a floating point value.

  * https://github.com/wimpysworld/quickemu/issues/11
This commit is contained in:
Martin Wimpress 2020-03-22 15:10:13 +00:00
parent fb082f1079
commit 142eac3001
No known key found for this signature in database
GPG Key ID: 61DF940515E06DA3
1 changed files with 2 additions and 0 deletions

View File

@ -199,6 +199,8 @@ function vm_boot() {
local RAM_VM="2G"
local RAM_HOST=$(free --mega -h | grep Mem | cut -d':' -f2 | cut -d'G' -f1 | sed 's/ //g')
#Round up - https://github.com/wimpysworld/quickemu/issues/11
RAM_HOST=$(printf '%.*f\n' 0 ${RAM_HOST})
if [ ${RAM_HOST} -ge 64 ]; then
RAM_VM="4G"
elif [ ${RAM_HOST} -ge 16 ]; then