From 189a7eecc5c039bcd6e53c555d91bce8cd5d8b12 Mon Sep 17 00:00:00 2001 From: txtsd Date: Wed, 6 Apr 2022 18:04:23 +0530 Subject: [PATCH] chore: Use `cd ... || exit` in case cd fails --- clone.sh | 2 +- docker/entrypoint.sh | 2 +- status.sh | 2 +- update.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/clone.sh b/clone.sh index 50f52b9..b2780a0 100755 --- a/clone.sh +++ b/clone.sh @@ -1,7 +1,7 @@ #!/bin/bash BASEDIR=$(dirname "$0") -cd "${BASEDIR}" +cd "${BASEDIR}" || exit 1 BASEDIR=`pwd` source config.sh diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 5ea986c..d3ab4cf 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -2,7 +2,7 @@ echo "Launch args: $@" if [ "$1" == "update" ]; then - cd /app + cd /app || exit 1 exec su user -c "bash ./update.sh" elif [ "$1" == "cron" ]; then exec cron -f diff --git a/status.sh b/status.sh index 3beda64..fcc3cd2 100755 --- a/status.sh +++ b/status.sh @@ -1,7 +1,7 @@ #!/bin/bash BASEDIR=$(dirname "$0") -cd "${BASEDIR}" +cd "${BASEDIR}" || exit 1 BASEDIR=`pwd` source config.sh diff --git a/update.sh b/update.sh index 1526899..01eb5b6 100755 --- a/update.sh +++ b/update.sh @@ -1,7 +1,7 @@ #!/bin/bash BASEDIR=$(dirname "$0") -cd "${BASEDIR}" +cd "${BASEDIR}" || exit 1 BASEDIR=`pwd` set -x