#!/bin/bash -x --
# set -x

url_gpg='https://dl.cloudsmith.io/public/caddy/stable/gpg.key'
path_gpg=/usr/share/keyrings/caddy-stable-archive-keyring.gpg
url_frepo='https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt'
path_frepo=/etc/apt/sources.list.d/caddy-stable.list

# set -A pkg_deps debian-keyring debian-archive-keyring apt-transport-https
pkg_deps=(debian-keyring debian-archive-keyring apt-transport-https)

command -v curl || pkg_deps+=(curl)
apt-get -qqy update
apt install -qqy ${pkg_dwps[@]}
curl -1sLf $url_gpg | gpg --dearmor -o $path_gpg
curl -1sLf $url_frepo | tee $path_frepo
apt-get -qqy update
apt-get -qqy install caddy

