#!/bin/sh
#
# Finalises apt sources in the installed system.
# debian.sources and vesperos.sources are already correct — carried over from
# the squashfs by unpackfs. We just need to clear the legacy sources.list and
# remove any build-time-only sources.
#

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

# Empty the legacy sources.list — Debian uses .sources (DEB822) now
echo "# This file is intentionally left blank, Debian has moved to the new DEB822 format." > "$CHROOT/etc/apt/sources.list"
echo "# Please use .sources files in /etc/apt/sources.list.d/ instead." >> "$CHROOT/etc/apt/sources.list"
echo "# For more information, see https://wiki.debian.org/SourcesList" >> "$CHROOT/etc/apt/sources.list"

# Remove build-time-only sources
rm -f "$CHROOT/etc/apt/sources.list.d/00-temp.list"
rm -f "$CHROOT/etc/apt/apt.conf.d/51cache"

exit 0
