CI: Make creation of user idempotent

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2023-05-12 16:19:38 +01:00
parent a6da40b206
commit b1712683ad

View file

@ -286,8 +286,10 @@ case "$ci_distro" in
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
useradd -m user
passwd -ud user
if ! getent passwd user >/dev/null; then
useradd -m user
passwd -ud user
fi
echo "user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/nopasswd
chmod 0440 /etc/sudoers.d/nopasswd
fi