#!/bin/sh
#
# Writes the final sources.list file
#

CHROOT=$(mount | grep proc | grep calamares | awk '{print $3}' | sed -e "s#/proc##g")
RELEASE="bookworm"

cat << EOF > $CHROOT/etc/apt/sources.list
# See https://wiki.debian.org/SourcesList for more information.
deb http://debian-archive.trafficmanager.net/debian $RELEASE main contrib non-free non-free-firmware
# deb-src http://debian-archive.trafficmanager.net/debian $RELEASE main contrib non-free non-free-firmware

deb http://debian-archive.trafficmanager.net/debian $RELEASE-updates main contrib non-free non-free-firmware
# deb-src http://debian-archive.trafficmanager.net/debian $RELEASE-updates main contrib non-free non-free-firmware

deb http://security.debian.org/debian-security/ $RELEASE-security main contrib non-free non-free-firmware
# deb-src http://security.debian.org/debian-security/ $RELEASE-security main contrib non-free non-free-firmware

# Backports allow you to install newer versions of software made available for this release
deb http://debian-archive.trafficmanager.net/debian $RELEASE-backports main contrib non-free non-free-firmware
# deb-src http://debian-archive.trafficmanager.net/debian $RELEASE-backports main contrib non-free non-free-firmware

EOF


#
# Reconfigure GRUB for theming
#

chroot ${CHROOT} /bin/bash -c "dpkg-reconfigure lingmo-grub-config"

# Regenerating Host keys
chroot ${CHROOT} /bin/bash -c "dpkg-reconfigure openssh-server"

exit 0
