1
0
mirror of https://git.code.sf.net/p/linux-ima/ima-evm-utils synced 2025-04-28 06:33:36 +02:00

CI: Do not use sudo when not needed

Some distributions, such as ALT, cannot use sudo under root by default.
Error message will appear:

  root is not in the sudoers file.  This incident will be reported.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
Vitaly Chikunov 2021-07-12 08:16:43 +03:00 committed by Mimi Zohar
parent a7dd075ef7
commit aef36466c9

View File

@ -1,5 +1,13 @@
#!/bin/sh #!/bin/sh -ex
set -ex
# No need to run via sudo if we already have permissions.
# Also, some distros do not have sudo configured for root:
# `root is not in the sudoers file. This incident will be reported.'
if [ -w /usr/local/bin ]; then
SUDO=
else
SUDO=sudo
fi
version=1637 version=1637
@ -9,5 +17,5 @@ cd ibmtpm$version
tar --no-same-owner -xvzf ../download tar --no-same-owner -xvzf ../download
cd src cd src
make -j$(nproc) make -j$(nproc)
sudo cp tpm_server /usr/local/bin/ $SUDO cp tpm_server /usr/local/bin/
cd ../.. cd ../..