provision: Extract color codes into standard variables.

This uses the standard color codes we have in the Python
`zulip_tools` library.

Tweaked by tabbott to clean up some bugs.
This commit is contained in:
rht 2018-01-25 11:35:27 +00:00 committed by Tim Abbott
parent 60dd3a7223
commit e8a5f68980
1 changed files with 8 additions and 4 deletions

View File

@ -10,6 +10,10 @@ if [ "$EUID" -eq 0 ]; then
exit 1
fi
FAIL="\033[91m"
WARNING="\033[93m"
ENDC="\033[0m"
#Make the script independent of the location from where it is
#executed
PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P )
@ -26,23 +30,23 @@ export PYTHONUNBUFFERED=1
failed=${PIPESTATUS[0]}
if [ $failed = 1 ]; then
echo -e "\033[0;31m"
echo -e "$FAIL"
echo "Provisioning failed!"
echo
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"
echo -e "\033[0m"
echo -e "$ENDC"
exit 1
elif [ "$VIRTUAL_ENV" != "/srv/zulip-py3-venv" ] && [ -z "${TRAVIS}${SKIP_VENV_SHELL_WARNING}" ]; then
echo -e "\033[0;31m"
echo -e "$WARNING"
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"
echo -en "$ENDC"
fi
exit 0