From e8a5f689802f4bb1c6f5d1835840756a8863287b Mon Sep 17 00:00:00 2001 From: rht Date: Thu, 25 Jan 2018 11:35:27 +0000 Subject: [PATCH] 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. --- tools/provision | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/provision b/tools/provision index fabb76afb3..44f6a3a921 100755 --- a/tools/provision +++ b/tools/provision @@ -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