feat(darwin): get host RAM for Darwin and make Linux result consistent
This commit is contained in:
parent
5515a9e7d7
commit
22d6932ce2
7
quickemu
7
quickemu
|
@ -341,8 +341,13 @@ configure_ram() {
|
||||||
RAM_VM="2G"
|
RAM_VM="2G"
|
||||||
if [ -z "${ram}" ]; then
|
if [ -z "${ram}" ]; then
|
||||||
local RAM_HOST=""
|
local RAM_HOST=""
|
||||||
|
if [ ${DARWIN} -eq 1 ]; then
|
||||||
|
RAM_HOST=$(($(sysctl -n hw.memsize) / (1048576*1024)))
|
||||||
|
else
|
||||||
# Determine the number of gigabytes of RAM in the host by extracting the first numerical value from the output.
|
# Determine the number of gigabytes of RAM in the host by extracting the first numerical value from the output.
|
||||||
RAM_HOST=$(free --giga | tr ' ' '\n' | grep -m 1 [0-9])
|
RAM_HOST=$(free --giga -h | tr ' ' '\n' | grep -m 1 [0-9] | cut -d'G' -f 1)
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${RAM_HOST}" -ge 128 ]; then
|
if [ "${RAM_HOST}" -ge 128 ]; then
|
||||||
RAM_VM="32G"
|
RAM_VM="32G"
|
||||||
elif [ "${RAM_HOST}" -ge 64 ]; then
|
elif [ "${RAM_HOST}" -ge 64 ]; then
|
||||||
|
|
Loading…
Reference in New Issue