fix: handle user UID/GID

This commit is contained in:
Glenn Y. Rolland 2021-11-30 15:16:01 +01:00
parent 141b1e33f2
commit d8354512e3

View file

@ -9,12 +9,12 @@ echo "Arguments: $ARGS"
EXT_UID=${EXT_UID:-999}
EXT_GID=${EXT_GID:-999}
if ! grep "^[^:]*:[^:]*:$EXT_UID:" /etc/group ; then
if ! grep -q "^[^:]*:[^:]*:$EXT_UID:" /etc/group ; then
groupadd -g "$EXT_GID" appuser
fi
if ! grep "^[^:]*:[^:]*:$EXT_UID:" /etc/passwd ; then
if ! grep -q "^[^:]*:[^:]*:$EXT_UID:" /etc/passwd ; then
useradd -r -u "$EXT_UID" -g appuser appuser
fi
exec gosu appuser make "$@"
exec gosu "$EXT_UID:$EXT_GID" make "$@"