From c66962666685222e4273a2aea7578f1af83c9214 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 3 Aug 2018 00:14:49 +0000 Subject: [PATCH] provision: Fix shellcheck warnings. In tools/provision line 13: FAIL="\033[91m" ^-- SC1117: Backslash is literal in "\0". Prefer explicit escaping: "\\0". In tools/provision line 14: WARNING="\033[93m" ^-- SC1117: Backslash is literal in "\0". Prefer explicit escaping: "\\0". In tools/provision line 15: ENDC="\033[0m" ^-- SC1117: Backslash is literal in "\0". Prefer explicit escaping: "\\0". In tools/provision line 19: PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P ) ^-- SC2128: Expanding an array without an index only gives the first element. In tools/provision line 32: if [ $failed = 1 ]; then ^-- SC2086: Double quote to prevent globbing and word splitting. In tools/provision line 49: echo 'or just close this shell and start a new one (with Vagrant, `vagrant ssh`).' ^-- SC2016: Expressions don't expand in single quotes, use double quotes for that. Signed-off-by: Anders Kaseorg --- tools/provision | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/provision b/tools/provision index 9d0abebee9..cafe4d7e42 100755 --- a/tools/provision +++ b/tools/provision @@ -10,13 +10,13 @@ if [ "$EUID" -eq 0 ]; then exit 1 fi -FAIL="\033[91m" -WARNING="\033[93m" -ENDC="\033[0m" +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 ) +PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) cd "$PARENT_PATH" mkdir -p ../var/log LOG_PATH="../var/log/provision.log" @@ -29,7 +29,7 @@ export PYTHONUNBUFFERED=1 ./lib/provision.py "$@" 2>&1 | tee -a "$LOG_PATH" failed=${PIPESTATUS[0]} -if [ $failed = 1 ]; then +if [ "$failed" = 1 ]; then echo -e "$FAIL" echo "Provisioning failed!" echo @@ -46,6 +46,7 @@ elif [ "$VIRTUAL_ENV" != "/srv/zulip-py3-venv" ] && [ -z "${TRAVIS}${SKIP_VENV_S echo echo "To update the shell, run:" echo " source /srv/zulip-py3-venv/bin/activate" + # shellcheck disable=SC2016 echo 'or just close this shell and start a new one (with Vagrant, `vagrant ssh`).' echo -en "$ENDC" fi