diff options
author | Simon McVittie <smcv@collabora.com> | 2023-08-01 18:30:14 +0100 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2023-08-01 18:30:14 +0100 |
commit | 8d14293458c99856bc5f3931e3e46a0c82884680 (patch) | |
tree | c6fe2357e918fda728b1d5179c522278f2b39388 /tools | |
parent | b230cf03b0812fe758801fd3901c266c3199ff2d (diff) |
CI: Make user creation idempotent
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>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/ci-install.sh | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/ci-install.sh b/tools/ci-install.sh index 2afcd789..8abbc6d0 100755 --- a/tools/ci-install.sh +++ b/tools/ci-install.sh @@ -173,7 +173,9 @@ 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 - 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 |