]> git.ipfire.org Git - thirdparty/git.git/commit
ci: skip sudo when we are already root
authorPatrick Steinhardt <ps@pks.im>
Fri, 12 Apr 2024 04:44:07 +0000 (06:44 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 12 Apr 2024 15:47:50 +0000 (08:47 -0700)
commit11d3f1aa5fce1838483a48e9fbabbd762e0dda97
treeda1fe29f8568b125d479e2e135aad6c4b62b10f1
parentab2b3aadf322fccffeaabe7470e1b5905537a888
ci: skip sudo when we are already root

Our "install-dependencies.sh" script is executed by non-dockerized jobs
to install dependencies. These jobs don't run with "root" permissions,
but with a separate user. Consequently, we need to use sudo(8) there to
elevate permissions when installing packages.

We're about to merge "install-docker-dependencies.sh" into that script
though, and our Docker containers do run as "root". Using sudo(8) is
thus unnecessary there, even though it would be harmless. On some images
like Alpine Linux though there is no sudo(8) available by default, which
would consequently break the build.

Adapt the script to make "sudo" a no-op when running as "root" user.
This allows us to easily reuse the script for our dockerized jobs.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ci/install-dependencies.sh