Entrypoint: Alpine fix overlapping PGID issue

pull/195/head
Luis Garcia 2024-09-13 16:24:58 -06:00
parent b3b0ccac73
commit 0c218fa9dd
1 changed files with 5 additions and 1 deletions

View File

@ -20,8 +20,12 @@ if [ "$(id -u)" = '0' ]; then
if command -v useradd > /dev/null; then
useradd --no-create-home -u "$PUID" -g "$PGID" jellyplex_watched
elif command -v adduser > /dev/null; then
# Get the group name based on the PGID since adduser does not have a flag to specify the group id
# and if the group id already exists the group name will be sommething unexpected
GROUPNAME=$(getent group "$PGID" | cut -d: -f1)
# Use alpine busybox adduser syntax
adduser -D -H -u "$PUID" -G jellyplex_watched jellyplex_watched
adduser -D -H -u "$PUID" -G "$GROUPNAME" jellyplex_watched
fi
fi
else