#!/bin/bash

# unattended-upgrades
apt install -y unattended-upgrades
echo -e 'Unattended-Upgrade::Origins-Pattern {\n\t"origin=*";\n};\n\nUnattended-Upgrade::MinimalSteps "true";\nUnattended-Upgrade::Remove-Unused-Kernel-Packages "true";\nUnattended-Upgrade::Remove-New-Unused-Dependencies "true";\nUnattended-Upgrade::Remove-Unused-Dependencies "true";' > /etc/apt/apt.conf.d/50unattended-upgrades

# Docker
mkdir /root/.docker
echo "{}" > /root/.docker/config.json

apt install -y curl gnupg lsb-release vim rsync btrfs-progs
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update && apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin

mkdir /root/.ssh
curl https://cdn.patchli.fr/keys/public_ssh.txt > /root/.ssh/authorized_keys

mkdir Docker && mkdir Docker/applications && touch Docker/docker-compose.yml


echo " " > /etc/motd

# done
apt autoremove && apt clean
