Fix shell scripts. (#1179)

There were various mistakes in the shell scripts, such as lack of
quoting; they would break them immediately e.g. if `BIN_DIR` contained a space.

Pointed out by `shellcheck`.
This commit is contained in:
Niklas Hambüchen 2021-07-20 08:43:27 +02:00 committed by GitHub
parent fef5337a64
commit 2d413129a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 16 deletions

View File

@ -1,10 +1,10 @@
#!/bin/sh #!/bin/sh
set -e set -e
if [[ "$1" = 'run' ]]; then if [ "$1" = 'run' ]; then
exec /app/bin/plausible start exec /app/bin/plausible start
elif [[ "$1" = 'db' ]]; then elif [ "$1" = 'db' ]; then
exec /app/"$2".sh exec /app/"$2".sh
else else
exec "$@" exec "$@"

View File

@ -23,10 +23,10 @@ function docker_build_image() {
/kaniko/executor \ /kaniko/executor \
--cache=true \ --cache=true \
--context ${CI_PROJECT_DIR} \ --context "${CI_PROJECT_DIR}" \
--dockerfile ${CI_PROJECT_DIR}/Dockerfile \ --dockerfile "${CI_PROJECT_DIR}"/Dockerfile \
--destination ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA} \ --destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}" \
--destination ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}-latest \ --destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}-latest" \
\ \
"$@" "$@"

View File

@ -2,6 +2,6 @@
# Creates the database if needed # Creates the database if needed
BIN_DIR=`dirname "$0"` BIN_DIR=$(dirname "$0")
${BIN_DIR}/bin/plausible eval Plausible.Release.createdb "${BIN_DIR}"/bin/plausible eval Plausible.Release.createdb

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# Create an admin user # Create an admin user
BIN_DIR=`dirname "$0"` BIN_DIR=$(dirname "$0")
${BIN_DIR}/bin/plausible eval Plausible.Release.init_admin "${BIN_DIR}"/bin/plausible eval Plausible.Release.init_admin

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# starts the db migration # starts the db migration
BIN_DIR=`dirname "$0"` BIN_DIR=$(dirname "$0")
${BIN_DIR}/bin/plausible eval Plausible.Release.migrate "${BIN_DIR}"/bin/plausible eval Plausible.Release.migrate

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
BIN_DIR=`dirname "$0"` BIN_DIR=$(dirname "$0")
${BIN_DIR}/bin/plausible eval Plausible.Release.rollback "${BIN_DIR}"/bin/plausible eval Plausible.Release.rollback

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
BIN_DIR=`dirname "$0"` BIN_DIR=$(dirname "$0")
${BIN_DIR}/bin/plausible eval Plausible.Release.seed "${BIN_DIR}"/bin/plausible eval Plausible.Release.seed