diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index cf16dec..857a302 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,7 +1,12 @@ -#!/bin/sh +#!/bin/bash -[[ -n "$ZEITDL_UID" || -n "$ZEITDL_GID" ]] && chown_arg='-q' -if out=$(python ./zeit-dl "$ZEITDL_USER" "$ZEITDL_PASSWORD" ${ZEITDL_OPTIONS:=-o /data} $chown_arg); then - [[ -n "$ZEITDL_UID" ]] && chown $ZEITDL_UID "$out" - [[ -n "$ZEITDL_GID" ]] && chgrp $ZEITDL_GID "$out" +if [[ -n "$ZEITDL_UID" || -n "$ZEITDL_GID" ]]; then + echo "Running zeit-dl with --quiet to get output path for chown/chgrp..." + out=$(python ./zeit-dl "$ZEITDL_USER" "$ZEITDL_PASSWORD" ${ZEITDL_OPTIONS:=-o /data} --quiet) + if [[ -n "$out" ]]; then + [[ -n "$ZEITDL_UID" ]] && chown $ZEITDL_UID "$out" + [[ -n "$ZEITDL_GID" ]] && chgrp $ZEITDL_GID "$out" + fi +else + python ./zeit-dl "$ZEITDL_USER" "$ZEITDL_PASSWORD" ${ZEITDL_OPTIONS:=-o /data} fi