Skip to content

Commit

Permalink
fix group and user existance check
Browse files Browse the repository at this point in the history
  • Loading branch information
Headary committed Dec 28, 2023
1 parent f84f49c commit 9b4ef39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
environment:
TZ: 'Europe/Prague'
PUID: 1000
GUID: 1000
GUID: 65534
privileged: true # needed for containers
volumes:
- ./data:/data
Expand Down
6 changes: 3 additions & 3 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9b4ef39

Please sign in to comment.