2014-08-25 12:09:37 +00:00
|
|
|
# Are we running as root?
|
|
|
|
if [[ $EUID -ne 0 ]]; then
|
|
|
|
echo "This script must be run as root. Please re-run like this:"
|
|
|
|
echo
|
2014-09-21 20:56:28 +00:00
|
|
|
echo "sudo $0"
|
2014-08-25 12:09:37 +00:00
|
|
|
echo
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check that we are running on Ubuntu 14.04 LTS (or 14.04.xx).
|
|
|
|
if [ "`lsb_release -d | sed 's/.*:\s*//' | sed 's/14\.04\.[0-9]/14.04/' `" != "Ubuntu 14.04 LTS" ]; then
|
|
|
|
echo "Mail-in-a-Box only supports being installed on Ubuntu 14.04, sorry. You are running:"
|
|
|
|
echo
|
|
|
|
lsb_release -d | sed 's/.*:\s*//'
|
|
|
|
echo
|
|
|
|
echo "We can't write scripts that run on every possible setup, sorry."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2015-01-11 14:09:21 +00:00
|
|
|
# Check that we have enough memory.
|
|
|
|
#
|
2016-10-15 19:41:25 +00:00
|
|
|
# /proc/meminfo reports free memory in kibibytes. Our baseline will be 512 MB,
|
|
|
|
# which is 500000 kibibytes.
|
|
|
|
#
|
|
|
|
# We will display a warning if the memory is below 768 MB which is 750000 kibibytes
|
2015-01-11 14:09:21 +00:00
|
|
|
#
|
|
|
|
# Skip the check if we appear to be running inside of Vagrant, because that's really just for testing.
|
2014-08-25 21:36:55 +00:00
|
|
|
TOTAL_PHYSICAL_MEM=$(head -n 1 /proc/meminfo | awk '{print $2}')
|
2016-10-15 19:41:25 +00:00
|
|
|
if [ $TOTAL_PHYSICAL_MEM -lt 500000 ]; then
|
2014-08-25 12:09:37 +00:00
|
|
|
if [ ! -d /vagrant ]; then
|
2015-01-11 14:09:21 +00:00
|
|
|
TOTAL_PHYSICAL_MEM=$(expr \( \( $TOTAL_PHYSICAL_MEM \* 1024 \) / 1000 \) / 1000)
|
|
|
|
echo "Your Mail-in-a-Box needs more memory (RAM) to function properly."
|
2016-10-15 19:41:25 +00:00
|
|
|
echo "Please provision a machine with at least 512 MB, 1 GB recommended."
|
2015-01-11 14:09:21 +00:00
|
|
|
echo "This machine has $TOTAL_PHYSICAL_MEM MB memory."
|
2014-08-25 12:09:37 +00:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
fi
|
2016-10-15 19:41:25 +00:00
|
|
|
if [ $TOTAL_PHYSICAL_MEM -lt 750000 ]; then
|
|
|
|
echo "WARNING: Your Mail-in-a-Box has less than 768 MB of memory."
|
|
|
|
echo " It might run unreliably when under heavy load."
|
|
|
|
fi
|
2016-02-21 17:43:04 +00:00
|
|
|
|
2016-02-21 17:47:09 +00:00
|
|
|
# Check that tempfs is mounted with exec
|
2016-02-21 17:43:04 +00:00
|
|
|
MOUNTED_TMP_AS_NO_EXEC=$(grep "/tmp.*noexec" /proc/mounts)
|
|
|
|
if [ -n "$MOUNTED_TMP_AS_NO_EXEC" ]; then
|
|
|
|
echo "Mail-in-a-Box has to have exec rights on /tmp, please mount /tmp with exec"
|
|
|
|
exit
|
|
|
|
fi
|
2016-03-11 14:10:31 +00:00
|
|
|
|
|
|
|
# Check that no .wgetrc exists
|
|
|
|
if [ -e ~/.wgetrc ]; then
|
2016-03-11 14:14:37 +00:00
|
|
|
echo "Mail-in-a-Box expects no overrides to wget defaults, ~/.wgetrc exists"
|
2016-03-11 14:10:31 +00:00
|
|
|
exit
|
|
|
|
fi
|
2016-03-14 06:00:33 +00:00
|
|
|
|
2016-07-29 13:07:16 +00:00
|
|
|
# Check that we are running on x86_64 or i686, any other architecture is unsupported and
|
2016-03-14 06:00:33 +00:00
|
|
|
# will fail later in the setup when we try to install the custom build lucene packages.
|
|
|
|
#
|
|
|
|
# Set ARM=1 to ignore this check if you have built the packages yourself. If you do this
|
|
|
|
# you are on your own!
|
|
|
|
ARCHITECTURE=$(uname -m)
|
2016-07-29 13:07:16 +00:00
|
|
|
if [ "$ARCHITECTURE" != "x86_64" ] && [ "$ARCHITECTURE" != "i686" ]; then
|
2016-03-14 06:00:33 +00:00
|
|
|
if [ -z "$ARM" ]; then
|
2016-07-29 13:07:16 +00:00
|
|
|
echo "Mail-in-a-Box only supports x86_64 or i686 and will not work on any other architecture, like ARM."
|
2016-03-14 06:00:33 +00:00
|
|
|
echo "Your architecture is $ARCHITECTURE"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
fi
|