#!/bin/bash
#Goto ProjectRoot
cd "$( cd "$( dirname "$0" )" &> /dev/null && pwd )/.."

GetResource () {
    local Variant=$1
    local FileName=$2
    local GetAddr=$3
    echo "Getting $FileName for $Variant"
    curl -L --retry 7 --retry-delay 5 "$GetAddr" -o "CT-Files/$Variant/$FileName"
}

#PhpMyadmin for mysql variant
GetResource mysql phpmyadmin.tar.gz https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-english.tar.gz
GetResource nginx nginx_signing.rsa.pub https://nginx.org/keys/nginx_signing.rsa.pub
GetResource nginx acmesh.tar.gz https://codeload.github.com/acmesh-official/acme.sh/tar.gz/master
GetResource domoticz domoticz.tgz https://releases.domoticz.com/releases/release/domoticz_linux_x86_64.tgz