#!/bin/bash
#
# Eocortex Ubuntu Repository

readonly UBUNTU_FILE_VERSION=$(cat /etc/os-release)

sudo rm -f /etc/apt/sources.list.d/eocortex* >/dev/null

sudo apt-get update && sudo apt-get install gpg -y >/dev/null

if echo "$UBUNTU_FILE_VERSION" | grep -q 'VERSION_ID="24.04"'; then
  sudo add-apt-repository -y ppa:dotnet/backports
fi

wget -O- -q https://packages.eocortex.com/deb/eocortex.gpg.key | sudo apt-key add -

sudo echo "deb https://packages.eocortex.com/deb/public ubuntu-20.04 main
deb https://packages.eocortex.com/deb/public ubuntu-20.04 extensions" | sudo tee /etc/apt/sources.list.d/eocortex.list > /dev/null

sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

sudo apt-get update
