#!/bin/bash

. /etc/os-release
echo "deb http://deb.debian.org/debian ${VERSION_CODENAME}-backports main" > \
    /etc/apt/sources.list.d/backports.list
apt update
apt install -t ${VERSION_CODENAME}-backports cockpit
exit

ROOT="_cpt_"
HOST="z-$(hostname)"
cat << EOT | sudo tee /etc/cockpit/cockpit.conf
[WebService]
Origins = https://cor.cherished.me wss://cor.cherished.me https://${HOST}.cherished.me wss://${HOST}.cherished.me
ProtocolHeader = X-Forwarded-Proto
UrlRoot=/${ROOT}
EOT
sudo systemctl restart cockpit.socket
