style: update warnings/errors for insufficient RAM allocation

This commit is contained in:
Martin Wimpress 2024-06-25 11:40:45 +01:00 committed by Martin Wimpress
parent 24a2a7b413
commit a4860869ee
1 changed files with 6 additions and 6 deletions

View File

@ -555,6 +555,7 @@ function configure_cpu() {
} }
function configure_ram() { function configure_ram() {
local OS_PRETTY_NAME=""
RAM_VM="2G" RAM_VM="2G"
if [ -z "${ram}" ]; then if [ -z "${ram}" ]; then
local RAM_HOST="" local RAM_HOST=""
@ -581,23 +582,22 @@ function configure_ram() {
case "${guest_os}" in case "${guest_os}" in
windows|windows-server) windows|windows-server)
os_pretty_name="Windows" OS_PRETTY_NAME="Windows"
min_ram="4" min_ram="4"
;; ;;
macos) macos)
os_pretty_name="macOS" OS_PRETTY_NAME="macOS"
min_ram="8" min_ram="8"
;; ;;
esac esac
if [ -n "${min_ram}" ] && [ "${RAM_VM//G/}" -lt "${min_ram}" ]; then if [ -n "${min_ram}" ] && [ "${RAM_VM//G/}" -lt "${min_ram}" ]; then
if [ -z "${ram}" ]; then if [ -z "${ram}" ]; then
echo "ERROR! The guest virtual machine has been allocated insufficient RAM to run ${os_pretty_name}." echo "ERROR! The guest virtual machine has been allocated insufficient RAM to run ${OS_PRETTY_NAME}."
echo " You can override the guest RAM allocation by adding 'ram=4G' to ${VM}" echo " You can override the guest RAM allocation by adding 'ram=${min_ram}G' to ${VM}"
exit 1 exit 1
else else
echo "WARNING! The guest virtual machine has been allocated less than the recommended RAM to run ${os_pretty_name}." echo "WARNING! You have allocated less than the recommended ammount of RAM to run ${OS_PRETTY_NAME}."
echo " You have been warned."
fi fi
fi fi
} }