diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index 0794da5ae..fad0d20fe 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -28,7 +28,7 @@ initialize() { # Check for overrides of certain folders map_folders - for dir in ${DATA_DIR} ${DATA_DIR}/index ${MEDIA_ROOT_DIR} ${MEDIA_ROOT_DIR}/documents ${MEDIA_ROOT_DIR}/documents/originals ${MEDIA_ROOT_DIR}/documents/thumbnails; do + for dir in "${DATA_DIR}" "${DATA_DIR}/index" "${MEDIA_ROOT_DIR}" "${MEDIA_ROOT_DIR}/documents" "${MEDIA_ROOT_DIR}/documents/originals" "${MEDIA_ROOT_DIR}/documents/thumbnails"; do if [[ ! -d "${dir}" ]]; then echo "Creating directory ${dir}" mkdir "${dir}" @@ -42,7 +42,7 @@ initialize() { set +e echo "Adjusting permissions of paperless files. This may take a while." chown -R paperless:paperless ${tmp_dir} - for dir in ${DATA_DIR} ${MEDIA_ROOT_DIR}; do + for dir in "${DATA_DIR}" "${MEDIA_ROOT_DIR}"; do find "${dir}" -not \( -user paperless -and -group paperless \) -exec chown paperless:paperless {} + done set -e