#!/bin/bash -e

. ../../xi-sys.cfg

pkgversion=1.0.1
pkgname="nagios-mod-gearman-${pkgversion}"

echo "INSTALL: Nagios Mod-Gearman is being installed..."

if [ "$distro" == "Debian" ] && [ "$ver" -eq 11 ]; then
    apt install -y "./debs/11/nagios-mod-gearman-doc_${pkgversion}_all.deb" "./debs/11/nagios-mod-gearman-module_${pkgversion}_amd64.deb" "./debs/11/nagios-mod-gearman-tools_${pkgversion}_amd64.deb" "./debs/11/nagios-mod-gearman-worker_${pkgversion}_amd64.deb" "gearman"
elif [ "$distro" == "Debian" ] || [ "$distro" == "Ubuntu" ]; then
    apt install -y "./debs/nagios-mod-gearman-doc_${pkgversion}_all.deb" "./debs/nagios-mod-gearman-module_${pkgversion}_amd64.deb" "./debs/nagios-mod-gearman-tools_${pkgversion}_amd64.deb" "./debs/nagios-mod-gearman-worker_${pkgversion}_amd64.deb" "gearman"
else
    dnf install -y gearmand "${pkgname}"
fi

./configure

echo "Nagios Mod-Gearman installed OK"
