File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ install_debian_packages() {
105
105
106
106
# Needed for adding manpages-posix and manpages-posix-dev which are non-free packages in Debian
107
107
if [ " ${ADD_NON_FREE_PACKAGES} " = " true" ]; then
108
- if [[ ! -e " /etc/apt/sources.list" ]] && [[ -e " /etc/apt/sources.list.d/debian.sources" ]]; then
108
+ if [[ ! -e " /etc/apt/sources.list" ]] && [[ -e " /etc/apt/sources.list.d/debian.sources" ]]; then
109
109
sed -i ' /^URIs: http:\/\/deb.debian.org\/debian$/ { N; N; s/Components: main/Components: main non-free non-free-firmware/ }' /etc/apt/sources.list.d/debian.sources
110
110
else
111
111
# Bring in variables from /etc/os-release like VERSION_CODENAME
@@ -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