From 4333ee01bc587d640743a00aab2633b2cdce60a6 Mon Sep 17 00:00:00 2001 From: Pit Kleyersburg Date: Sat, 24 Feb 2018 11:20:00 +0100 Subject: [PATCH] Fix modifying the GID under alpine Fixes #306. --- Dockerfile | 2 +- scripts/docker-entrypoint.sh | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index f60ccd073..950c070c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ ENV PAPERLESS_EXPORT_DIR=/export \ # Install dependencies RUN apk --no-cache --update add \ - python3 gnupg libmagic bash \ + python3 gnupg libmagic bash shadow \ sudo poppler tesseract-ocr imagemagick ghostscript unpaper && \ apk --no-cache add --virtual .build-dependencies \ python3-dev poppler-dev gcc g++ musl-dev zlib-dev jpeg-dev && \ diff --git a/scripts/docker-entrypoint.sh b/scripts/docker-entrypoint.sh index f9fde70c8..f67513071 100644 --- a/scripts/docker-entrypoint.sh +++ b/scripts/docker-entrypoint.sh @@ -4,13 +4,13 @@ set -e # Source: https://github.com/sameersbn/docker-gitlab/ map_uidgid() { USERMAP_ORIG_UID=$(id -u paperless) - USERMAP_ORIG_UID=$(id -g paperless) - USERMAP_GID=${USERMAP_GID:-${USERMAP_UID:-$USERMAP_ORIG_GID}} - USERMAP_UID=${USERMAP_UID:-$USERMAP_ORIG_UID} - if [[ ${USERMAP_UID} != "${USERMAP_ORIG_UID}" || ${USERMAP_GID} != "${USERMAP_ORIG_GID}" ]]; then - echo "Mapping UID and GID for paperless:paperless to $USERMAP_UID:$USERMAP_GID" - addgroup -g "${USERMAP_GID}" paperless - sed -i -e "s|:${USERMAP_ORIG_UID}:${USERMAP_GID}:|:${USERMAP_UID}:${USERMAP_GID}:|" /etc/passwd + USERMAP_ORIG_GID=$(id -g paperless) + USERMAP_NEW_UID=${USERMAP_UID:-$USERMAP_ORIG_UID} + USERMAP_NEW_GID=${USERMAP_GID:-${USERMAP_ORIG_GID:-$USERMAP_NEW_UID}} + if [[ ${USERMAP_NEW_UID} != "${USERMAP_ORIG_UID}" || ${USERMAP_NEW_GID} != "${USERMAP_ORIG_GID}" ]]; then + echo "Mapping UID and GID for paperless:paperless to $USERMAP_NEW_UID:$USERMAP_NEW_GID" + usermod -u "${USERMAP_NEW_UID}" paperless + groupmod -g "${USERMAP_NEW_GID}" paperless fi } @@ -64,7 +64,7 @@ install_languages() { if [ "$lang" == "eng" ]; then continue fi - + if apk info -e "$pkg" > /dev/null 2>&1; then continue fi