#!/bin/sh
#
# Writes the final sources configuration file in DEB822 format
#

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

cat <<EOF > $CHROOT/etc/apt/sources.list.d/blankon.sources
Types: deb deb-src
URIs: http://arsip-dev.blankonlinux.id/dev/
Suites: $RELEASE
Components: main extras restricted restricted-firmware
Signed-By: /usr/share/keyrings/blankon-archive-keyring.gpg

EOF

# Remove legacy sources.list if it exists to ensure clean APT configuration
if [ -f "$CHROOT/etc/apt/sources.list" ]; then
    echo "Removing legacy /etc/apt/sources.list"
    rm -f "$CHROOT/etc/apt/sources.list"
fi

exit 0
