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

View File

@ -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
(