From 2b3f17972af72aec5da7650ec2940839d58fe67d Mon Sep 17 00:00:00 2001 From: SergeantPanda Date: Wed, 7 May 2025 21:10:56 -0500 Subject: [PATCH] Rename group to dispatch if it isn't already. --- docker/init/01-user-setup.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/docker/init/01-user-setup.sh b/docker/init/01-user-setup.sh index 5be17671..83530f10 100644 --- a/docker/init/01-user-setup.sh +++ b/docker/init/01-user-setup.sh @@ -4,10 +4,21 @@ export PUID=${PUID:-1000} export PGID=${PGID:-1000} -# Create group if it doesn't exist -if ! getent group "$PGID" >/dev/null 2>&1; then +# Check if group with PGID exists +if getent group "$PGID" >/dev/null 2>&1; then + # Group exists, check if it's named 'dispatch' + existing_group=$(getent group "$PGID" | cut -d: -f1) + if [ "$existing_group" != "dispatch" ]; then + # Rename the existing group to 'dispatch' + groupmod -n "dispatch" "$existing_group" + echo "Group $existing_group with GID $PGID renamed to dispatch" + fi +else + # Group doesn't exist, create it groupadd -g "$PGID" dispatch + echo "Group dispatch with GID $PGID created" fi + # Create user if it doesn't exist if ! getent passwd $PUID > /dev/null 2>&1; then useradd -u $PUID -g $PGID -m $POSTGRES_USER