diff --git a/setup/preflight.sh b/setup/preflight.sh index be584221..90d36cc1 100644 --- a/setup/preflight.sh +++ b/setup/preflight.sh @@ -17,13 +17,19 @@ if [ "`lsb_release -d | sed 's/.*:\s*//' | sed 's/14\.04\.[0-9]/14.04/' `" != "U exit fi -# Check that we have enough memory. Skip the check if we appear to be -# running inside of Vagrant, because that's really just for testing. +# Check that we have enough memory. +# +# /proc/meminfo reports free memory in kibibytes. Our baseline will be 768 KB, +# which is 750000 kibibytes. +# +# Skip the check if we appear to be running inside of Vagrant, because that's really just for testing. TOTAL_PHYSICAL_MEM=$(head -n 1 /proc/meminfo | awk '{print $2}') -if [ $TOTAL_PHYSICAL_MEM -lt 786432 ]; then +if [ $TOTAL_PHYSICAL_MEM -lt 750000 ]; then if [ ! -d /vagrant ]; then - echo "Your Mail-in-a-Box needs more than $TOTAL_PHYSICAL_MEM MB RAM." + TOTAL_PHYSICAL_MEM=$(expr \( \( $TOTAL_PHYSICAL_MEM \* 1024 \) / 1000 \) / 1000) + echo "Your Mail-in-a-Box needs more memory (RAM) to function properly." echo "Please provision a machine with at least 768 MB, 1 GB recommended." + echo "This machine has $TOTAL_PHYSICAL_MEM MB memory." exit fi fi