2017-01-14 11:19:26 +01:00
|
|
|
#!/bin/bash
|
2017-01-19 01:42:04 +01:00
|
|
|
|
|
|
|
# Use this script to provision dependencies for your Zulip installation.
|
|
|
|
# This script is idempotent, so it can be restarted at any time, and it
|
|
|
|
# will usually run fairly quickly when your dependencies are up to date.
|
|
|
|
|
2017-01-14 11:19:26 +01:00
|
|
|
set -e
|
|
|
|
if [ "$EUID" -eq 0 ]; then
|
|
|
|
echo "Error: The provision script must not be run as root" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
#Make the script independent of the location from where it is
|
|
|
|
#executed
|
|
|
|
PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P )
|
|
|
|
cd "$PARENT_PATH"
|
|
|
|
mkdir -p ../var/log
|
|
|
|
LOG_PATH="../var/log/provision.log"
|
|
|
|
|
|
|
|
echo "PROVISIONING STARTING." >> $LOG_PATH
|
|
|
|
|
2017-01-17 23:23:59 +01:00
|
|
|
# PYTHONUNBUFFERED is important to ensure that tracebacks don't get
|
|
|
|
# lost far above where they should be in the output.
|
|
|
|
export PYTHONUNBUFFERED=1
|
2017-08-09 00:35:03 +02:00
|
|
|
python3 ./lib/provision.py "$@" 2>&1 | tee -a "$LOG_PATH"
|
2017-01-14 11:19:26 +01:00
|
|
|
failed=${PIPESTATUS[0]}
|
|
|
|
|
|
|
|
if [ $failed = 1 ]; then
|
|
|
|
echo -e "\033[0;31m"
|
|
|
|
echo "Provisioning failed!"
|
|
|
|
echo
|
2017-01-19 01:42:04 +01:00
|
|
|
echo "* Look at the traceback(s) above to find more about the errors."
|
|
|
|
echo "* Resolve the errors or get help on chat."
|
|
|
|
echo "* If you can fix this yourself, you can re-run tools/provision at any time."
|
|
|
|
echo "* Logs are here: zulip/var/log/provision.log"
|
2017-01-14 11:19:26 +01:00
|
|
|
echo -e "\033[0m"
|
|
|
|
exit 1
|
2017-05-11 13:59:07 +02:00
|
|
|
elif [ "$VIRTUAL_ENV" != "/srv/zulip-py3-venv" ] && [ -z "$TRAVIS" ]; then
|
|
|
|
echo -e "\033[0;31m"
|
|
|
|
echo "WARNING: This shell does not have the Python 3 virtualenv activated."
|
|
|
|
echo "Zulip commands will fail."
|
|
|
|
echo
|
|
|
|
echo "To update the shell, run:"
|
|
|
|
echo " source /srv/zulip-py3-venv/bin/activate"
|
|
|
|
echo "or just close this shell and start a new one."
|
|
|
|
echo -en "\033[0m"
|
2017-01-14 11:19:26 +01:00
|
|
|
fi
|
|
|
|
exit 0
|