From ea07b261ad2a367833b33e367592bcc80a97c2d1 Mon Sep 17 00:00:00 2001 From: Aidan Stein Date: Sat, 9 Jul 2022 16:14:33 -0400 Subject: [PATCH] negate second `gosu` command when running as paperless user --- docker/docker-entrypoint.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index b68eeb409..921808f31 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -95,11 +95,7 @@ initialize() { done set -e - if [ $(id -u) == $(id -u paperless) ]; then - /sbin/docker-prepare.sh - else - gosu paperless /sbin/docker-prepare.sh - fi + ${gosu_cmd[@]} /sbin/docker-prepare.sh } install_languages() { @@ -141,6 +137,11 @@ install_languages() { echo "Paperless-ngx docker container starting..." +gosu_cmd=(gosu paperless) +if [ $(id -u) == $(id -u paperless) ]; then + gosu_cmd=() +fi + # Install additional languages if specified if [[ -n "$PAPERLESS_OCR_LANGUAGES" ]]; then install_languages "$PAPERLESS_OCR_LANGUAGES" @@ -150,7 +151,7 @@ initialize if [[ "$1" != "/"* ]]; then echo Executing management command "$@" - exec gosu paperless python3 manage.py "$@" + exec ${gosu_cmd[@]} python3 manage.py "$@" else echo Executing "$@" exec "$@"