diff --git a/README.md b/README.md index 08e9054..248a4e4 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ Certain values can be set via environment variables, using the `-e` parameter on * __TEMP_DIR__: Path where intermediary download files will be saved. Defaults to `/downloads` in the Docker image, and `.` otherwise. * Set this to an SSD or RAM filesystem (e.g., `tmpfs`) for better performance. * __Note__: Using a RAM filesystem may prevent downloads from being resumed. +* __CHOWN_DIRS__: If `false`, ownership of `DOWNLOAD_DIR`, `STATE_DIR`, and `TEMP_DIR` (and their contents) will not be set on container start. Ensure user under which MeTube runs has necessary access to these directories already. Defaults to `true`. ### 📝 File Naming & yt-dlp diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 7e4efea..7e0f4fa 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -9,8 +9,10 @@ if [ `id -u` -eq 0 ] && [ `id -g` -eq 0 ]; then if [ "${UID}" -eq 0 ]; then echo "Warning: it is not recommended to run as root user, please check your setting of the UID environment variable" fi - echo "Changing ownership of download and state directories to ${UID}:${GID}" - chown -R "${UID}":"${GID}" /app "${DOWNLOAD_DIR}" "${STATE_DIR}" "${TEMP_DIR}" + if [ "${CHOWN_DIRS:-true}" != "false" ]; then + echo "Changing ownership of download and state directories to ${UID}:${GID}" + chown -R "${UID}":"${GID}" /app "${DOWNLOAD_DIR}" "${STATE_DIR}" "${TEMP_DIR}" + fi echo "Running MeTube as user ${UID}:${GID}" exec su-exec "${UID}":"${GID}" python3 app/main.py else