#!/bin/bash -eu
#

mkdir -p /etc/apt/certs/
wget --no-check-certificate https://appm.update.abakus.si:448/appm-ca.crt -O /etc/apt/certs/appm-ca.crt   # Debian
chown _apt:nogroup /etc/apt/certs/appm-ca.crt
chmod 0400 /etc/apt/certs/appm-ca.crt

echo 'deb [trusted=yes] https://appm.update.abakus.si:448/repo-free/deb12/ / ' > /etc/apt/sources.list.d/abakus.list
echo 'Acquire::https::appm.update.abakus.si::CaInfo "/etc/apt/certs/appm-ca.crt";' >  /etc/apt/apt.conf.d/80abakus
echo 'Acquire::https::appm.update.abakus.si::Verify-Peer "false";'                 >> /etc/apt/apt.conf.d/80abakus

echo 'Created files:'
echo ' - /etc/apt/certs/appm-ca.crt'
echo ' - /etc/apt/sources.list.d/abakus.list'
echo ' - /etc/apt/apt.conf.d/80abakus'

