From 9b4ef39279fe9f1e318572a54af8bb20faf4d086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Kr=C5=A1ka?= Date: Thu, 28 Dec 2023 23:46:26 +0100 Subject: [PATCH] fix group and user existance check --- docker/docker-compose.yml | 2 +- docker/entrypoint.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index b12e92b..2180bee 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -11,7 +11,7 @@ services: environment: TZ: 'Europe/Prague' PUID: 1000 - GUID: 1000 + GUID: 65534 privileged: true # needed for containers volumes: - ./data:/data diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index a3e6d97..34b421a 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -9,16 +9,16 @@ if [ -z "$PUID" ]; then fi if [ -z "$GUID" ]; then - echo 'Environment variable $PUID not specified' + echo 'Environment variable $GUID not specified' exit 1 fi # create astrid user and group -if [ ! $(getent group astrid) ]; then +if [ ! $(getent group astrid) ] && [ ! $(getent group $GUID) ]; then groupadd --gid $GUID astrid echo "Group astrid with GID $GUID created." fi -if [ ! $(getent passwd astrid) ]; then +if [ ! $(getent passwd astrid) ] && [ ! $(getent passwd $PUID) ]; then useradd --uid $PUID --gid $GUID --create-home --add-subids-for-system astrid echo "User astrid with UID $PUID created." fi