From db96e7d75b4f1c78e2a385d3453422132a11f2ec Mon Sep 17 00:00:00 2001 From: Dan Arnfield Date: Thu, 28 Jan 2021 08:37:15 -0600 Subject: [PATCH 1/2] Set archivebox UID/GID via envvars --- bin/docker_entrypoint.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bin/docker_entrypoint.sh b/bin/docker_entrypoint.sh index 865a9929..b806c0b2 100755 --- a/bin/docker_entrypoint.sh +++ b/bin/docker_entrypoint.sh @@ -3,6 +3,14 @@ DATA_DIR="${DATA_DIR:-/data}" ARCHIVEBOX_USER="${ARCHIVEBOX_USER:-archivebox}" +# Set the archivebox user UID & GID +if [[ -n "$ARCHIVEBOX_UID" && "$ARCHIVEBOX_UID" != 0 ]]; then + usermod -u "$ARCHIVEBOX_UID" "$ARCHIVEBOX_USER" > /dev/null 2>&1 +fi +if [[ -n "$ARCHIVEBOX_GID" && "$ARCHIVEBOX_GID" != 0 ]]; then + groupmod -g "$ARCHIVEBOX_GID" "$ARCHIVEBOX_USER" > /dev/null 2>&1 +fi + # Set the permissions of the data dir to match the archivebox user if [[ -d "$DATA_DIR/archive" ]]; then # check data directory permissions From 187ca7e2b5093586c7c2397eac90c2ccc3256b04 Mon Sep 17 00:00:00 2001 From: Dan Arnfield Date: Thu, 28 Jan 2021 08:48:21 -0600 Subject: [PATCH 2/2] Change env vars to linuxserver.io convention --- bin/docker_entrypoint.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/docker_entrypoint.sh b/bin/docker_entrypoint.sh index b806c0b2..65a4c1f6 100755 --- a/bin/docker_entrypoint.sh +++ b/bin/docker_entrypoint.sh @@ -4,11 +4,11 @@ DATA_DIR="${DATA_DIR:-/data}" ARCHIVEBOX_USER="${ARCHIVEBOX_USER:-archivebox}" # Set the archivebox user UID & GID -if [[ -n "$ARCHIVEBOX_UID" && "$ARCHIVEBOX_UID" != 0 ]]; then - usermod -u "$ARCHIVEBOX_UID" "$ARCHIVEBOX_USER" > /dev/null 2>&1 +if [[ -n "$PUID" && "$PUID" != 0 ]]; then + usermod -u "$PUID" "$ARCHIVEBOX_USER" > /dev/null 2>&1 fi -if [[ -n "$ARCHIVEBOX_GID" && "$ARCHIVEBOX_GID" != 0 ]]; then - groupmod -g "$ARCHIVEBOX_GID" "$ARCHIVEBOX_USER" > /dev/null 2>&1 +if [[ -n "$PGID" && "$PGID" != 0 ]]; then + groupmod -g "$PGID" "$ARCHIVEBOX_USER" > /dev/null 2>&1 fi # Set the permissions of the data dir to match the archivebox user