From e495eaa33938c9f46c3a90f94a7773e077cb2f6b Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 3 Aug 2018 00:14:47 +0000 Subject: [PATCH] postgres-init-db: Fix shellcheck warnings. In scripts/setup/postgres-init-db line 12: records=`su "$POSTGRES_USER" -c "psql -Atc 'SELECT COUNT(*) FROM zulip.zerver_message;' zulip" | cat` ^-- SC2006: Use $(..) instead of legacy `..`. In scripts/setup/postgres-init-db line 35: source "$(dirname "$0")/terminate-psql-sessions" postgres zulip zulip_base ^-- SC1090: Can't follow non-constant source. Use a directive to specify location. Signed-off-by: Anders Kaseorg --- scripts/setup/postgres-init-db | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/setup/postgres-init-db b/scripts/setup/postgres-init-db index 104e2b76b1..70bece6e8f 100755 --- a/scripts/setup/postgres-init-db +++ b/scripts/setup/postgres-init-db @@ -9,7 +9,7 @@ POSTGRES_USER="${POSTGRES_USER:-postgres}" # We have to do this because on production database zulip may not exist, so psql # will fail with return code 2. Because set -e is on, this will cause the script # to bail. -records=`su "$POSTGRES_USER" -c "psql -Atc 'SELECT COUNT(*) FROM zulip.zerver_message;' zulip" | cat` +records=$(su "$POSTGRES_USER" -c "psql -Atc 'SELECT COUNT(*) FROM zulip.zerver_message;' zulip" | cat) if [[ $records -gt 200 ]] then @@ -32,6 +32,7 @@ fi # Drop any open connections to any old database. Hackishly call using # `source`, because postgres user may not be able to read this directory # if unpacked by root. +# shellcheck source=/dev/null source "$(dirname "$0")/terminate-psql-sessions" postgres zulip zulip_base (