refuse to start if the system has less than 768 MB of RAM, except when testing within Vagrant

This commit is contained in:
Joshua Tauberer 2014-07-16 08:25:54 -04:00
parent 4e5b5f2852
commit c716fd27bf
1 changed files with 13 additions and 0 deletions

View File

@ -16,6 +16,7 @@ fi
# Check system setup.
# Check that we are running on Ubuntu 14.04 LTS.
if [ "`lsb_release -d | sed 's/.*:\s*//'`" != "Ubuntu 14.04 LTS" ]; then
echo
echo "Mail-in-a-Box only supports being installed on Ubuntu 14.04, sorry. You are running:"
@ -26,6 +27,18 @@ if [ "`lsb_release -d | sed 's/.*:\s*//'`" != "Ubuntu 14.04 LTS" ]; then
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.
TOTAL_PHYSICAL_MEM=$(free -m | grep ^Mem: | sed "s/^Mem: *\([0-9]*\).*/\1/")
if [ $TOTAL_PHYSICAL_MEM -lt 768 ]; then
if [ ! -d /vagrant ]; then
echo
echo "Your Mail-in-a-Box needs more than $TOTAL_PHYSICAL_MEM MB RAM."
echo "Please provision a machine with at least 768 MB, 1 GB recommended."
exit
fi
fi
# Recall the last settings used if we're running this a second time.
if [ -f /etc/mailinabox.conf ]; then
# Run any system migrations before proceeding. Since this is a second run,