From 1b04b800b829bc837a791259a2076b02649016d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lesimple?= Date: Fri, 19 Mar 2021 15:10:42 +0000 Subject: [PATCH] fix: packages-check.sh: centos: ensure cache is up to date before trying to install packages --- bin/admin/packages-check.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/admin/packages-check.sh b/bin/admin/packages-check.sh index 36193d0..63dd6e4 100755 --- a/bin/admin/packages-check.sh +++ b/bin/admin/packages-check.sh @@ -93,9 +93,15 @@ elif echo "$DISTRO_LIKE" | grep -q -w rhel; then sed -i -e 's/enabled=.*/enabled=1/g' /etc/yum.repos.d/$repo.repo done fi - yum install -y epel-release + if command -v dnf >/dev/null; then + dnf_or_yum=dnf + else + dnf_or_yum=yum + fi + $dnf_or_yum makecache + $dnf_or_yum install -y epel-release # shellcheck disable=SC2086 - yum install -y $wanted_list + $dnf_or_yum install -y $wanted_list exit 0 fi