Skip to content

Commit 6b99576

Browse files
szedergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5330330 commit 6b99576

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ci/run-linux32-build.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ then
3333
CI_USER=root
3434
else
3535
CI_USER=ci
36-
useradd -u $HOST_UID $CI_USER
36+
if test "$(id -u $CI_USER 2>/dev/null)" = $HOST_UID
37+
then
38+
echo "user '$CI_USER' already exists with the requested ID $HOST_UID"
39+
else
40+
useradd -u $HOST_UID $CI_USER
41+
fi
42+
3743
# Due to a bug the test suite was run as root in the past, so
3844
# a prove state file created back then is only accessible by
3945
# root. Now that bug is fixed, the test suite is run as a

0 commit comments

Comments
 (0)