#!/bin/sh -ex

case "${DISTRO}" in
debian:*|ubuntu:*)
    export DEBIAN_FRONTEND=noninteractive
    apt clean
    apt update
    apt -y install gcc meson pkg-config libjose-dev jose libhttp-parser-dev \
                   systemd gcovr curl socat iproute2 asciidoc
    ;;

*fedora:*)
    echo 'max_parallel_downloads=10' >> /etc/dnf/dnf.conf
    dnf -y clean all
    dnf -y --setopt=deltarpm=0 update
    dnf -y install gcc meson pkgconfig libjose-devel jose llhttp-devel \
                   systemd gcovr curl socat iproute asciidoc
    ;;

centos:7)
    yum -y clean all
    yum -y --setopt=deltarpm=0 update
    yum install -y yum-utils epel-release
    yum config-manager -y --set-enabled PowerTools \
        || yum config-manager -y --set-enabled powertools || :
    yum -y install meson socat iproute asciidoc
    yum-builddep -y tang
    ;;

*centos:stream*)
    dnf -y clean all
    dnf -y --setopt=deltarpm=0 update
    dnf install -y dnf-plugins-core epel-release
    dnf config-manager -y --set-enabled powertools \
        || dnf config-manager -y --set-enabled crb || :
    dnf -y install meson socat iproute
    dnf builddep -y tang --allowerasing --skip-broken --nobest
    ;;
esac
# vim: set ts=8 shiftwidth=4 softtabstop=4 expandtab smarttab colorcolumn=80:
