From b1712683ad344029f78675d00692f75d7f0f5cc2 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 12 May 2023 16:19:38 +0100 Subject: [PATCH] CI: Make creation of user idempotent Signed-off-by: Simon McVittie --- tools/ci-install.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/ci-install.sh b/tools/ci-install.sh index c5131c37..2afcd789 100755 --- a/tools/ci-install.sh +++ b/tools/ci-install.sh @@ -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