From f3fce0fda2ed9b268adddb5f432e11f9a977a876 Mon Sep 17 00:00:00 2001 From: Sebastian Neuser Date: Tue, 17 Jun 2025 14:19:10 +0200 Subject: [PATCH] impr(entrypoint): Fix / disable shellcheck warnings Signed-off-by: Sebastian Neuser --- 29/apache/entrypoint.sh | 12 ++++++++---- 29/fpm-alpine/entrypoint.sh | 12 ++++++++---- 29/fpm/entrypoint.sh | 12 ++++++++---- 30/apache/entrypoint.sh | 12 ++++++++---- 30/fpm-alpine/entrypoint.sh | 12 ++++++++---- 30/fpm/entrypoint.sh | 12 ++++++++---- 31/apache/entrypoint.sh | 12 ++++++++---- 31/fpm-alpine/entrypoint.sh | 12 ++++++++---- 31/fpm/entrypoint.sh | 12 ++++++++---- docker-entrypoint.sh | 12 ++++++++---- 10 files changed, 80 insertions(+), 40 deletions(-) diff --git a/29/apache/entrypoint.sh b/29/apache/entrypoint.sh index 3bb57f1f..9fb5c971 100755 --- a/29/apache/entrypoint.sh +++ b/29/apache/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -eu # version_greater A B returns whether A > B @@ -67,8 +67,10 @@ file_env() { local var="$1" local fileVar="${var}_FILE" local def="${2:-}" - local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") - local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + local varValue + local fileVarValue + varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then echo >&2 "error: both $var and $fileVar are set (but are exclusive)" exit 1 @@ -80,7 +82,6 @@ file_env() { elif [ -n "${def}" ]; then export "$var"="$def" fi - unset "$fileVar" } if expr "$1" : "apache" 1>/dev/null; then @@ -186,12 +187,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP rsync_options="-rlD" fi + # shellcheck disable=SC2086 rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/ for dir in config data custom_apps themes; do if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then + # shellcheck disable=SC2086 rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/ fi done + # shellcheck disable=SC2086 rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/ # Install diff --git a/29/fpm-alpine/entrypoint.sh b/29/fpm-alpine/entrypoint.sh index 3bb57f1f..9fb5c971 100755 --- a/29/fpm-alpine/entrypoint.sh +++ b/29/fpm-alpine/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -eu # version_greater A B returns whether A > B @@ -67,8 +67,10 @@ file_env() { local var="$1" local fileVar="${var}_FILE" local def="${2:-}" - local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") - local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + local varValue + local fileVarValue + varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then echo >&2 "error: both $var and $fileVar are set (but are exclusive)" exit 1 @@ -80,7 +82,6 @@ file_env() { elif [ -n "${def}" ]; then export "$var"="$def" fi - unset "$fileVar" } if expr "$1" : "apache" 1>/dev/null; then @@ -186,12 +187,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP rsync_options="-rlD" fi + # shellcheck disable=SC2086 rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/ for dir in config data custom_apps themes; do if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then + # shellcheck disable=SC2086 rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/ fi done + # shellcheck disable=SC2086 rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/ # Install diff --git a/29/fpm/entrypoint.sh b/29/fpm/entrypoint.sh index 3bb57f1f..9fb5c971 100755 --- a/29/fpm/entrypoint.sh +++ b/29/fpm/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -eu # version_greater A B returns whether A > B @@ -67,8 +67,10 @@ file_env() { local var="$1" local fileVar="${var}_FILE" local def="${2:-}" - local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") - local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + local varValue + local fileVarValue + varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then echo >&2 "error: both $var and $fileVar are set (but are exclusive)" exit 1 @@ -80,7 +82,6 @@ file_env() { elif [ -n "${def}" ]; then export "$var"="$def" fi - unset "$fileVar" } if expr "$1" : "apache" 1>/dev/null; then @@ -186,12 +187,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP rsync_options="-rlD" fi + # shellcheck disable=SC2086 rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/ for dir in config data custom_apps themes; do if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then + # shellcheck disable=SC2086 rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/ fi done + # shellcheck disable=SC2086 rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/ # Install diff --git a/30/apache/entrypoint.sh b/30/apache/entrypoint.sh index 3bb57f1f..9fb5c971 100755 --- a/30/apache/entrypoint.sh +++ b/30/apache/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -eu # version_greater A B returns whether A > B @@ -67,8 +67,10 @@ file_env() { local var="$1" local fileVar="${var}_FILE" local def="${2:-}" - local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") - local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + local varValue + local fileVarValue + varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then echo >&2 "error: both $var and $fileVar are set (but are exclusive)" exit 1 @@ -80,7 +82,6 @@ file_env() { elif [ -n "${def}" ]; then export "$var"="$def" fi - unset "$fileVar" } if expr "$1" : "apache" 1>/dev/null; then @@ -186,12 +187,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP rsync_options="-rlD" fi + # shellcheck disable=SC2086 rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/ for dir in config data custom_apps themes; do if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then + # shellcheck disable=SC2086 rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/ fi done + # shellcheck disable=SC2086 rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/ # Install diff --git a/30/fpm-alpine/entrypoint.sh b/30/fpm-alpine/entrypoint.sh index 3bb57f1f..9fb5c971 100755 --- a/30/fpm-alpine/entrypoint.sh +++ b/30/fpm-alpine/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -eu # version_greater A B returns whether A > B @@ -67,8 +67,10 @@ file_env() { local var="$1" local fileVar="${var}_FILE" local def="${2:-}" - local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") - local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + local varValue + local fileVarValue + varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then echo >&2 "error: both $var and $fileVar are set (but are exclusive)" exit 1 @@ -80,7 +82,6 @@ file_env() { elif [ -n "${def}" ]; then export "$var"="$def" fi - unset "$fileVar" } if expr "$1" : "apache" 1>/dev/null; then @@ -186,12 +187,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP rsync_options="-rlD" fi + # shellcheck disable=SC2086 rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/ for dir in config data custom_apps themes; do if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then + # shellcheck disable=SC2086 rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/ fi done + # shellcheck disable=SC2086 rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/ # Install diff --git a/30/fpm/entrypoint.sh b/30/fpm/entrypoint.sh index 3bb57f1f..9fb5c971 100755 --- a/30/fpm/entrypoint.sh +++ b/30/fpm/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -eu # version_greater A B returns whether A > B @@ -67,8 +67,10 @@ file_env() { local var="$1" local fileVar="${var}_FILE" local def="${2:-}" - local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") - local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + local varValue + local fileVarValue + varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then echo >&2 "error: both $var and $fileVar are set (but are exclusive)" exit 1 @@ -80,7 +82,6 @@ file_env() { elif [ -n "${def}" ]; then export "$var"="$def" fi - unset "$fileVar" } if expr "$1" : "apache" 1>/dev/null; then @@ -186,12 +187,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP rsync_options="-rlD" fi + # shellcheck disable=SC2086 rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/ for dir in config data custom_apps themes; do if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then + # shellcheck disable=SC2086 rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/ fi done + # shellcheck disable=SC2086 rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/ # Install diff --git a/31/apache/entrypoint.sh b/31/apache/entrypoint.sh index 3bb57f1f..9fb5c971 100755 --- a/31/apache/entrypoint.sh +++ b/31/apache/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -eu # version_greater A B returns whether A > B @@ -67,8 +67,10 @@ file_env() { local var="$1" local fileVar="${var}_FILE" local def="${2:-}" - local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") - local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + local varValue + local fileVarValue + varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then echo >&2 "error: both $var and $fileVar are set (but are exclusive)" exit 1 @@ -80,7 +82,6 @@ file_env() { elif [ -n "${def}" ]; then export "$var"="$def" fi - unset "$fileVar" } if expr "$1" : "apache" 1>/dev/null; then @@ -186,12 +187,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP rsync_options="-rlD" fi + # shellcheck disable=SC2086 rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/ for dir in config data custom_apps themes; do if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then + # shellcheck disable=SC2086 rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/ fi done + # shellcheck disable=SC2086 rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/ # Install diff --git a/31/fpm-alpine/entrypoint.sh b/31/fpm-alpine/entrypoint.sh index 3bb57f1f..9fb5c971 100755 --- a/31/fpm-alpine/entrypoint.sh +++ b/31/fpm-alpine/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -eu # version_greater A B returns whether A > B @@ -67,8 +67,10 @@ file_env() { local var="$1" local fileVar="${var}_FILE" local def="${2:-}" - local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") - local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + local varValue + local fileVarValue + varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then echo >&2 "error: both $var and $fileVar are set (but are exclusive)" exit 1 @@ -80,7 +82,6 @@ file_env() { elif [ -n "${def}" ]; then export "$var"="$def" fi - unset "$fileVar" } if expr "$1" : "apache" 1>/dev/null; then @@ -186,12 +187,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP rsync_options="-rlD" fi + # shellcheck disable=SC2086 rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/ for dir in config data custom_apps themes; do if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then + # shellcheck disable=SC2086 rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/ fi done + # shellcheck disable=SC2086 rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/ # Install diff --git a/31/fpm/entrypoint.sh b/31/fpm/entrypoint.sh index 3bb57f1f..9fb5c971 100755 --- a/31/fpm/entrypoint.sh +++ b/31/fpm/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -eu # version_greater A B returns whether A > B @@ -67,8 +67,10 @@ file_env() { local var="$1" local fileVar="${var}_FILE" local def="${2:-}" - local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") - local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + local varValue + local fileVarValue + varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then echo >&2 "error: both $var and $fileVar are set (but are exclusive)" exit 1 @@ -80,7 +82,6 @@ file_env() { elif [ -n "${def}" ]; then export "$var"="$def" fi - unset "$fileVar" } if expr "$1" : "apache" 1>/dev/null; then @@ -186,12 +187,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP rsync_options="-rlD" fi + # shellcheck disable=SC2086 rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/ for dir in config data custom_apps themes; do if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then + # shellcheck disable=SC2086 rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/ fi done + # shellcheck disable=SC2086 rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/ # Install diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 3bb57f1f..9fb5c971 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -eu # version_greater A B returns whether A > B @@ -67,8 +67,10 @@ file_env() { local var="$1" local fileVar="${var}_FILE" local def="${2:-}" - local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") - local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + local varValue + local fileVarValue + varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then echo >&2 "error: both $var and $fileVar are set (but are exclusive)" exit 1 @@ -80,7 +82,6 @@ file_env() { elif [ -n "${def}" ]; then export "$var"="$def" fi - unset "$fileVar" } if expr "$1" : "apache" 1>/dev/null; then @@ -186,12 +187,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP rsync_options="-rlD" fi + # shellcheck disable=SC2086 rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/ for dir in config data custom_apps themes; do if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then + # shellcheck disable=SC2086 rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/ fi done + # shellcheck disable=SC2086 rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/ # Install