#!/usr/bin/env bash

URL=files.freeswitch.org/repo/deb
LIST_NAME=freeswitch-unstable.list
#RELEASE=stretch
#RELEASE=buster
RELEASE=bullseye

sudo sh -c "echo 'deb https://${URL}/debian-unstable/ ${RELEASE} main' > /etc/apt/sources.list-available/${LIST_NAME}"

sudo ln -s /etc/apt/sources.list-available/${LIST_NAME} /etc/apt/sources.list.d/${LIST_NAME}

# Add the public key:

wget -O - https://${URL}/debian-unstable/freeswitch_archive_g0.pub | apt-key add -

# Bypass apt-proxy 
#if [ -d /etc/apt/apt.conf.d/02proxy ]; then
#	if [ ! -z $(grep ${URL}) ]; then
#		echo "Acquire::http::Proxy { \"${URL}\" DIRECT; };" >> /etc/apt/apt.conf.d/02proxy
#	fi
#else
#		echo "Acquire::http::Proxy { \"${URL}\" DIRECT; };" >> /etc/apt/apt.conf.d/02proxy
#fi

apt-get update && apt-get install -y freeswitch-meta-all

