adduser --system exits successfully if the user already exists, but
ordinary adduser doesn't.
Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/468
Signed-off-by: Simon McVittie <smcv@collabora.com>
if [ "$ci_in_docker" = yes ]; then
# Add the user that we will use to do the build inside the
# Docker container, and let them use sudo
- adduser --disabled-password --gecos "" user
+ if ! getent passwd user > /dev/null; then
+ adduser --disabled-password --gecos "" user
+ fi
echo "user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/nopasswd
chmod 0440 /etc/sudoers.d/nopasswd
fi