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

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

rm -f "$CHROOT"/etc/apt/sources.list.d/*
echo > "$CHROOT/etc/apt/sources.list"

cat <<- EOF > "$CHROOT/etc/apt/sources.list.d/debian.sources"
	Types: deb
	URIs: http://deb.debian.org/debian/
	Suites: $RELEASE $RELEASE-updates
	Components: main contrib non-free non-free-firmware
	Signed-By: /usr/share/keyrings/debian-archive-keyring.pgp

	Types: deb
	URIs: http://deb.debian.org/debian-security/
	Suites: $RELEASE-security
	Components: main contrib non-free non-free-firmware
	Signed-By: /usr/share/keyrings/debian-archive-keyring.pgp
EOF

cat <<- EOF > "$CHROOT/etc/apt/sources.list.d/raspi.sources"
	Types: deb
	URIs: http://archive.raspberrypi.com/debian/
	Suites: $RELEASE
	Components: main
	Signed-By: /usr/share/keyrings/raspberrypi-archive-keyring.pgp
EOF

exit 0
