Don't use sudo in pre-build script when running as root

Just run apt-get directly in this case.
This commit is contained in:
Vadim Zeitlin 2022-12-30 18:19:55 +01:00
parent 2b5bb6217d
commit 543f5ce6d2

View file

@ -9,10 +9,18 @@
set -e
SUDO=sudo
case $(uname -s) in
Linux)
# Use sudo if it's available or assume root otherwise.
if command -v sudo > /dev/null; then
SUDO=sudo
else
if [ `id -u` -ne 0 ]; then
echo "Please install sudo or run as root (and not user `id -u`)." >& 2
exit 1
fi
fi
# Debian/Ubuntu
if [ -f /etc/apt/sources.list ]; then
# Show information about the repositories and priorities used.