contrib: avoid using "sudo" in REQUIRED_PACKAGES scripts

It's often not installed, and usually we are already root. Avoid
using sudo.
This commit is contained in:
Thomas Haller 2023-02-03 13:36:00 +01:00
parent ea3e61047f
commit f6805debee
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
3 changed files with 12 additions and 6 deletions

View file

@ -53,10 +53,10 @@ variables:
#
# This is done by running `ci-fairy generate-template` and possibly bumping
# ".default_tag".
FEDORA_TAG: '2023-01-18.0-296fbfd97862'
UBUNTU_TAG: '2023-01-18.0-08fb4e6eb861'
DEBIAN_TAG: '2023-01-18.0-08fb4e6eb861'
CENTOS_TAG: '2023-01-18.0-296fbfd97862'
FEDORA_TAG: '2023-01-18.0-82ad875db2dc'
UBUNTU_TAG: '2023-01-18.0-1218be1cbc9d'
DEBIAN_TAG: '2023-01-18.0-1218be1cbc9d'
CENTOS_TAG: '2023-01-18.0-82ad875db2dc'
ALPINE_TAG: '2023-01-18.0-14c807942fa4'
FEDORA_EXEC: 'bash .gitlab-ci/fedora-install.sh'

View file

@ -12,11 +12,14 @@ set -xe
# Not all of these packages are strictly speaking necessary.
# This is a generous list of related packages.
SUDO=
[ "$EUID" -eq 0 ] || SUDO=sudo
install() {
if [ "$NM_INSTALL" != "" ]; then
$NM_INSTALL "$@"
else
sudo apt-get install -y "$@"
$SUDO apt-get install -y "$@"
fi
}

View file

@ -14,11 +14,14 @@ set -xe
DNF="$(command -v dnf &>/dev/null && echo dnf || echo yum)"
SUDO=
[ "$EUID" -eq 0 ] || SUDO=sudo
install() {
if [ "$NM_INSTALL" != "" ]; then
$NM_INSTALL "$@"
else
sudo "$DNF" install -y "$@"
$SUDO "$DNF" install -y "$@"
fi
}