bootstrap.sh 932 Bytes
Newer Older
1 2 3 4
#!/bin/bash
#########################################################
# This script is intended to be run like this:
#
5
#   wget https://.../bootstrap.sh | sudo bash
6 7 8
#
#########################################################

9 10 11
if [ -z "$TAG" ]; then
	TAG=14.08-beta
fi
12

13 14 15 16 17 18 19 20 21 22 23 24 25
# Are we running as root?
if [[ $EUID -ne 0 ]]; then
	echo "This script must be run as root. Did you leave out sudo?"
	exit
fi

# Go to root's home directory.
cd

# Clone the Mail-in-a-Box repository if it doesn't exist.
if [ ! -d mailinabox ]; then
	echo Downloading Mail-in-a-Box . . .
	apt-get -q -q install -y git
26
	git clone -q https://github.com/mail-in-a-box/mailinabox
27
	cd mailinabox
28
	git checkout -q $TAG
29 30 31

# If it does exist, update it.
else
32
	echo Updating Mail-in-a-Box to $TAG . . .
33
	cd mailinabox
34 35
	git fetch
	if ! git checkout -q $TAG; then
36 37 38 39 40 41 42
		echo "Update failed. Did you modify something in `pwd`?"
		exit
	fi
fi

# Start setup script.
setup/start.sh