diff --git a/zabbix_agent.sh b/zabbix_agent.sh index d72dc8e..ecaab3c 100644 --- a/zabbix_agent.sh +++ b/zabbix_agent.sh @@ -84,9 +84,12 @@ elif [ ${OS} == 'CentOS' ] || [ "${OS}" == "Rocky" ]; then dnf install -y zabbix-agent fi if [ "${OS_VERSION}" == "9.0" ]; then - # zabbix is suppleied via the EPEL Repo, we need to exlude it from there, this is done manaully right now - echo "Please exclude the zabbix packages from the EPEL Repo /etc/yum.repos.d/epel.repo excludepkgs=zabbix*" - read -p "Press any key to resume ..." + # zabbix is also supplied via the EPEL Repo, we need to exlude it from there + if [ $(grep -c "^excludepkgs=" /etc/yum.repos.d/epel.repo) -eq 1 ]; then + sed --in-place '/^excludepkgs=/ s/$/ zabbix*/' /etc/yum.repos.d/epel.repo + else + sed --in-place '/^enabled=1/ s/$/\nexcludepkgs=zabbix*/' /etc/yum.repos.d/epel.repo + fi rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/9/x86_64/zabbix-release-6.0-4.el9.noarch.rpm dnf clean all dnf install -y zabbix-agent