summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder.dev@gmail.com>2018-01-29 17:17:13 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-01-30 21:27:19 (GMT)
commit6b995760dc463d050791d3815c20e4cb78ce4c2c (patch)
tree4635d84df058537ed5daa972a48ddc7740cdc2a6
parent533033024a15ad2aa7b853277cbb8f04d74edc48 (diff)
downloadgit-6b995760dc463d050791d3815c20e4cb78ce4c2c.zip
git-6b995760dc463d050791d3815c20e4cb78ce4c2c.tar.gz
git-6b995760dc463d050791d3815c20e4cb78ce4c2c.tar.bz2
travis-ci: don't fail if user already exists on 32 bit Linux build job
The 32 bit Linux build job runs in a Docker container, which lends itself to running and debugging locally, too. Especially during debugging one usually doesn't want to start with a fresh container every time, to save time spent on installing a bunch of dependencies. However, that doesn't work quite smootly, because the script running in the container always creates a new user, which then must be removed every time before subsequent executions, or the build script fails. Make this process more convenient and don't try to create that user if it already exists and has the right user ID in the container, so developers don't have to bother with running a 'userdel' each time before they run the build script. The build job on Travis CI always starts with a fresh Docker container, so this change doesn't make a difference there. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xci/run-linux32-build.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/ci/run-linux32-build.sh b/ci/run-linux32-build.sh
index 8c1b500..2c60d2e 100755
--- a/ci/run-linux32-build.sh
+++ b/ci/run-linux32-build.sh
@@ -33,7 +33,13 @@ then
CI_USER=root
else
CI_USER=ci
- useradd -u $HOST_UID $CI_USER
+ if test "$(id -u $CI_USER 2>/dev/null)" = $HOST_UID
+ then
+ echo "user '$CI_USER' already exists with the requested ID $HOST_UID"
+ else
+ useradd -u $HOST_UID $CI_USER
+ fi
+
# Due to a bug the test suite was run as root in the past, so
# a prove state file created back then is only accessible by
# root. Now that bug is fixed, the test suite is run as a