From a7701168a187cde0a2c8cadd01104dcf8a598aeb Mon Sep 17 00:00:00 2001 From: Leon Haag-Fank Date: Fri, 5 Apr 2024 13:04:14 +0200 Subject: [PATCH] better scriptability and chown behaviour --- docker-entrypoint.sh | 7 +++++-- zeit-dl | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index cbeca19..38764ee 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,4 +1,7 @@ #!/bin/sh -python ./zeit-dl "$ZEITDL_USER" "$ZEITDL_PASSWORD" ${ZEITDL_OPTIONS:=-o /data} -chown -R $UID:$GID /data +[[ -n "$CHOWN_UID" || -n "$CHOWN_GID" ]] && chown_arg='-q' +if out=$(python ./zeit-dl "$ZEITDL_USER" "$ZEITDL_PASSWORD" ${ZEITDL_OPTIONS:=-o /data} $chown_arg) then + [[ -n "$CHOWN_UID" ]] && chown $CHOWN_UID "$out" + [[ -n "$CHOWN_GID" ]] && chgrp $CHOWN_GID "$out" +fi diff --git a/zeit-dl b/zeit-dl index 26faa27..8368e8e 100755 --- a/zeit-dl +++ b/zeit-dl @@ -104,7 +104,7 @@ def download(page, args): file = page.context.request.get(url) if file.headers['content-type'] != 'text/html': if args.quiet: - print(filename) + print(filepath) else: log('Downloading {}...'.format(filename), args=args) with open(filepath, 'wb') as f: