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 <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg 2018-08-03 00:14:49 +00:00 committed by Tim Abbott
parent d7c7e8dd7c
commit c669626666
1 changed files with 6 additions and 5 deletions

View File

@ -10,13 +10,13 @@ if [ "$EUID" -eq 0 ]; then
exit 1 exit 1
fi fi
FAIL="\033[91m" FAIL='\033[91m'
WARNING="\033[93m" WARNING='\033[93m'
ENDC="\033[0m" ENDC='\033[0m'
#Make the script independent of the location from where it is #Make the script independent of the location from where it is
#executed #executed
PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P ) PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
cd "$PARENT_PATH" cd "$PARENT_PATH"
mkdir -p ../var/log mkdir -p ../var/log
LOG_PATH="../var/log/provision.log" LOG_PATH="../var/log/provision.log"
@ -29,7 +29,7 @@ export PYTHONUNBUFFERED=1
./lib/provision.py "$@" 2>&1 | tee -a "$LOG_PATH" ./lib/provision.py "$@" 2>&1 | tee -a "$LOG_PATH"
failed=${PIPESTATUS[0]} failed=${PIPESTATUS[0]}
if [ $failed = 1 ]; then if [ "$failed" = 1 ]; then
echo -e "$FAIL" echo -e "$FAIL"
echo "Provisioning failed!" echo "Provisioning failed!"
echo echo
@ -46,6 +46,7 @@ elif [ "$VIRTUAL_ENV" != "/srv/zulip-py3-venv" ] && [ -z "${TRAVIS}${SKIP_VENV_S
echo echo
echo "To update the shell, run:" echo "To update the shell, run:"
echo " source /srv/zulip-py3-venv/bin/activate" 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 'or just close this shell and start a new one (with Vagrant, `vagrant ssh`).'
echo -en "$ENDC" echo -en "$ENDC"
fi fi