File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -411,12 +411,16 @@ elif [ "${USERNAME}" = "none" ]; then
411
411
USER_UID=0
412
412
USER_GID=0
413
413
fi
414
+
414
415
# Create or update a non-root user to match UID/GID.
415
- group_name=" ${USERNAME} "
416
+ group_name=$( getent group " $USER_GID " | cut -d: -f3)
417
+ if [ -z " $group_name " ]; then
418
+ # Group does not yet exist and will be created. Use the user name as group name.
419
+ group_name=" ${USERNAME} "
420
+ fi
416
421
if id -u ${USERNAME} > /dev/null 2>&1 ; then
417
422
# User exists, update if needed
418
423
if [ " ${USER_GID} " != " automatic" ] && [ " $USER_GID " != " $( id -g $USERNAME ) " ]; then
419
- group_name=" $( id -gn $USERNAME ) "
420
424
groupmod --gid $USER_GID ${group_name}
421
425
usermod --gid $USER_GID $USERNAME
422
426
fi
You can’t perform that action at this time.
0 commit comments