#! /bin/sh -e

# Remove existing apt sources
rm -rf /target/etc/apt/sources.list*
mkdir -p /target/etc/apt/sources.list.d

SRCFILE=/tmp/sources.list
DESTFILE=/target/etc/apt/sources.list

# /cdrom might be umounted by the time we get here,
# so the postinst copies sources.list to /tmp
if [ -f "$SRCFILE" ]
then
    cp "$SRCFILE" "$DESTFILE"
    chmod 644 "$DESTFILE"
fi

exit 0
