diff --git a/Containers/mastercontainer/start.sh b/Containers/mastercontainer/start.sh index c36331fe..6ded5bfd 100755 --- a/Containers/mastercontainer/start.sh +++ b/Containers/mastercontainer/start.sh @@ -40,9 +40,10 @@ if ! docker info &>/dev/null; then exit 1 fi API_VERSION_FILE="$(find ./ -name DockerActionManager.php | head -1)" -API_VERSION="$(grep -oP 'const API_VERSION.*\;' "$API_VERSION_FILE" | grep -oP [0-9]+.[0-9]+ | head -1)" +API_VERSION="$(grep -oP 'const API_VERSION.*\;' "$API_VERSION_FILE" | grep -oP '[0-9]+.[0-9]+' | head -1)" +# shellcheck disable=SC2001 API_VERSION_NUMB="$(echo "$API_VERSION" | sed 's/\.//')" -LOCAL_API_VERSION_NUMB="$(docker version | grep -i "api version" | grep -oP [0-9]+.[0-9]+ | head -1 | sed 's/\.//')" +LOCAL_API_VERSION_NUMB="$(docker version | grep -i "api version" | grep -oP '[0-9]+.[0-9]+' | head -1 | sed 's/\.//')" if [ -n "$LOCAL_API_VERSION_NUMB" ] && [ -n "$API_VERSION_NUMB" ]; then if ! [ "$LOCAL_API_VERSION_NUMB" -ge "$API_VERSION_NUMB" ]; then echo "Docker v$API_VERSION is not supported by your docker engine. Cannot proceed." @@ -71,12 +72,12 @@ chown root:root -R /mnt/docker-aio-config/certs/ GENERATED_CERTS="/mnt/docker-aio-config/certs" TMP_CERTS="/etc/apache2/certs" mkdir -p "$GENERATED_CERTS" -cd "$GENERATED_CERTS" +cd "$GENERATED_CERTS" || exit 1 if ! [ -f ./ssl.crt ] && ! [ -f ./ssl.key ]; then openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 -subj "/C=DE/ST=BE/L=Local/O=Dev/CN=nextcloud.local" -keyout ./ssl.key -out ./ssl.crt fi if [ -f ./ssl.crt ] && [ -f ./ssl.key ]; then - cd "$TMP_CERTS" + cd "$TMP_CERTS" || exit 1 rm ./ssl.crt rm ./ssl.key cp "$GENERATED_CERTS/ssl.crt" ./ diff --git a/Containers/nextcloud/entrypoint.sh b/Containers/nextcloud/entrypoint.sh index 6d5d34d5..2e830078 100644 --- a/Containers/nextcloud/entrypoint.sh +++ b/Containers/nextcloud/entrypoint.sh @@ -50,7 +50,8 @@ if ! [ -f "/mnt/ncdata/skip.update" ]; then NEXT_MAJOR="$((INSTALLED_MAJOR + 1))" curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/latest-${NEXT_MAJOR}.tar.bz2" curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/latest-${NEXT_MAJOR}.tar.bz2.asc" - export GNUPGHOME="$(mktemp -d)" + GNUPGHOME="$(mktemp -d)" + export GNUPGHOME # gpg key from https://nextcloud.com/nextcloud.asc gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 diff --git a/Containers/nextcloud/start.sh b/Containers/nextcloud/start.sh index 33171688..10ac59c4 100644 --- a/Containers/nextcloud/start.sh +++ b/Containers/nextcloud/start.sh @@ -12,7 +12,8 @@ if ! bash /entrypoint.sh; then fi # Correctly set CPU_ARCH for notify_push -export CPU_ARCH="$(uname -m)" +CPU_ARCH="$(uname -m)" +export CPU_ARCH if [ -z "$CPU_ARCH" ]; then echo "Could not get processor architecture. Exiting." exit 1 diff --git a/Containers/postgresql/start.sh b/Containers/postgresql/start.sh index 20db843b..1044e294 100644 --- a/Containers/postgresql/start.sh +++ b/Containers/postgresql/start.sh @@ -19,6 +19,7 @@ if ! [ -w "$DUMP_DIR" ]; then fi # Test if some things match +# shellcheck disable=SC2235 if ( [ -f "$DATADIR/PG_VERSION" ] && [ "$PG_MAJOR" != "$(cat "$DATADIR/PG_VERSION")" ] ) \ || ( ! [ -f "$DATADIR/PG_VERSION" ] && [ -f "$DUMP_FILE" ] ); then # The DUMP_file must be provided @@ -41,7 +42,7 @@ if ( [ -f "$DATADIR/PG_VERSION" ] && [ "$PG_MAJOR" != "$(cat "$DATADIR/PG_VERSIO set -e # Remove old database files - rm -rf "$DATADIR/"* + rm -rf "${DATADIR:?}/"* # Change database port to a random port temporarily export PGPORT=11000 @@ -69,7 +70,7 @@ fi # Cover the last case if ! [ -f "$DATADIR/PG_VERSION" ] && ! [ -f "$DUMP_FILE" ]; then # Remove old database files if somehow there should be some - rm -rf "$DATADIR/"* + rm -rf "${DATADIR:?}/"* fi # Catch docker stop attempts