#!/bin/bash

PKGS="libsodium re2 jemalloc compat-lua compat-lua-libs lua-sec lua-socket libzstd yaml-cpp udns libdev fstrm dnsperf htop python2-scapy python2-pip libnghttp2 librdkafka openssl11-libs-1.1.1k python2-redis boost169-chrono boost169-context boost169-filesystem boost169-system boost169-thread tcpreplay"

cd /var/www/share/third-party-packages
for pkg in $PKGS
do
	yumdownloader --releasever=7 --disablerepo='*' --enablerepo=epel --resolve --installroot=/var/www/share/third-party-packages $pkg
done

PKGS="knot-utils jq"
for pkg in $PKGS
do
        yumdownloader --releasever=7 --disablerepo='*' --enablerepo=epel --resolve --installroot=/var/www/share/third-party-packages $pkg
done

PKGS="openresty openresty-openssl111 openresty-pcre openresty-zlib"
for pkg in $PKGS
do
        yumdownloader --releasever=7 --disablerepo='*' --enablerepo=openresty --resolve --installroot=/var/www/share/third-party-packages $pkg
done

#PKGS="postgresql10-10.14 postgresql10-libs-10.14 postgresql10-server-10.14 python3-psycopg2 repmgr10"
#for pkg in $PKGS
#do
#        yumdownloader --releasever=7 --disablerepo='*' --enablerepo=pgdg10 --resolve --installroot=/var/www/share/third-party-packages $pkg
#done

PKGS="grafana"
for pkg in $PKGS
do
        yumdownloader --releasever=7 --disablerepo='*' --enablerepo=grafana-stable --resolve --installroot=/var/www/share/third-party-packages $pkg
done

PKGS="prometheus2 alertmanager blackbox_exporter pushgateway"
for pkg in $PKGS
do
        yumdownloader --releasever=7 --disablerepo='*' --enablerepo=prometheus --resolve --installroot=/var/www/share/third-party-packages $pkg
done

PKGS="dnsmeter"
for pkg in $PKGS
do
        yumdownloader --releasever=7 --disablerepo='*' --enablerepo=dnsoarc-dnsmeter --resolve --installroot=/var/www/share/third-party-packages $pkg
done


BASEURL="https://share.presales.powerdns.equipment/third-party-packages"
ls -1 | while read line
do
	echo "'$BASEURL/$line',"
done

