#!/usr/bin/env bash
#!/bin/bash
set -e

#RELEASE_NAME=Debian_Unstable
#RELEASE_NAME=Debian_Testing
#RELEASE_NAME=Debian_9.0 # stretch
#RELEASE_NAME=Debian_10  # buster
#RELEASE_NAME=Debian_11 # bullseye
RELEASE_NAME=Debian_12 # bookworm

SUSE_USER="ra3xdh"
# KEY_DIR=/etc/apt/keyrings
KEY_DIR=/etc/apt/trusted.gpg.d/
KEY=${KEY_DIR}/ra3xdh.keyring.gpg

mkdir -p /etc/apt//sources.list-available || exit
cat <<EOF | sudo tee /etc/apt/sources.list-available/qucs-s.list >/dev/null
# wget -nv https://download.opensuse.org/repositories/home:/${SUSE_USER}/${RELEASE_NAME}/Release.key -O ${KEY}
# apt-key add - < Release.key
deb [signed-by=${KEY}] http://download.opensuse.org/repositories/home:/${SUSE_USER}/${RELEASE_NAME}/ /
EOF

# The dl-bintray repo doesn't play nice with apt-proxy
#echo "Acquire::http::Proxy { dl.bintray.com DIRECT;  };" >> /etc/apt/apt.conf.d/02proxy

sudo ln -sf /etc/apt/sources.list-available/qucs-s.list /etc/apt/sources.list.d/qucs-s.list

wget -nv https://download.opensuse.org/repositories/home:/${SUSE_USER}/${RELEASE_NAME}/Release.key -O- | gpg --dearmor -o ${KEY}

sudo apt update

sudo apt install -y qucs-s
